LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] backlight control for Frontpath ProGear HX1050+
@ 2007-02-06 13:30 Marcin Juszkiewicz
  2007-02-06 19:26 ` Richard Purdie
  0 siblings, 1 reply; 9+ messages in thread
From: Marcin Juszkiewicz @ 2007-02-06 13:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Richard Purdie

From: Marcin Juszkiewicz <openembedded@hrw.one.pl>

Add control of LCD backlight for Frontpath ProGear HX1050+.
Patch is based on http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz
driver by M Schacht.

Signed-Off-By: Marcin Juszkiewicz <openembedded@hrw.one.pl>

---
Patch follow kernel version 2.6.20

 Kconfig      |    8 +++
 Makefile     |    1
 progear_bl.c |  157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 166 insertions(+)


Index: linux-2.6.20/drivers/video/backlight/Kconfig
===================================================================
--- linux-2.6.20.orig/drivers/video/backlight/Kconfig	2007-02-04 19:44:54.000000000 +0100
+++ linux-2.6.20/drivers/video/backlight/Kconfig	2007-02-05 16:13:13.000000000 +0100
@@ -66,3 +66,11 @@
 	  If you have a HP Jornada 680, say y to enable the
 	  backlight driver.
 
+config BACKLIGHT_PROGEAR
+       tristate "Frontpath ProGear Backlight Driver"
+       depends on BACKLIGHT_DEVICE && PCI
+       default y
+       help
+         If you have a Frontpath ProGear say Y to enable the
+         backlight driver.
+
Index: linux-2.6.20/drivers/video/backlight/progear_bl.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.20/drivers/video/backlight/progear_bl.c	2007-02-05 16:29:14.000000000 +0100
@@ -0,0 +1,157 @@
+/*
+ *  Backlight Driver for Frontpath ProGear HX1050+
+ *
+ *  Copyright (c) 2006 Marcin Juszkiewicz
+ *
+ *  Based on Progear LCD driver by M Schacht
+ *  <mschacht at alumni dot washington dot edu>
+ *
+ *  Based on Sharp's Corgi Backlight Driver
+ *  Based on Backlight Driver for HP Jornada 680
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/pci.h>
+#include <asm/uaccess.h>
+
+#define PMU_LPCR               0xB0
+#define SB_MPS1                0x61
+#define HW_LEVEL_MAX           0x77
+#define HW_LEVEL_MIN           0x4f
+
+static int progearbl_intensity;
+static struct backlight_properties progearbl_data;
+static struct backlight_device *progear_backlight_device;
+
+static struct pci_dev *pmu_dev = NULL;
+static struct pci_dev *sb_dev = NULL;
+
+static int progearbl_send_intensity(struct backlight_device *bd)
+{
+       int intensity = bd->props->brightness;
+
+       if (bd->props->power != FB_BLANK_UNBLANK)
+               intensity = 0;
+       if (bd->props->fb_blank != FB_BLANK_UNBLANK)
+               intensity = 0;
+
+       pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN);
+
+       progearbl_intensity = intensity;
+
+       return 0;
+}
+
+static int progearbl_get_intensity(struct backlight_device *bd)
+{
+       return progearbl_intensity;
+}
+
+static int progearbl_set_intensity(struct backlight_device *bd)
+{
+       progearbl_send_intensity(progear_backlight_device);
+
+       return 0;
+}
+
+static struct backlight_properties progearbl_data = {
+       .owner = THIS_MODULE,
+       .get_brightness = progearbl_get_intensity,
+       .update_status = progearbl_set_intensity,
+};
+
+static int progearbl_probe(struct platform_device *pdev)
+{
+       u8 temp;
+
+       pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);
+       if (!pmu_dev) {
+               printk("ALI M7101 PMU not found.\n");
+               return -ENODEV;
+       }
+
+       sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0);
+       if (!sb_dev) {
+               printk("ALI 1533 SB not found.\n");
+               pci_dev_put(pmu_dev);
+               return -ENODEV;
+       }
+
+       /*     Set SB_MPS1 to enable brightness control. */
+       pci_read_config_byte(sb_dev, SB_MPS1, &temp);
+       pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
+
+       progear_backlight_device = backlight_device_register("progear-bl",
+			   &pdev->dev, NULL, &progearbl_data);
+       if (IS_ERR(progear_backlight_device))
+               return PTR_ERR(progear_backlight_device);
+
+       progearbl_data.power = FB_BLANK_UNBLANK;
+       progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+       progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+       progearbl_send_intensity(progear_backlight_device);
+
+       return 0;
+}
+
+static int progearbl_remove(struct platform_device *dev)
+{
+       backlight_device_unregister(progear_backlight_device);
+
+       return 0;
+}
+
+static struct platform_driver progearbl_driver = {
+       .probe = progearbl_probe,
+       .remove = progearbl_remove,
+       .driver = {
+                  .name = "progear-bl",
+                  },
+};
+
+static struct platform_device *progearbl_device;
+
+static int __init progearbl_init(void)
+{
+       int ret = platform_driver_register(&progearbl_driver);
+       if (!ret) {
+               progearbl_device = platform_device_alloc("progear-bl", -1);
+               if (!progearbl_device)
+                       return -ENOMEM;
+
+               ret = platform_device_add(progearbl_device);
+
+               if (ret) {
+                       platform_device_put(progearbl_device);
+                       platform_driver_unregister(&progearbl_driver);
+               }
+       }
+       return ret;
+}
+
+static void __exit progearbl_exit(void)
+{
+       pci_dev_put(pmu_dev);
+       pci_dev_put(sb_dev);
+
+       platform_device_unregister(progearbl_device);
+       platform_driver_unregister(&progearbl_driver);
+}
+
+module_init(progearbl_init);
+module_exit(progearbl_exit);
+
+MODULE_AUTHOR("Marcin Juszkiewicz <linux@hrw.one.pl>");
+MODULE_DESCRIPTION("ProGear Backlight Driver");
+MODULE_LICENSE("GPL");
Index: linux-2.6.20/drivers/video/backlight/Makefile
===================================================================
--- linux-2.6.20.orig/drivers/video/backlight/Makefile	2007-02-04 19:44:54.000000000 +0100
+++ linux-2.6.20/drivers/video/backlight/Makefile	2007-02-05 16:13:13.000000000 +0100
@@ -5,3 +5,4 @@
 obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO)	+= locomolcd.o
+obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o


-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

   Programming consists of 50% planning, 50% coding and 30% mathematics



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-02-06 13:30 [PATCH] backlight control for Frontpath ProGear HX1050+ Marcin Juszkiewicz
@ 2007-02-06 19:26 ` Richard Purdie
  2007-02-07  8:02   ` Marcin Juszkiewicz
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Purdie @ 2007-02-06 19:26 UTC (permalink / raw)
  To: Marcin Juszkiewicz; +Cc: linux-kernel

On Tue, 2007-02-06 at 14:30 +0100, Marcin Juszkiewicz wrote:
> From: Marcin Juszkiewicz <openembedded@hrw.one.pl>
> 
> Add control of LCD backlight for Frontpath ProGear HX1050+.
> Patch is based on http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz
> driver by M Schacht.
> 
> Signed-Off-By: Marcin Juszkiewicz <openembedded@hrw.one.pl>

This is very similar to corgi_bl which I have some changes I was
considering to make it a bit more efficient/clean. The same changes
could apply to this driver:

> +static int progearbl_intensity;
> +static struct backlight_properties progearbl_data;

Not sure you need the above line?

> +static struct backlight_device *progear_backlight_device;

You shouldn't need this structure pointer (see below)

> +static int progearbl_get_intensity(struct backlight_device *bd)
> +{
> +       return progearbl_intensity;
> +}

Can you read PMU_LPCR and return it (minus HW_LEVEL_MIN) here? corgi_bl
only stores this as it can't read back from the hardware. Either
approach is probably ok (although if the register can be updated by
other means, it should be read).

> +static int progearbl_set_intensity(struct backlight_device *bd)
> +{
> +       progearbl_send_intensity(progear_backlight_device);
> +       return 0;
> +}

You can use progearbl_send_intensity(bd); here or maybe lose the
function all together?

> +static struct backlight_properties progearbl_data = {
> +       .owner = THIS_MODULE,
> +       .get_brightness = progearbl_get_intensity,
> +       .update_status = progearbl_set_intensity,

progearbl_send_intensity?

> +       pci_read_config_byte(sb_dev, SB_MPS1, &temp);
> +       pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
> +
> +       progear_backlight_device = backlight_device_register("progear-bl",
> +			   &pdev->dev, NULL, &progearbl_data);
> +       if (IS_ERR(progear_backlight_device))
> +               return PTR_ERR(progear_backlight_device);

platform_set_drvdata(pdev, progear_backlight_device);

> +       progearbl_data.power = FB_BLANK_UNBLANK;
> +       progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
> +       progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
> +       progearbl_send_intensity(progear_backlight_device);
> +
> +       return 0;
> +}
> +
> +static int progearbl_remove(struct platform_device *dev)
> +{
> +       backlight_device_unregister(progear_backlight_device);

struct backlight_device *bd = platform_get_drvdata(pdev);
backlight_device_unregister(bd);

> +       return 0;
> +}

All pretty minor though and if you change the above, it can have an

Acked-by: Richard Purdie <rpurdie@rpsys.net>

-- 
Richard



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-02-06 19:26 ` Richard Purdie
@ 2007-02-07  8:02   ` Marcin Juszkiewicz
  0 siblings, 0 replies; 9+ messages in thread
From: Marcin Juszkiewicz @ 2007-02-07  8:02 UTC (permalink / raw)
  To: Richard Purdie; +Cc: linux-kernel

Dnia wtorek, 6 lutego 2007 20:26, Richard Purdie napisał:
> On Tue, 2007-02-06 at 14:30 +0100, Marcin Juszkiewicz wrote:

> > Add control of LCD backlight for Frontpath ProGear HX1050+.
> > Patch is based on
> > http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz driver by M
> > Schacht.

> This is very similar to corgi_bl which I have some changes I was
> considering to make it a bit more efficient/clean. The same changes
> could apply to this driver:
> > +static int progearbl_intensity;
> > +static struct backlight_properties progearbl_data;
>
> Not sure you need the above line?

both removed

> > +static struct backlight_device *progear_backlight_device;
>
> You shouldn't need this structure pointer (see below)

removed

> > +static int progearbl_get_intensity(struct backlight_device *bd)
> > +{
> > +       return progearbl_intensity;
> > +}
>
> Can you read PMU_LPCR and return it (minus HW_LEVEL_MIN) here? corgi_bl
> only stores this as it can't read back from the hardware. Either
> approach is probably ok (although if the register can be updated by
> other means, it should be read).

changed to be read from hardware

> > +static int progearbl_set_intensity(struct backlight_device *bd)
> > +{
> > +       progearbl_send_intensity(progear_backlight_device);
> > +       return 0;
> > +}
>
> You can use progearbl_send_intensity(bd); here or maybe lose the
> function all together?

progearbl_set_intensity dropped, progearbl_sent_intensity renamed 
to progearbl_set_intensity

> > +static struct backlight_properties progearbl_data = {
> > +       .owner = THIS_MODULE,
> > +       .get_brightness = progearbl_get_intensity,
> > +       .update_status = progearbl_set_intensity,
>
> progearbl_send_intensity?

done

> > +       pci_read_config_byte(sb_dev, SB_MPS1, &temp);
> > +       pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
> > +
> > +       progear_backlight_device =
> > backlight_device_register("progear-bl", +			   &pdev->dev, NULL,
> > &progearbl_data);
> > +       if (IS_ERR(progear_backlight_device))
> > +               return PTR_ERR(progear_backlight_device);
>
> platform_set_drvdata(pdev, progear_backlight_device);

added

> > +static int progearbl_remove(struct platform_device *dev)
> > +{
> > +       backlight_device_unregister(progear_backlight_device);
>
> struct backlight_device *bd = platform_get_drvdata(pdev);
> backlight_device_unregister(bd);

changed

Updated version below:

From: Marcin Juszkiewicz <openembedded@hrw.one.pl>

Add control of LCD backlight for Frontpath ProGear HX1050+.
Patch is based on http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz
driver by M Schacht.

Signed-Off-By: Marcin Juszkiewicz <openembedded@hrw.one.pl>

---
Patch follow kernel version 2.6.20

 Kconfig      |    8 +++
 Makefile     |    1 
 progear_bl.c |  154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+)

Index: git/drivers/video/backlight/Kconfig
===================================================================
--- git.orig/drivers/video/backlight/Kconfig	2006-12-29 17:31:36.511043439 +0100
+++ git/drivers/video/backlight/Kconfig	2007-02-07 08:57:31.020095845 +0100
@@ -66,3 +66,11 @@
 	  If you have a HP Jornada 680, say y to enable the
 	  backlight driver.
 
+config BACKLIGHT_PROGEAR
+       tristate "Frontpath ProGear Backlight Driver"
+       depends on BACKLIGHT_DEVICE && PCI && X86
+       default y
+       help
+         If you have a Frontpath ProGear say Y to enable the
+         backlight driver.
+
Index: git/drivers/video/backlight/progear_bl.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ git/drivers/video/backlight/progear_bl.c	2007-02-07 08:55:46.813993140 +0100
@@ -0,0 +1,154 @@
+/*
+ *  Backlight Driver for Frontpath ProGear HX1050+
+ *
+ *  Copyright (c) 2006 Marcin Juszkiewicz
+ *
+ *  Based on Progear LCD driver by M Schacht
+ *  <mschacht at alumni dot washington dot edu>
+ *
+ *  Based on Sharp's Corgi Backlight Driver
+ *  Based on Backlight Driver for HP Jornada 680
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/pci.h>
+#include <asm/uaccess.h>
+
+#define PMU_LPCR               0xB0
+#define SB_MPS1                0x61
+#define HW_LEVEL_MAX           0x77
+#define HW_LEVEL_MIN           0x4f
+
+static struct pci_dev *pmu_dev = NULL;
+static struct pci_dev *sb_dev = NULL;
+
+static int progearbl_set_intensity(struct backlight_device *bd)
+{
+	int intensity = bd->props->brightness;
+
+	if (bd->props->power != FB_BLANK_UNBLANK)
+		intensity = 0;
+	if (bd->props->fb_blank != FB_BLANK_UNBLANK)
+		intensity = 0;
+
+	pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN);
+
+	return 0;
+}
+
+static int progearbl_get_intensity(struct backlight_device *bd)
+{
+	u8 intensity;
+	pci_read_config_byte(pmu_dev, PMU_LPCR, &intensity);
+
+	return intensity - HW_LEVEL_MIN;
+}
+
+static struct backlight_properties progearbl_data = {
+	.owner = THIS_MODULE,
+	.get_brightness = progearbl_get_intensity,
+	.update_status = progearbl_set_intensity,
+};
+
+static int progearbl_probe(struct platform_device *pdev)
+{
+	u8 temp;
+	struct backlight_device *progear_backlight_device;
+
+	pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);
+	if (!pmu_dev) {
+		printk("ALI M7101 PMU not found.\n");
+		return -ENODEV;
+	}
+
+	sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0);
+	if (!sb_dev) {
+		printk("ALI 1533 SB not found.\n");
+		pci_dev_put(pmu_dev);
+		return -ENODEV;
+	}
+
+	/*     Set SB_MPS1 to enable brightness control. */
+	pci_read_config_byte(sb_dev, SB_MPS1, &temp);
+	pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
+
+	progear_backlight_device = backlight_device_register("progear-bl",
+							     &pdev->dev, NULL,
+							     &progearbl_data);
+	if (IS_ERR(progear_backlight_device))
+		return PTR_ERR(progear_backlight_device);
+
+	platform_set_drvdata(pdev, progear_backlight_device);
+
+	progearbl_data.power = FB_BLANK_UNBLANK;
+	progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+	progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+	progearbl_set_intensity(progear_backlight_device);
+
+	return 0;
+}
+
+static int progearbl_remove(struct platform_device *pdev)
+{
+	struct backlight_device *bd = platform_get_drvdata(pdev);
+	backlight_device_unregister(bd);
+
+	return 0;
+}
+
+static struct platform_driver progearbl_driver = {
+	.probe = progearbl_probe,
+	.remove = progearbl_remove,
+	.driver = {
+		   .name = "progear-bl",
+		   },
+};
+
+static struct platform_device *progearbl_device;
+
+static int __init progearbl_init(void)
+{
+	int ret = platform_driver_register(&progearbl_driver);
+
+	if (!ret) {
+		progearbl_device = platform_device_alloc("progear-bl", -1);
+		if (!progearbl_device)
+			return -ENOMEM;
+
+		ret = platform_device_add(progearbl_device);
+
+		if (ret) {
+			platform_device_put(progearbl_device);
+			platform_driver_unregister(&progearbl_driver);
+		}
+	}
+
+	return ret;
+}
+
+static void __exit progearbl_exit(void)
+{
+	pci_dev_put(pmu_dev);
+	pci_dev_put(sb_dev);
+
+	platform_device_unregister(progearbl_device);
+	platform_driver_unregister(&progearbl_driver);
+}
+
+module_init(progearbl_init);
+module_exit(progearbl_exit);
+
+MODULE_AUTHOR("Marcin Juszkiewicz <linux@hrw.one.pl>");
+MODULE_DESCRIPTION("ProGear Backlight Driver");
+MODULE_LICENSE("GPL");
Index: git/drivers/video/backlight/Makefile
===================================================================
--- git.orig/drivers/video/backlight/Makefile	2006-12-29 17:31:36.511043439 +0100
+++ git/drivers/video/backlight/Makefile	2007-02-06 21:34:54.503712923 +0100
@@ -5,3 +5,4 @@
 obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO)	+= locomolcd.o
+obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o

-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

 Don't mind me, I'm just checking if you are dense enough to cause a tide



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-01-05 11:15   ` Marcin Juszkiewicz
@ 2007-01-05 14:03     ` Mariusz Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Mariusz Kozlowski @ 2007-01-05 14:03 UTC (permalink / raw)
  To: Marcin Juszkiewicz; +Cc: linux-kernel, Alan, Richard Purdie

Witam Marcin,

Not a big deal.

> +	if (pmu_dev)
> +		pci_dev_put(pmu_dev);
> +
> +	if (sb_dev)
> +		pci_dev_put(sb_dev);

pci_dev_put() can handle NULL argument.

-- 
Pozdrawiam,

	Mariusz Kozlowski

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-01-05  9:39 ` Alan
@ 2007-01-05 11:15   ` Marcin Juszkiewicz
  2007-01-05 14:03     ` Mariusz Kozlowski
  0 siblings, 1 reply; 9+ messages in thread
From: Marcin Juszkiewicz @ 2007-01-05 11:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan, Richard Purdie

Dnia piątek, 5 stycznia 2007 10:39, Alan napisał:
> > +struct pci_dev *pmu_dev = NULL;
> > +struct pci_dev *sb_dev  = NULL;
>
> static ?

static

> > +	pmu_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
> > 0);
>
> pci_find_device is going away, please use pci_get_device and the get/put
> functions to refcount it. This makes the system hotplug safe.

I hope that I got it right. Did not tested it on device yet.



From: Marcin Juszkiewicz <openembedded@hrw.one.pl>

Add control of LCD backlight for Frontpath ProGear HX1050+.
Patch is based on http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz
driver by M Schacht.

Signed-Off-By: Marcin Juszkiewicz <openembedded@hrw.one.pl>

---
Patch follow kernel version 2.6.19-rc6

 Kconfig      |    8 +++
 Makefile     |    1
 progear_bl.c |  155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+)


Index: linux/drivers/video/backlight/Kconfig
===================================================================
--- linux.orig/drivers/video/backlight/Kconfig	2006-08-30 10:55:44.000000000 +0200
+++ linux/drivers/video/backlight/Kconfig	2007-01-05 11:17:16.000000000 +0100
@@ -66,3 +66,11 @@
 	  If you have a HP Jornada 680, say y to enable the
 	  backlight driver.
 
+config BACKLIGHT_PROGEAR
+       tristate "Frontpath ProGear Backlight Driver"
+       depends on BACKLIGHT_DEVICE && PCI
+       default y
+       help
+         If you have a Frontpath ProGear say Y to enable the
+         backlight driver.
+
Index: linux/drivers/video/backlight/Makefile
===================================================================
--- linux.orig/drivers/video/backlight/Makefile	2006-08-30 10:55:44.000000000 +0200
+++ linux/drivers/video/backlight/Makefile	2007-01-05 11:17:56.000000000 +0100
@@ -5,3 +5,4 @@
 obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO)	+= locomolcd.o
+obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
Index: linux/drivers/video/backlight/progear_bl.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux/drivers/video/backlight/progear_bl.c	2007-01-05 12:05:37.000000000 +0100
@@ -0,0 +1,161 @@
+/*
+ *  Backlight Driver for Frontpath ProGear HX1050+
+ *
+ *  Copyright (c) 2006 Marcin Juszkiewicz
+ *
+ *  Based on Progear LCD driver by M Schacht
+ *  <mschacht at alumni dot washington dot edu>
+ *
+ *  Based on Sharp's Corgi Backlight Driver
+ *  Based on Backlight Driver for HP Jornada 680
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/pci.h>
+#include <asm/uaccess.h>
+
+#define PMU_LPCR               0xB0
+#define SB_MPS1                0x61
+#define HW_LEVEL_MAX           0x77
+#define HW_LEVEL_MIN           0x4f
+
+static int progearbl_intensity;
+static struct backlight_properties progearbl_data;
+static struct backlight_device *progear_backlight_device;
+
+static struct pci_dev *pmu_dev = NULL;
+static struct pci_dev *sb_dev = NULL;
+
+static int progearbl_send_intensity(struct backlight_device *bd)
+{
+	int intensity = bd->props->brightness;
+
+	if (bd->props->power != FB_BLANK_UNBLANK)
+		intensity = 0;
+	if (bd->props->fb_blank != FB_BLANK_UNBLANK)
+		intensity = 0;
+
+	pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN);
+
+	progearbl_intensity = intensity;
+
+	return 0;
+}
+
+static int progearbl_get_intensity(struct backlight_device *bd)
+{
+	return progearbl_intensity;
+}
+
+static int progearbl_set_intensity(struct backlight_device *bd)
+{
+	progearbl_send_intensity(progear_backlight_device);
+
+	return 0;
+}
+
+static struct backlight_properties progearbl_data = {
+	.owner = THIS_MODULE,
+	.get_brightness = progearbl_get_intensity,
+	.update_status = progearbl_set_intensity,
+};
+
+static int progearbl_probe(struct platform_device *pdev)
+{
+	u8 temp;
+
+	pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);
+	if (!pmu_dev) {
+		printk("ALI M7101 PMU not found.\n");
+		return -ENODEV;
+	}
+
+	sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0);
+	if (!sb_dev) {
+		printk("ALI 1533 SB not found.\n");
+		pci_dev_put(pmu_dev);
+		return -ENODEV;
+	}
+
+	/*     Set SB_MPS1 to enable brightness control. */
+	pci_read_config_byte(sb_dev, SB_MPS1, &temp);
+	pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
+
+	progear_backlight_device = backlight_device_register("progear-bl",
+							     NULL,
+							     &progearbl_data);
+	if (IS_ERR(progear_backlight_device))
+		return PTR_ERR(progear_backlight_device);
+
+	progearbl_data.power = FB_BLANK_UNBLANK;
+	progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+	progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+	progearbl_send_intensity(progear_backlight_device);
+
+	return 0;
+}
+
+static int progearbl_remove(struct platform_device *dev)
+{
+	backlight_device_unregister(progear_backlight_device);
+
+	return 0;
+}
+
+static struct platform_driver progearbl_driver = {
+	.probe = progearbl_probe,
+	.remove = progearbl_remove,
+	.driver = {
+		   .name = "progear-bl",
+		   },
+};
+
+static struct platform_device *progearbl_device;
+
+static int __init progearbl_init(void)
+{
+	int ret = platform_driver_register(&progearbl_driver);
+	if (!ret) {
+		progearbl_device = platform_device_alloc("progear-bl", -1);
+		if (!progearbl_device)
+			return -ENOMEM;
+
+		ret = platform_device_add(progearbl_device);
+
+		if (ret) {
+			platform_device_put(progearbl_device);
+			platform_driver_unregister(&progearbl_driver);
+		}
+	}
+	return ret;
+}
+
+static void __exit progearbl_exit(void)
+{
+	if (pmu_dev)
+		pci_dev_put(pmu_dev);
+
+	if (sb_dev)
+		pci_dev_put(sb_dev);
+
+	platform_device_unregister(progearbl_device);
+	platform_driver_unregister(&progearbl_driver);
+}
+
+module_init(progearbl_init);
+module_exit(progearbl_exit);
+
+MODULE_AUTHOR("Marcin Juszkiewicz <linux@hrw.one.pl>");
+MODULE_DESCRIPTION("ProGear Backlight Driver");
+MODULE_LICENSE("GPL");

-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

                    Sometimes a cigar is just a cigar.
                    		-- Sigmund Freud



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-01-05  8:23 ` Russell King
@ 2007-01-05  9:55   ` Marcin Juszkiewicz
  0 siblings, 0 replies; 9+ messages in thread
From: Marcin Juszkiewicz @ 2007-01-05  9:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Russell King, Richard Purdie

Dnia piątek, 5 stycznia 2007 09:23, Russell King napisał:
> On Fri, Jan 05, 2007 at 09:03:30AM +0100, Marcin Juszkiewicz wrote:
> > Index: linux-2.6.18/drivers/video/backlight/progear_bl.c
> > +		printk("ALI M7101 PMU not found.\n");
> > +		return(-1);
>
> There are enumerated constants for these return values.  Please use the
> proper and appropriate constants.

Thx. Fixed version below.

From: Marcin Juszkiewicz <openembedded@hrw.one.pl>

Add control of LCD backlight for Frontpath ProGear HX1050+.
Patch is based on http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz
driver by M Schacht.

Signed-Off-By: Marcin Juszkiewicz <openembedded@hrw.one.pl>

---
Patch follow kernel version 2.6.19-rc6

 Kconfig      |    8 +++
 Makefile     |    1
 progear_bl.c |  155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+)


Index: linux-2.6.18/drivers/video/backlight/Kconfig
===================================================================
--- linux-2.6.18.orig/drivers/video/backlight/Kconfig   2007-01-04 22:27:59.000000000 +0100
+++ linux-2.6.18/drivers/video/backlight/Kconfig        2007-01-04 22:29:39.000000000 +0100
@@ -66,3 +66,11 @@
         If you have a HP Jornada 680, say y to enable the
         backlight driver.

+config BACKLIGHT_PROGEAR
+       tristate "Frontpath ProGear Backlight Driver"
+       depends on BACKLIGHT_DEVICE && PCI
+       default y
+       help
+         If you have a Frontpath ProGear say Y to enable the
+         backlight driver.
+
Index: linux-2.6.18/drivers/video/backlight/Makefile
===================================================================
--- linux-2.6.18.orig/drivers/video/backlight/Makefile  2007-01-04 22:27:59.000000000 +0100
+++ linux-2.6.18/drivers/video/backlight/Makefile       2007-01-04 22:28:43.000000000 +0100
@@ -5,3 +5,4 @@
 obj-$(CONFIG_BACKLIGHT_CORGI)  += corgi_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
+obj-$(CONFIG_BACKLIGHT_PROGEAR)        += progear_bl.o
Index: linux-2.6.18/drivers/video/backlight/progear_bl.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18/drivers/video/backlight/progear_bl.c   2007-01-05 08:48:41.000000000 +0100
@@ -0,0 +1,155 @@
+/*
+ *  Backlight Driver for Frontpath ProGear HX1050+
+ *
+ *  Copyright (c) 2006 Marcin Juszkiewicz
+ *
+ *  Based on Progear LCD driver by M Schacht
+ *  <mschacht at alumni dot washington dot edu>
+ *
+ *  Based on Sharp's Corgi Backlight Driver
+ *  Based on Backlight Driver for HP Jornada 680
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <asm/uaccess.h>
+
+#define PMU_LPCR                       0xB0
+#define SB_MPS1                                0x61
+#define HW_LEVEL_MAX           0x77
+#define HW_LEVEL_MIN           0x4f
+
+static int progearbl_intensity;
+static struct backlight_properties progearbl_data;
+static struct backlight_device *progear_backlight_device;
+
+struct pci_dev *pmu_dev = NULL;
+struct pci_dev *sb_dev  = NULL;
+
+static int progearbl_send_intensity(struct backlight_device *bd)
+{
+       int intensity = bd->props->brightness;
+
+       if (bd->props->power != FB_BLANK_UNBLANK)
+               intensity = 0;
+       if (bd->props->fb_blank != FB_BLANK_UNBLANK)
+               intensity = 0;
+
+       pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN);
+
+       progearbl_intensity = intensity;
+
+       return 0;
+}
+
+static int progearbl_get_intensity(struct backlight_device *bd)
+{
+       return progearbl_intensity;
+}
+
+static int progearbl_set_intensity(struct backlight_device *bd)
+{
+       progearbl_send_intensity(progear_backlight_device);
+       return 0;
+}
+
+static struct backlight_properties progearbl_data = {
+       .owner          = THIS_MODULE,
+       .get_brightness = progearbl_get_intensity,
+       .update_status  = progearbl_set_intensity,
+};
+
+static int progearbl_probe(struct platform_device *pdev)
+{
+       u8 temp;
+
+       pmu_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);
+       if(!pmu_dev) {
+               printk("ALI M7101 PMU not found.\n");
+               return -ENODEV;
+       }
+
+       sb_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0);
+       if(!sb_dev) {
+               printk("ALI 1533 SB not found.\n");
+               return -ENODEV;
+       }
+
+/*     Set SB_MPS1 to enable brightness control.*/
+       pci_read_config_byte(sb_dev, SB_MPS1, &temp);
+       pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
+
+       progear_backlight_device = backlight_device_register ("progear-bl",
+               NULL, &progearbl_data);
+       if (IS_ERR (progear_backlight_device))
+               return PTR_ERR (progear_backlight_device);
+
+       progearbl_data.power = FB_BLANK_UNBLANK;
+       progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+       progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+       progearbl_send_intensity(progear_backlight_device);
+
+       printk("ProGear Backlight Driver Initialized.\n");
+       return 0;
+}
+
+static int progearbl_remove(struct platform_device *dev)
+{
+       backlight_device_unregister(progear_backlight_device);
+
+       printk("ProGear Backlight Driver Unloaded\n");
+       return 0;
+}
+
+static struct platform_driver progearbl_driver = {
+       .probe          = progearbl_probe,
+       .remove         = progearbl_remove,
+       .driver         = {
+               .name   = "progear-bl",
+       },
+};
+
+static struct platform_device *progearbl_device;
+
+static int __init progearbl_init(void)
+{
+       int ret = platform_driver_register(&progearbl_driver);
+       if (!ret) {
+               progearbl_device = platform_device_alloc("progear-bl", -1);
+               if (!progearbl_device)
+                       return -ENOMEM;
+
+               ret = platform_device_add(progearbl_device);
+
+               if (ret) {
+                       platform_device_put(progearbl_device);
+                       platform_driver_unregister(&progearbl_driver);
+               }
+       }
+       return ret;
+}
+
+static void __exit progearbl_exit(void)
+{
+       platform_device_unregister(progearbl_device);
+       platform_driver_unregister(&progearbl_driver);
+}
+
+module_init(progearbl_init);
+module_exit(progearbl_exit);
+
+MODULE_AUTHOR("Marcin Juszkiewicz <linux@hrw.one.pl>");
+MODULE_DESCRIPTION("ProGear Backlight Driver");
+MODULE_LICENSE("GPL");

-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

    42? 7 and a half million years and all you can come up with is 42?!



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-01-05  8:03 Marcin Juszkiewicz
  2007-01-05  8:23 ` Russell King
@ 2007-01-05  9:39 ` Alan
  2007-01-05 11:15   ` Marcin Juszkiewicz
  1 sibling, 1 reply; 9+ messages in thread
From: Alan @ 2007-01-05  9:39 UTC (permalink / raw)
  To: Marcin Juszkiewicz; +Cc: linux-kernel, Richard Purdie


> +struct pci_dev *pmu_dev = NULL;
> +struct pci_dev *sb_dev  = NULL;

static ?

> +	pmu_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);

pci_find_device is going away, please use pci_get_device and the get/put
functions to refcount it. This makes the system hotplug safe.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] backlight control for Frontpath ProGear HX1050+
  2007-01-05  8:03 Marcin Juszkiewicz
@ 2007-01-05  8:23 ` Russell King
  2007-01-05  9:55   ` Marcin Juszkiewicz
  2007-01-05  9:39 ` Alan
  1 sibling, 1 reply; 9+ messages in thread
From: Russell King @ 2007-01-05  8:23 UTC (permalink / raw)
  To: Marcin Juszkiewicz; +Cc: linux-kernel, Richard Purdie

On Fri, Jan 05, 2007 at 09:03:30AM +0100, Marcin Juszkiewicz wrote:
> Index: linux-2.6.18/drivers/video/backlight/progear_bl.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6.18/drivers/video/backlight/progear_bl.c	2007-01-05 08:48:41.000000000 +0100
> +static int progearbl_probe(struct platform_device *pdev)
> +{
> +	u8 temp;
> +
> +	pmu_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);
> +	if(!pmu_dev) {
> +		printk("ALI M7101 PMU not found.\n"); 
> +		return(-1);

There are enumerated constants for these return values.  Please use the
proper and appropriate constants.

> +	}
> +	
> +	sb_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0);
> +	if(!sb_dev) {
> +		printk("ALI 1533 SB not found.\n"); 
> +		return(-1);

Ditto.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] backlight control for Frontpath ProGear HX1050+
@ 2007-01-05  8:03 Marcin Juszkiewicz
  2007-01-05  8:23 ` Russell King
  2007-01-05  9:39 ` Alan
  0 siblings, 2 replies; 9+ messages in thread
From: Marcin Juszkiewicz @ 2007-01-05  8:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Richard Purdie

From: Marcin Juszkiewicz <openembedded@hrw.one.pl>

Add control of LCD backlight for Frontpath ProGear HX1050+.
Patch is based on http://downloads.sf.net/progear/progear-lcd-0.2.tar.gz
driver by M Schacht.

Signed-Off-By: Marcin Juszkiewicz <openembedded@hrw.one.pl>

---
Patch follow kernel version 2.6.19-rc6

 Kconfig      |    8 +++
 Makefile     |    1
 progear_bl.c |  155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+)


Index: linux-2.6.18/drivers/video/backlight/Kconfig
===================================================================
--- linux-2.6.18.orig/drivers/video/backlight/Kconfig	2007-01-04 22:27:59.000000000 +0100
+++ linux-2.6.18/drivers/video/backlight/Kconfig	2007-01-04 22:29:39.000000000 +0100
@@ -66,3 +66,11 @@
 	  If you have a HP Jornada 680, say y to enable the
 	  backlight driver.
 
+config BACKLIGHT_PROGEAR
+	tristate "Frontpath ProGear Backlight Driver"
+	depends on BACKLIGHT_DEVICE && PCI
+	default y
+	help
+	  If you have a Frontpath ProGear say Y to enable the
+	  backlight driver.
+
Index: linux-2.6.18/drivers/video/backlight/Makefile
===================================================================
--- linux-2.6.18.orig/drivers/video/backlight/Makefile	2007-01-04 22:27:59.000000000 +0100
+++ linux-2.6.18/drivers/video/backlight/Makefile	2007-01-04 22:28:43.000000000 +0100
@@ -5,3 +5,4 @@
 obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO)	+= locomolcd.o
+obj-$(CONFIG_BACKLIGHT_PROGEAR)	+= progear_bl.o
Index: linux-2.6.18/drivers/video/backlight/progear_bl.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18/drivers/video/backlight/progear_bl.c	2007-01-05 08:48:41.000000000 +0100
@@ -0,0 +1,155 @@
+/*
+ *  Backlight Driver for Frontpath ProGear HX1050+
+ *
+ *  Copyright (c) 2006 Marcin Juszkiewicz
+ *
+ *  Based on Progear LCD driver by M Schacht 
+ *  <mschacht at alumni dot washington dot edu>
+ *
+ *  Based on Sharp's Corgi Backlight Driver
+ *  Based on Backlight Driver for HP Jornada 680
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <asm/uaccess.h>
+
+#define PMU_LPCR			0xB0
+#define SB_MPS1				0x61
+#define HW_LEVEL_MAX		0x77
+#define HW_LEVEL_MIN		0x4f
+
+static int progearbl_intensity;
+static struct backlight_properties progearbl_data;
+static struct backlight_device *progear_backlight_device;
+
+struct pci_dev *pmu_dev = NULL;
+struct pci_dev *sb_dev  = NULL;
+
+static int progearbl_send_intensity(struct backlight_device *bd)
+{
+	int intensity = bd->props->brightness;
+
+	if (bd->props->power != FB_BLANK_UNBLANK)
+		intensity = 0;
+	if (bd->props->fb_blank != FB_BLANK_UNBLANK)
+		intensity = 0;
+
+	pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN);
+
+	progearbl_intensity = intensity;
+
+	return 0;
+}
+
+static int progearbl_get_intensity(struct backlight_device *bd)
+{
+	return progearbl_intensity;
+}
+
+static int progearbl_set_intensity(struct backlight_device *bd)
+{
+	progearbl_send_intensity(progear_backlight_device);
+	return 0;
+}
+
+static struct backlight_properties progearbl_data = {
+	.owner          = THIS_MODULE,
+	.get_brightness = progearbl_get_intensity,
+	.update_status  = progearbl_set_intensity,
+};
+
+static int progearbl_probe(struct platform_device *pdev)
+{
+	u8 temp;
+
+	pmu_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0);
+	if(!pmu_dev) {
+		printk("ALI M7101 PMU not found.\n"); 
+		return(-1);
+	}
+	
+	sb_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0);
+	if(!sb_dev) {
+		printk("ALI 1533 SB not found.\n"); 
+		return(-1);
+	}
+	
+/*	Set SB_MPS1 to enable brightness control.*/
+	pci_read_config_byte(sb_dev, SB_MPS1, &temp);
+	pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
+	
+	progear_backlight_device = backlight_device_register ("progear-bl",
+		NULL, &progearbl_data);
+	if (IS_ERR (progear_backlight_device))
+		return PTR_ERR (progear_backlight_device);
+
+	progearbl_data.power = FB_BLANK_UNBLANK;
+	progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+	progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
+	progearbl_send_intensity(progear_backlight_device);
+
+	printk("ProGear Backlight Driver Initialized.\n");
+	return 0;
+}
+
+static int progearbl_remove(struct platform_device *dev)
+{
+	backlight_device_unregister(progear_backlight_device);
+
+	printk("ProGear Backlight Driver Unloaded\n");
+	return 0;
+}
+
+static struct platform_driver progearbl_driver = {
+	.probe		= progearbl_probe,
+	.remove		= progearbl_remove,
+	.driver		= {
+		.name	= "progear-bl",
+	},
+};
+
+static struct platform_device *progearbl_device;
+
+static int __init progearbl_init(void)
+{
+	int ret = platform_driver_register(&progearbl_driver);
+	if (!ret) {
+		progearbl_device = platform_device_alloc("progear-bl", -1);
+		if (!progearbl_device)
+			return -ENOMEM;
+
+		ret = platform_device_add(progearbl_device);
+
+		if (ret) {
+			platform_device_put(progearbl_device);
+			platform_driver_unregister(&progearbl_driver);
+		}
+	}
+	return ret;
+}
+
+static void __exit progearbl_exit(void)
+{
+	platform_device_unregister(progearbl_device);
+ 	platform_driver_unregister(&progearbl_driver);
+}
+
+module_init(progearbl_init);
+module_exit(progearbl_exit);
+
+MODULE_AUTHOR("Marcin Juszkiewicz <linux@hrw.one.pl>");
+MODULE_DESCRIPTION("ProGear Backlight Driver");
+MODULE_LICENSE("GPL");

-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

                Great response time! Was that 5 baud or 10?



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-02-07  8:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 13:30 [PATCH] backlight control for Frontpath ProGear HX1050+ Marcin Juszkiewicz
2007-02-06 19:26 ` Richard Purdie
2007-02-07  8:02   ` Marcin Juszkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2007-01-05  8:03 Marcin Juszkiewicz
2007-01-05  8:23 ` Russell King
2007-01-05  9:55   ` Marcin Juszkiewicz
2007-01-05  9:39 ` Alan
2007-01-05 11:15   ` Marcin Juszkiewicz
2007-01-05 14:03     ` Mariusz Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).