backlight: da903x_bl: control WLED output current in da9034
authorHaojian Zhuang <haojian.zhuang@marvell.com>
Thu, 5 Nov 2009 15:27:13 +0000 (10:27 -0500)
committerEric Miao <eric.y.miao@gmail.com>
Tue, 1 Dec 2009 01:02:34 +0000 (09:02 +0800)
Update WLED output current source before changing brightness.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
drivers/video/backlight/da903x_bl.c
include/linux/mfd/da903x.h

index 701a1081e199b9269006e65970700cdaf6677a00..7fcb0eb54c6061d1214348c4b45f2730ec1c50b3 100644 (file)
@@ -25,6 +25,7 @@
 
 #define DA9034_WLED_CONTROL1   0x3C
 #define DA9034_WLED_CONTROL2   0x3D
+#define DA9034_WLED_ISET(x)    ((x) & 0x1f)
 
 #define DA9034_WLED_BOOST_EN   (1 << 5)
 
@@ -101,6 +102,7 @@ static struct backlight_ops da903x_backlight_ops = {
 
 static int da903x_backlight_probe(struct platform_device *pdev)
 {
+       struct da9034_backlight_pdata *pdata = pdev->dev.platform_data;
        struct da903x_backlight_data *data;
        struct backlight_device *bl;
        int max_brightness;
@@ -127,6 +129,11 @@ static int da903x_backlight_probe(struct platform_device *pdev)
        data->da903x_dev = pdev->dev.parent;
        data->current_brightness = 0;
 
+       /* adjust the WLED output current */
+       if (pdata)
+               da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2,
+                               DA9034_WLED_ISET(pdata->output_current));
+
        bl = backlight_device_register(pdev->name, data->da903x_dev,
                        data, &da903x_backlight_ops);
        if (IS_ERR(bl)) {
index c63b65c9442969504e2953ca5c54af81f4ef4557..0aa3a1a49ee32761ae5d15ff4942a90c18d475b0 100644 (file)
@@ -96,6 +96,10 @@ struct da9034_touch_pdata {
        int     y_inverted;
 };
 
+struct da9034_backlight_pdata {
+       int     output_current; /* output current of WLED, from 0-31 (in mA) */
+};
+
 /* DA9030 battery charger data */
 struct power_supply_info;