Skip to contentSkip to conversation

Adding LED1 & LED2 control for DA9034 backlight driver

PATCH In review [email protected] 3 participants 5 messages Sep 17, 2009 – Sep 22, 2009 2 messages not in the archive

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

PATCH 1/1 Adding LED1 & LED2 control for DA9034 backlight driver

From: Arun KS <[email protected]>

---
 drivers/video/backlight/Kconfig     |    2 +-
 drivers/video/backlight/da903x_bl.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
drivers/video/backlight/Kconfig +1 -1
index 90861cd..1607bc9 100644
@@ -203,7 +203,7 @@ config BACKLIGHT_DA903X
 	depends on BACKLIGHT_CLASS_DEVICE && PMIC_DA903X
 	help
 	  If you have a LCD backlight connected to the WLED output of DA9030
-	  or DA9034 WLED output, say Y here to enable this driver.
+	  or DA9034 WLED, LED1, LED2 outputs, say Y here to enable this driver.
 
 config BACKLIGHT_MBP_NVIDIA
        tristate "MacBook Pro Nvidia Backlight Driver"
drivers/video/backlight/da903x_bl.c +12 -0
index 93bb434..c6ceb76 100644
@@ -23,6 +23,8 @@
 #define DA9030_WLED_CP_EN	(1 << 6)
 #define DA9030_WLED_TRIM(x)	((x) & 0x7)
 
+#define DA9034_LED1_CONTROL	0x35
+#define DA9034_LED2_CONTROL	0x36
 #define DA9034_WLED_CONTROL1	0x3C
 #define DA9034_WLED_CONTROL2	0x3D
 
@@ -66,6 +68,14 @@ static int da903x_backlight_set(struct backlight_device *bl, int brightness)
 		val |= brightness ? DA9030_WLED_CP_EN : 0;
 		ret = da903x_write(dev, DA9030_WLED_CONTROL, val);
 		break;
+	case DA9034_ID_LED_1:
+		ret = da903x_update(dev, DA9034_LED1_CONTROL,
+				brightness, 0x7f);
+		break;
+	case DA9034_ID_LED_2:
+		ret = da903x_update(dev, DA9034_LED2_CONTROL,
+				brightness, 0x7f);
+		break;
 	}
 
 	if (ret)
@@ -114,6 +124,8 @@ static int da903x_backlight_probe(struct platform_device *pdev)
 		max_brightness = DA9030_MAX_BRIGHTNESS;
 		break;
 	case DA9034_ID_WLED:
+	case DA9034_ID_LED_1:
+	case DA9034_ID_LED_2:
 		max_brightness = DA9034_MAX_BRIGHTNESS;
 		break;
 	default:
Signature · 1 line
1.5.4.3
#1 lore raw

Haojian,

Could you please help check if the patch below applies for micco?

Thanks
- eric

Quoted 62 lines · On Fri, Sep 18, 2009 at 3:27 AM, <[email protected]> wrote:

From: Arun KS <[email protected]>

---
 drivers/video/backlight/Kconfig     |    2 +- drivers/video/backlight/da903x_bl.c |   12 ++++++++++++

 2 files changed, 13 insertions(+), 1 deletions(-)
drivers/video/backlight/Kconfig +0 -0
index 90861cd..1607bc9 100644
@@ -203,7 +203,7 @@ config BACKLIGHT_DA903X

       depends on BACKLIGHT_CLASS_DEVICE && PMIC_DA903X
       help
         If you have a LCD backlight connected to the WLED output of DA9030
-         or DA9034 WLED output, say Y here to enable this driver.
+         or DA9034 WLED, LED1, LED2 outputs, say Y here to enable this driver.

 config BACKLIGHT_MBP_NVIDIA
       tristate "MacBook Pro Nvidia Backlight Driver"

drivers/video/backlight/da903x_bl.c +10 -0
index 93bb434..c6ceb76 100644
@@ -23,6 +23,8 @@
  #define DA9030_WLED_CP_EN      (1 << 6)
  #define DA9030_WLED_TRIM(x)    ((x) & 0x7)
 
+#define DA9034_LED1_CONTROL    0x35
+#define DA9034_LED2_CONTROL    0x36
  #define DA9034_WLED_CONTROL1   0x3C
  #define DA9034_WLED_CONTROL2   0x3D
 
@@ -66,6 +68,14 @@ static int da903x_backlight_set(struct backlight_device *bl, int brightness)
                val |= brightness ? DA9030_WLED_CP_EN : 0;
                ret = da903x_write(dev, DA9030_WLED_CONTROL, val);
                break;
+       case DA9034_ID_LED_1:
+               ret = da903x_update(dev, DA9034_LED1_CONTROL,
+                               brightness, 0x7f);
+               break;
+       case DA9034_ID_LED_2:
+               ret = da903x_update(dev, DA9034_LED2_CONTROL,
+                               brightness, 0x7f);
+               break;
        }
 
        if (ret)
@@ -114,6 +124,8 @@ static int da903x_backlight_probe(struct platform_device *pdev)
                max_brightness = DA9030_MAX_BRIGHTNESS;
                break;

       case DA9034_ID_WLED:
+       case DA9034_ID_LED_1:
+       case DA9034_ID_LED_2:
               max_brightness = DA9034_MAX_BRIGHTNESS; break;
       default:
--
1.5.4.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 4 lines

Apparently there is a bug in the hardware design on my custom board. We are using LED1 for backlight control.
Thanks Haojian for clarification.

Now you know that :-)

Either let your hardware engineer change the design, or there are still workarounds, you can control the LED1/2 through the sysfs entries.

- eric

author
#5 lore raw
Quoted 10 lines · Eric Miao
Quoted 5 lines

Apparently there is a bug in the hardware design on my custom board. We are using LED1 for backlight control.
Thanks Haojian for clarification.

Now you know that :-)

Either let your hardware engineer change the design, or there are still workarounds, you can control the LED1/2 through the sysfs entries.

If I apply the patch which I send, backlight driver is working well through the da093x_bl.c driver.
Because LED1 driver is same as the WLED driver apart from current level it can provide. WLED can provide max of 32mA but LED can only provide current <500uA.

Thanks for your concern.

Arun

Quoted 2 lines

- eric

#6 lore raw
In reply to Eric Miao
Quoted 1 line · Eric Miao

Could you please help check if the patch below applies for micco?

Eric/Haojian: Please let me know if you want me to take this patch or not...

Cheers,

Richard

Quoted 23 lines · On Fri, Sep 18, 2009 at 3:27 AM, <[email protected]> wrote:
Quoted 21 lines

From: Arun KS <[email protected]>

---
 drivers/video/backlight/Kconfig     |    2 +-
 drivers/video/backlight/da903x_bl.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
drivers/video/backlight/Kconfig +1 -1
index 90861cd..1607bc9 100644
@@ -203,7 +203,7 @@ config BACKLIGHT_DA903X
       depends on BACKLIGHT_CLASS_DEVICE && PMIC_DA903X
       help
         If you have a LCD backlight connected to the WLED output of DA9030
-         or DA9034 WLED output, say Y here to enable this driver.
+         or DA9034 WLED, LED1, LED2 outputs, say Y here to enable this driver.
 
 config BACKLIGHT_MBP_NVIDIA
       tristate "MacBook Pro Nvidia Backlight Driver"