Skip to contentSkip to conversation

backlight control for Frontpath ProGear HX1050+

PATCH In review Marcin Juszkiewicz 2 participants 3 messages Feb 6, 2007 – Feb 7, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backlight control for Frontpath ProGear HX1050+

From: Marcin Juszkiewicz <[email protected]>

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.

---
Patch follow kernel version 2.6.20

 Kconfig      |    8 +++
 Makefile     |    1
 progear_bl.c |  157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 166 insertions(+)
drivers/video/backlight/Kconfig +8 -0
Index: linux-2.6.20/drivers/video/backlight/Kconfig
===================================================================
@@ -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.
+
drivers/video/backlight/progear_bl.c new file +157 -0

157 lines not on this page · raw message

drivers/video/backlight/Makefile +1 -0
Index: linux-2.6.20/drivers/video/backlight/Makefile
===================================================================
@@ -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
Signature · 4 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

   Programming consists of 50% planning, 50% coding and 30% mathematics
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Marcin Juszkiewicz

From: Marcin Juszkiewicz <[email protected]>

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:

drivers/video/backlight/progear_bl.c line 34

Quoted 2 lines
drivers/video/backlight/progear_bl.c new file +2 -0
+static int progearbl_intensity;
+static struct backlight_properties progearbl_data;

Not sure you need the above line?

Quoted 1 line

+static struct backlight_device *progear_backlight_device;

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

drivers/video/backlight/progear_bl.c line 59

Quoted 4 lines
drivers/video/backlight/progear_bl.c new file +4 -0
+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).

drivers/video/backlight/progear_bl.c line 66

Quoted 5 lines
drivers/video/backlight/progear_bl.c new file +5 -0
+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?

drivers/video/backlight/progear_bl.c line 71

Quoted 4 lines
drivers/video/backlight/progear_bl.c new file +4 -0
+static struct backlight_properties progearbl_data = {
+       .owner = THIS_MODULE,
+       .get_brightness = progearbl_get_intensity,
+       .update_status = progearbl_set_intensity,

progearbl_send_intensity?

drivers/video/backlight/progear_bl.c line 98

Quoted 7 lines
drivers/video/backlight/progear_bl.c new file +7 -0
+       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);

drivers/video/backlight/progear_bl.c line 110

Quoted 11 lines
drivers/video/backlight/progear_bl.c new file +11 -0
+       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);

Review

Quoted 2 lines
(quoted diff) +2 -0
+       return 0;
+}

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

Signature · 1 line
Richard
#2 lore raw
Quoted 7 lines · Richard Purdie
Quoted 4 lines · Marcin Juszkiewicz

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.

Quoted 7 lines

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:

Review

Quoted 2 lines
(quoted diff) +2 -0
+static int progearbl_intensity;
+static struct backlight_properties progearbl_data;

Not sure you need the above line?

both removed

Quoted 3 lines
Quoted 1 line

+static struct backlight_device *progear_backlight_device;

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

removed

Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+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

Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+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

Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+static struct backlight_properties progearbl_data = {
+       .owner = THIS_MODULE,
+       .get_brightness = progearbl_get_intensity,
+       .update_status = progearbl_set_intensity,

progearbl_send_intensity?

done

Quoted 10 lines

Review

Quoted 8 lines
(quoted diff) +4 -0
+       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);

(quoted diff) +2 -0
+       if (IS_ERR(progear_backlight_device))
+               return PTR_ERR(progear_backlight_device);

platform_set_drvdata(pdev, progear_backlight_device);

added

Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +3 -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);

changed

Updated version below:

From: Marcin Juszkiewicz <[email protected]>

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.

---
Patch follow kernel version 2.6.20

 Kconfig      |    8 +++
 Makefile     |    1 
 progear_bl.c |  154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+)
drivers/video/backlight/Kconfig +8 -0
Index: git/drivers/video/backlight/Kconfig
===================================================================
@@ -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.
+
drivers/video/backlight/progear_bl.c new file +154 -0

154 lines not on this page · raw message

drivers/video/backlight/Makefile +1 -0
Index: git/drivers/video/backlight/Makefile
===================================================================
@@ -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
Signature · 4 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

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