aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/88pm860x_bl.c12
-rw-r--r--drivers/video/backlight/Kconfig8
-rw-r--r--drivers/video/backlight/Makefile1
-rw-r--r--drivers/video/backlight/adp5520_bl.c12
-rw-r--r--drivers/video/backlight/adx_bl.c182
-rw-r--r--drivers/video/backlight/backlight.c6
-rw-r--r--drivers/video/backlight/da903x_bl.c12
-rw-r--r--drivers/video/backlight/ep93xx_bl.c13
-rw-r--r--drivers/video/backlight/generic_bl.c13
-rw-r--r--drivers/video/backlight/jornada720_bl.c13
-rw-r--r--drivers/video/backlight/jornada720_lcd.c13
-rw-r--r--drivers/video/backlight/lcd.c26
-rw-r--r--drivers/video/backlight/ld9040.c71
-rw-r--r--drivers/video/backlight/max8925_bl.c12
-rw-r--r--drivers/video/backlight/omap1_bl.c13
-rw-r--r--drivers/video/backlight/pcf50633-backlight.c12
-rw-r--r--drivers/video/backlight/platform_lcd.c22
-rw-r--r--drivers/video/backlight/pwm_bl.c33
-rw-r--r--drivers/video/backlight/wm831x_bl.c12
19 files changed, 100 insertions, 386 deletions
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index 1105fa1ed7f4..a1376dc73d71 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -270,17 +270,7 @@ static struct platform_driver pm860x_backlight_driver = {
270 .remove = pm860x_backlight_remove, 270 .remove = pm860x_backlight_remove,
271}; 271};
272 272
273static int __init pm860x_backlight_init(void) 273module_platform_driver(pm860x_backlight_driver);
274{
275 return platform_driver_register(&pm860x_backlight_driver);
276}
277module_init(pm860x_backlight_init);
278
279static void __exit pm860x_backlight_exit(void)
280{
281 platform_driver_unregister(&pm860x_backlight_driver);
282}
283module_exit(pm860x_backlight_exit);
284 274
285MODULE_DESCRIPTION("Backlight Driver for Marvell Semiconductor 88PM8606"); 275MODULE_DESCRIPTION("Backlight Driver for Marvell Semiconductor 88PM8606");
286MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); 276MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 278aeaa92505..681b36929fe4 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -280,14 +280,6 @@ config BACKLIGHT_WM831X
280 If you have a backlight driven by the ISINK and DCDC of a 280 If you have a backlight driven by the ISINK and DCDC of a
281 WM831x PMIC say y to enable the backlight driver for it. 281 WM831x PMIC say y to enable the backlight driver for it.
282 282
283config BACKLIGHT_ADX
284 tristate "Avionic Design Xanthos Backlight Driver"
285 depends on ARCH_PXA_ADX
286 default y
287 help
288 Say Y to enable the backlight driver on Avionic Design Xanthos-based
289 boards.
290
291config BACKLIGHT_ADP5520 283config BACKLIGHT_ADP5520
292 tristate "Backlight Driver for ADP5520/ADP5501 using WLED" 284 tristate "Backlight Driver for ADP5520/ADP5501 using WLED"
293 depends on PMIC_ADP5520 285 depends on PMIC_ADP5520
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fdd1fc4b2770..af5cf654ec7c 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o
32obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o 32obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
33obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o 33obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
34obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o 34obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
35obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o
36obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o 35obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o
37obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o 36obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o
38obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o 37obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index dfb763e9147f..2e630bf1164c 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -384,17 +384,7 @@ static struct platform_driver adp5520_bl_driver = {
384 .resume = adp5520_bl_resume, 384 .resume = adp5520_bl_resume,
385}; 385};
386 386
387static int __init adp5520_bl_init(void) 387module_platform_driver(adp5520_bl_driver);
388{
389 return platform_driver_register(&adp5520_bl_driver);
390}
391module_init(adp5520_bl_init);
392
393static void __exit adp5520_bl_exit(void)
394{
395 platform_driver_unregister(&adp5520_bl_driver);
396}
397module_exit(adp5520_bl_exit);
398 388
399MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 389MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
400MODULE_DESCRIPTION("ADP5520(01) Backlight Driver"); 390MODULE_DESCRIPTION("ADP5520(01) Backlight Driver");
diff --git a/drivers/video/backlight/adx_bl.c b/drivers/video/backlight/adx_bl.c
deleted file mode 100644
index c861c41af442..000000000000
--- a/drivers/video/backlight/adx_bl.c
+++ /dev/null
@@ -1,182 +0,0 @@
1/*
2 * linux/drivers/video/backlight/adx.c
3 *
4 * Copyright (C) 2009 Avionic Design GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Written by Thierry Reding <thierry.reding@avionic-design.de>
11 */
12
13#include <linux/backlight.h>
14#include <linux/fb.h>
15#include <linux/gfp.h>
16#include <linux/io.h>
17#include <linux/module.h>
18#include <linux/platform_device.h>
19
20/* register definitions */
21#define ADX_BACKLIGHT_CONTROL 0x00
22#define ADX_BACKLIGHT_CONTROL_ENABLE (1 << 0)
23#define ADX_BACKLIGHT_BRIGHTNESS 0x08
24#define ADX_BACKLIGHT_STATUS 0x10
25#define ADX_BACKLIGHT_ERROR 0x18
26
27struct adxbl {
28 void __iomem *base;
29};
30
31static int adx_backlight_update_status(struct backlight_device *bldev)
32{
33 struct adxbl *bl = bl_get_data(bldev);
34 u32 value;
35
36 value = bldev->props.brightness;
37 writel(value, bl->base + ADX_BACKLIGHT_BRIGHTNESS);
38
39 value = readl(bl->base + ADX_BACKLIGHT_CONTROL);
40
41 if (bldev->props.state & BL_CORE_FBBLANK)
42 value &= ~ADX_BACKLIGHT_CONTROL_ENABLE;
43 else
44 value |= ADX_BACKLIGHT_CONTROL_ENABLE;
45
46 writel(value, bl->base + ADX_BACKLIGHT_CONTROL);
47
48 return 0;
49}
50
51static int adx_backlight_get_brightness(struct backlight_device *bldev)
52{
53 struct adxbl *bl = bl_get_data(bldev);
54 u32 brightness;
55
56 brightness = readl(bl->base + ADX_BACKLIGHT_BRIGHTNESS);
57 return brightness & 0xff;
58}
59
60static int adx_backlight_check_fb(struct backlight_device *bldev, struct fb_info *fb)
61{
62 return 1;
63}
64
65static const struct backlight_ops adx_backlight_ops = {
66 .options = 0,
67 .update_status = adx_backlight_update_status,
68 .get_brightness = adx_backlight_get_brightness,
69 .check_fb = adx_backlight_check_fb,
70};
71
72static int __devinit adx_backlight_probe(struct platform_device *pdev)
73{
74 struct backlight_properties props;
75 struct backlight_device *bldev;
76 struct resource *res;
77 struct adxbl *bl;
78 int ret = 0;
79
80 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
81 if (!res) {
82 ret = -ENXIO;
83 goto out;
84 }
85
86 res = devm_request_mem_region(&pdev->dev, res->start,
87 resource_size(res), res->name);
88 if (!res) {
89 ret = -ENXIO;
90 goto out;
91 }
92
93 bl = devm_kzalloc(&pdev->dev, sizeof(*bl), GFP_KERNEL);
94 if (!bl) {
95 ret = -ENOMEM;
96 goto out;
97 }
98
99 bl->base = devm_ioremap_nocache(&pdev->dev, res->start,
100 resource_size(res));
101 if (!bl->base) {
102 ret = -ENXIO;
103 goto out;
104 }
105
106 memset(&props, 0, sizeof(struct backlight_properties));
107 props.type = BACKLIGHT_RAW;
108 props.max_brightness = 0xff;
109 bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev,
110 bl, &adx_backlight_ops, &props);
111 if (IS_ERR(bldev)) {
112 ret = PTR_ERR(bldev);
113 goto out;
114 }
115
116 bldev->props.brightness = 0xff;
117 bldev->props.power = FB_BLANK_UNBLANK;
118
119 platform_set_drvdata(pdev, bldev);
120
121out:
122 return ret;
123}
124
125static int __devexit adx_backlight_remove(struct platform_device *pdev)
126{
127 struct backlight_device *bldev;
128 int ret = 0;
129
130 bldev = platform_get_drvdata(pdev);
131 bldev->props.power = FB_BLANK_UNBLANK;
132 bldev->props.brightness = 0xff;
133 backlight_update_status(bldev);
134 backlight_device_unregister(bldev);
135 platform_set_drvdata(pdev, NULL);
136
137 return ret;
138}
139
140#ifdef CONFIG_PM
141static int adx_backlight_suspend(struct platform_device *pdev,
142 pm_message_t state)
143{
144 return 0;
145}
146
147static int adx_backlight_resume(struct platform_device *pdev)
148{
149 return 0;
150}
151#else
152#define adx_backlight_suspend NULL
153#define adx_backlight_resume NULL
154#endif
155
156static struct platform_driver adx_backlight_driver = {
157 .probe = adx_backlight_probe,
158 .remove = __devexit_p(adx_backlight_remove),
159 .suspend = adx_backlight_suspend,
160 .resume = adx_backlight_resume,
161 .driver = {
162 .name = "adx-backlight",
163 .owner = THIS_MODULE,
164 },
165};
166
167static int __init adx_backlight_init(void)
168{
169 return platform_driver_register(&adx_backlight_driver);
170}
171
172static void __exit adx_backlight_exit(void)
173{
174 platform_driver_unregister(&adx_backlight_driver);
175}
176
177module_init(adx_backlight_init);
178module_exit(adx_backlight_exit);
179
180MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>");
181MODULE_DESCRIPTION("Avionic Design Xanthos Backlight Driver");
182MODULE_LICENSE("GPL v2");
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 7363c1b169e8..bf5b1ece7160 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -102,7 +102,7 @@ static void backlight_generate_event(struct backlight_device *bd,
102} 102}
103 103
104static ssize_t backlight_show_power(struct device *dev, 104static ssize_t backlight_show_power(struct device *dev,
105 struct device_attribute *attr,char *buf) 105 struct device_attribute *attr, char *buf)
106{ 106{
107 struct backlight_device *bd = to_backlight_device(dev); 107 struct backlight_device *bd = to_backlight_device(dev);
108 108
@@ -116,7 +116,7 @@ static ssize_t backlight_store_power(struct device *dev,
116 struct backlight_device *bd = to_backlight_device(dev); 116 struct backlight_device *bd = to_backlight_device(dev);
117 unsigned long power; 117 unsigned long power;
118 118
119 rc = strict_strtoul(buf, 0, &power); 119 rc = kstrtoul(buf, 0, &power);
120 if (rc) 120 if (rc)
121 return rc; 121 return rc;
122 122
@@ -150,7 +150,7 @@ static ssize_t backlight_store_brightness(struct device *dev,
150 struct backlight_device *bd = to_backlight_device(dev); 150 struct backlight_device *bd = to_backlight_device(dev);
151 unsigned long brightness; 151 unsigned long brightness;
152 152
153 rc = strict_strtoul(buf, 0, &brightness); 153 rc = kstrtoul(buf, 0, &brightness);
154 if (rc) 154 if (rc)
155 return rc; 155 return rc;
156 156
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c
index d68f14bbb687..abb4a06268f1 100644
--- a/drivers/video/backlight/da903x_bl.c
+++ b/drivers/video/backlight/da903x_bl.c
@@ -199,17 +199,7 @@ static struct platform_driver da903x_backlight_driver = {
199 .remove = da903x_backlight_remove, 199 .remove = da903x_backlight_remove,
200}; 200};
201 201
202static int __init da903x_backlight_init(void) 202module_platform_driver(da903x_backlight_driver);
203{
204 return platform_driver_register(&da903x_backlight_driver);
205}
206module_init(da903x_backlight_init);
207
208static void __exit da903x_backlight_exit(void)
209{
210 platform_driver_unregister(&da903x_backlight_driver);
211}
212module_exit(da903x_backlight_exit);
213 203
214MODULE_DESCRIPTION("Backlight Driver for Dialog Semiconductor DA9030/DA9034"); 204MODULE_DESCRIPTION("Backlight Driver for Dialog Semiconductor DA9030/DA9034");
215MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>" 205MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>"
diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c
index c74a6f4baa12..b62b8b9063b5 100644
--- a/drivers/video/backlight/ep93xx_bl.c
+++ b/drivers/video/backlight/ep93xx_bl.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/module.h>
17#include <linux/io.h> 16#include <linux/io.h>
18#include <linux/fb.h> 17#include <linux/fb.h>
19#include <linux/backlight.h> 18#include <linux/backlight.h>
@@ -144,17 +143,7 @@ static struct platform_driver ep93xxbl_driver = {
144 .resume = ep93xxbl_resume, 143 .resume = ep93xxbl_resume,
145}; 144};
146 145
147static int __init ep93xxbl_init(void) 146module_platform_driver(ep93xxbl_driver);
148{
149 return platform_driver_register(&ep93xxbl_driver);
150}
151module_init(ep93xxbl_init);
152
153static void __exit ep93xxbl_exit(void)
154{
155 platform_driver_unregister(&ep93xxbl_driver);
156}
157module_exit(ep93xxbl_exit);
158 147
159MODULE_DESCRIPTION("EP93xx Backlight Driver"); 148MODULE_DESCRIPTION("EP93xx Backlight Driver");
160MODULE_AUTHOR("H Hartley Sweeten <hsweeten@visionengravers.com>"); 149MODULE_AUTHOR("H Hartley Sweeten <hsweeten@visionengravers.com>");
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c
index adb191466d64..9ce6170c1860 100644
--- a/drivers/video/backlight/generic_bl.c
+++ b/drivers/video/backlight/generic_bl.c
@@ -132,18 +132,7 @@ static struct platform_driver genericbl_driver = {
132 }, 132 },
133}; 133};
134 134
135static int __init genericbl_init(void) 135module_platform_driver(genericbl_driver);
136{
137 return platform_driver_register(&genericbl_driver);
138}
139
140static void __exit genericbl_exit(void)
141{
142 platform_driver_unregister(&genericbl_driver);
143}
144
145module_init(genericbl_init);
146module_exit(genericbl_exit);
147 136
148MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 137MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
149MODULE_DESCRIPTION("Generic Backlight Driver"); 138MODULE_DESCRIPTION("Generic Backlight Driver");
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c
index de65d80159be..2f8af5d786ab 100644
--- a/drivers/video/backlight/jornada720_bl.c
+++ b/drivers/video/backlight/jornada720_bl.c
@@ -147,19 +147,8 @@ static struct platform_driver jornada_bl_driver = {
147 }, 147 },
148}; 148};
149 149
150static int __init jornada_bl_init(void) 150module_platform_driver(jornada_bl_driver);
151{
152 return platform_driver_register(&jornada_bl_driver);
153}
154
155static void __exit jornada_bl_exit(void)
156{
157 platform_driver_unregister(&jornada_bl_driver);
158}
159 151
160MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson>"); 152MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson>");
161MODULE_DESCRIPTION("HP Jornada 710/720/728 Backlight driver"); 153MODULE_DESCRIPTION("HP Jornada 710/720/728 Backlight driver");
162MODULE_LICENSE("GPL"); 154MODULE_LICENSE("GPL");
163
164module_init(jornada_bl_init);
165module_exit(jornada_bl_exit);
diff --git a/drivers/video/backlight/jornada720_lcd.c b/drivers/video/backlight/jornada720_lcd.c
index d2ff658b4144..22d231a17e3c 100644
--- a/drivers/video/backlight/jornada720_lcd.c
+++ b/drivers/video/backlight/jornada720_lcd.c
@@ -135,19 +135,8 @@ static struct platform_driver jornada_lcd_driver = {
135 }, 135 },
136}; 136};
137 137
138static int __init jornada_lcd_init(void) 138module_platform_driver(jornada_lcd_driver);
139{
140 return platform_driver_register(&jornada_lcd_driver);
141}
142
143static void __exit jornada_lcd_exit(void)
144{
145 platform_driver_unregister(&jornada_lcd_driver);
146}
147 139
148MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); 140MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
149MODULE_DESCRIPTION("HP Jornada 710/720/728 LCD driver"); 141MODULE_DESCRIPTION("HP Jornada 710/720/728 LCD driver");
150MODULE_LICENSE("GPL"); 142MODULE_LICENSE("GPL");
151
152module_init(jornada_lcd_init);
153module_exit(jornada_lcd_exit);
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 71a11cadffc4..79c1b0d609a8 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -97,19 +97,16 @@ static ssize_t lcd_store_power(struct device *dev,
97 struct device_attribute *attr, const char *buf, size_t count) 97 struct device_attribute *attr, const char *buf, size_t count)
98{ 98{
99 int rc = -ENXIO; 99 int rc = -ENXIO;
100 char *endp;
101 struct lcd_device *ld = to_lcd_device(dev); 100 struct lcd_device *ld = to_lcd_device(dev);
102 int power = simple_strtoul(buf, &endp, 0); 101 unsigned long power;
103 size_t size = endp - buf;
104 102
105 if (isspace(*endp)) 103 rc = kstrtoul(buf, 0, &power);
106 size++; 104 if (rc)
107 if (size != count) 105 return rc;
108 return -EINVAL;
109 106
110 mutex_lock(&ld->ops_lock); 107 mutex_lock(&ld->ops_lock);
111 if (ld->ops && ld->ops->set_power) { 108 if (ld->ops && ld->ops->set_power) {
112 pr_debug("lcd: set power to %d\n", power); 109 pr_debug("lcd: set power to %lu\n", power);
113 ld->ops->set_power(ld, power); 110 ld->ops->set_power(ld, power);
114 rc = count; 111 rc = count;
115 } 112 }
@@ -136,19 +133,16 @@ static ssize_t lcd_store_contrast(struct device *dev,
136 struct device_attribute *attr, const char *buf, size_t count) 133 struct device_attribute *attr, const char *buf, size_t count)
137{ 134{
138 int rc = -ENXIO; 135 int rc = -ENXIO;
139 char *endp;
140 struct lcd_device *ld = to_lcd_device(dev); 136 struct lcd_device *ld = to_lcd_device(dev);
141 int contrast = simple_strtoul(buf, &endp, 0); 137 unsigned long contrast;
142 size_t size = endp - buf;
143 138
144 if (isspace(*endp)) 139 rc = kstrtoul(buf, 0, &contrast);
145 size++; 140 if (rc)
146 if (size != count) 141 return rc;
147 return -EINVAL;
148 142
149 mutex_lock(&ld->ops_lock); 143 mutex_lock(&ld->ops_lock);
150 if (ld->ops && ld->ops->set_contrast) { 144 if (ld->ops && ld->ops->set_contrast) {
151 pr_debug("lcd: set contrast to %d\n", contrast); 145 pr_debug("lcd: set contrast to %lu\n", contrast);
152 ld->ops->set_contrast(ld, contrast); 146 ld->ops->set_contrast(ld, contrast);
153 rc = count; 147 rc = count;
154 } 148 }
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
index da9a5ce0ccb8..78dafc0c8fc5 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -31,6 +31,7 @@
31#include <linux/lcd.h> 31#include <linux/lcd.h>
32#include <linux/backlight.h> 32#include <linux/backlight.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/regulator/consumer.h>
34 35
35#include "ld9040_gamma.h" 36#include "ld9040_gamma.h"
36 37
@@ -53,8 +54,51 @@ struct ld9040 {
53 struct lcd_device *ld; 54 struct lcd_device *ld;
54 struct backlight_device *bd; 55 struct backlight_device *bd;
55 struct lcd_platform_data *lcd_pd; 56 struct lcd_platform_data *lcd_pd;
57
58 struct mutex lock;
59 bool enabled;
60};
61
62static struct regulator_bulk_data supplies[] = {
63 { .supply = "vdd3", },
64 { .supply = "vci", },
56}; 65};
57 66
67static void ld9040_regulator_enable(struct ld9040 *lcd)
68{
69 int ret = 0;
70 struct lcd_platform_data *pd = NULL;
71
72 pd = lcd->lcd_pd;
73 mutex_lock(&lcd->lock);
74 if (!lcd->enabled) {
75 ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies);
76 if (ret)
77 goto out;
78
79 lcd->enabled = true;
80 }
81 mdelay(pd->power_on_delay);
82out:
83 mutex_unlock(&lcd->lock);
84}
85
86static void ld9040_regulator_disable(struct ld9040 *lcd)
87{
88 int ret = 0;
89
90 mutex_lock(&lcd->lock);
91 if (lcd->enabled) {
92 ret = regulator_bulk_disable(ARRAY_SIZE(supplies), supplies);
93 if (ret)
94 goto out;
95
96 lcd->enabled = false;
97 }
98out:
99 mutex_unlock(&lcd->lock);
100}
101
58static const unsigned short seq_swreset[] = { 102static const unsigned short seq_swreset[] = {
59 0x01, COMMAND_ONLY, 103 0x01, COMMAND_ONLY,
60 ENDDEF, 0x00 104 ENDDEF, 0x00
@@ -532,13 +576,8 @@ static int ld9040_power_on(struct ld9040 *lcd)
532 return -EFAULT; 576 return -EFAULT;
533 } 577 }
534 578
535 if (!pd->power_on) { 579 /* lcd power on */
536 dev_err(lcd->dev, "power_on is NULL.\n"); 580 ld9040_regulator_enable(lcd);
537 return -EFAULT;
538 } else {
539 pd->power_on(lcd->ld, 1);
540 mdelay(pd->power_on_delay);
541 }
542 581
543 if (!pd->reset) { 582 if (!pd->reset) {
544 dev_err(lcd->dev, "reset is NULL.\n"); 583 dev_err(lcd->dev, "reset is NULL.\n");
@@ -582,11 +621,8 @@ static int ld9040_power_off(struct ld9040 *lcd)
582 621
583 mdelay(pd->power_off_delay); 622 mdelay(pd->power_off_delay);
584 623
585 if (!pd->power_on) { 624 /* lcd power off */
586 dev_err(lcd->dev, "power_on is NULL.\n"); 625 ld9040_regulator_disable(lcd);
587 return -EFAULT;
588 } else
589 pd->power_on(lcd->ld, 0);
590 626
591 return 0; 627 return 0;
592} 628}
@@ -693,6 +729,14 @@ static int ld9040_probe(struct spi_device *spi)
693 goto out_free_lcd; 729 goto out_free_lcd;
694 } 730 }
695 731
732 mutex_init(&lcd->lock);
733
734 ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
735 if (ret) {
736 dev_err(lcd->dev, "Failed to get regulators: %d\n", ret);
737 goto out_free_lcd;
738 }
739
696 ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops); 740 ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops);
697 if (IS_ERR(ld)) { 741 if (IS_ERR(ld)) {
698 ret = PTR_ERR(ld); 742 ret = PTR_ERR(ld);
@@ -739,6 +783,8 @@ static int ld9040_probe(struct spi_device *spi)
739out_unregister_lcd: 783out_unregister_lcd:
740 lcd_device_unregister(lcd->ld); 784 lcd_device_unregister(lcd->ld);
741out_free_lcd: 785out_free_lcd:
786 regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
787
742 kfree(lcd); 788 kfree(lcd);
743 return ret; 789 return ret;
744} 790}
@@ -750,6 +796,7 @@ static int __devexit ld9040_remove(struct spi_device *spi)
750 ld9040_power(lcd, FB_BLANK_POWERDOWN); 796 ld9040_power(lcd, FB_BLANK_POWERDOWN);
751 backlight_device_unregister(lcd->bd); 797 backlight_device_unregister(lcd->bd);
752 lcd_device_unregister(lcd->ld); 798 lcd_device_unregister(lcd->ld);
799 regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
753 kfree(lcd); 800 kfree(lcd);
754 801
755 return 0; 802 return 0;
diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c
index 7bbc802560ea..c915e3b53886 100644
--- a/drivers/video/backlight/max8925_bl.c
+++ b/drivers/video/backlight/max8925_bl.c
@@ -188,17 +188,7 @@ static struct platform_driver max8925_backlight_driver = {
188 .remove = __devexit_p(max8925_backlight_remove), 188 .remove = __devexit_p(max8925_backlight_remove),
189}; 189};
190 190
191static int __init max8925_backlight_init(void) 191module_platform_driver(max8925_backlight_driver);
192{
193 return platform_driver_register(&max8925_backlight_driver);
194}
195module_init(max8925_backlight_init);
196
197static void __exit max8925_backlight_exit(void)
198{
199 platform_driver_unregister(&max8925_backlight_driver);
200};
201module_exit(max8925_backlight_exit);
202 192
203MODULE_DESCRIPTION("Backlight Driver for Maxim MAX8925"); 193MODULE_DESCRIPTION("Backlight Driver for Maxim MAX8925");
204MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); 194MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c
index 08d26a72394c..d8cde277ec83 100644
--- a/drivers/video/backlight/omap1_bl.c
+++ b/drivers/video/backlight/omap1_bl.c
@@ -195,18 +195,7 @@ static struct platform_driver omapbl_driver = {
195 }, 195 },
196}; 196};
197 197
198static int __init omapbl_init(void) 198module_platform_driver(omapbl_driver);
199{
200 return platform_driver_register(&omapbl_driver);
201}
202
203static void __exit omapbl_exit(void)
204{
205 platform_driver_unregister(&omapbl_driver);
206}
207
208module_init(omapbl_init);
209module_exit(omapbl_exit);
210 199
211MODULE_AUTHOR("Andrzej Zaborowski <balrog@zabor.org>"); 200MODULE_AUTHOR("Andrzej Zaborowski <balrog@zabor.org>");
212MODULE_DESCRIPTION("OMAP LCD Backlight driver"); 201MODULE_DESCRIPTION("OMAP LCD Backlight driver");
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c
index ef5628d60563..13e88b71daec 100644
--- a/drivers/video/backlight/pcf50633-backlight.c
+++ b/drivers/video/backlight/pcf50633-backlight.c
@@ -173,17 +173,7 @@ static struct platform_driver pcf50633_bl_driver = {
173 }, 173 },
174}; 174};
175 175
176static int __init pcf50633_bl_init(void) 176module_platform_driver(pcf50633_bl_driver);
177{
178 return platform_driver_register(&pcf50633_bl_driver);
179}
180module_init(pcf50633_bl_init);
181
182static void __exit pcf50633_bl_exit(void)
183{
184 platform_driver_unregister(&pcf50633_bl_driver);
185}
186module_exit(pcf50633_bl_exit);
187 177
188MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 178MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
189MODULE_DESCRIPTION("PCF50633 backlight driver"); 179MODULE_DESCRIPTION("PCF50633 backlight driver");
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index 302330acf628..f0bf491ed087 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -85,7 +85,8 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
85 return -EINVAL; 85 return -EINVAL;
86 } 86 }
87 87
88 plcd = kzalloc(sizeof(struct platform_lcd), GFP_KERNEL); 88 plcd = devm_kzalloc(&pdev->dev, sizeof(struct platform_lcd),
89 GFP_KERNEL);
89 if (!plcd) { 90 if (!plcd) {
90 dev_err(dev, "no memory for state\n"); 91 dev_err(dev, "no memory for state\n");
91 return -ENOMEM; 92 return -ENOMEM;
@@ -98,7 +99,7 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
98 if (IS_ERR(plcd->lcd)) { 99 if (IS_ERR(plcd->lcd)) {
99 dev_err(dev, "cannot register lcd device\n"); 100 dev_err(dev, "cannot register lcd device\n");
100 err = PTR_ERR(plcd->lcd); 101 err = PTR_ERR(plcd->lcd);
101 goto err_mem; 102 goto err;
102 } 103 }
103 104
104 platform_set_drvdata(pdev, plcd); 105 platform_set_drvdata(pdev, plcd);
@@ -106,8 +107,7 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
106 107
107 return 0; 108 return 0;
108 109
109 err_mem: 110 err:
110 kfree(plcd);
111 return err; 111 return err;
112} 112}
113 113
@@ -116,7 +116,6 @@ static int __devexit platform_lcd_remove(struct platform_device *pdev)
116 struct platform_lcd *plcd = platform_get_drvdata(pdev); 116 struct platform_lcd *plcd = platform_get_drvdata(pdev);
117 117
118 lcd_device_unregister(plcd->lcd); 118 lcd_device_unregister(plcd->lcd);
119 kfree(plcd);
120 119
121 return 0; 120 return 0;
122} 121}
@@ -157,18 +156,7 @@ static struct platform_driver platform_lcd_driver = {
157 .resume = platform_lcd_resume, 156 .resume = platform_lcd_resume,
158}; 157};
159 158
160static int __init platform_lcd_init(void) 159module_platform_driver(platform_lcd_driver);
161{
162 return platform_driver_register(&platform_lcd_driver);
163}
164
165static void __exit platform_lcd_cleanup(void)
166{
167 platform_driver_unregister(&platform_lcd_driver);
168}
169
170module_init(platform_lcd_init);
171module_exit(platform_lcd_cleanup);
172 160
173MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>"); 161MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
174MODULE_LICENSE("GPL v2"); 162MODULE_LICENSE("GPL v2");
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 8b5b2a4124c7..7496d04e1d3c 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -169,10 +169,9 @@ static int pwm_backlight_remove(struct platform_device *pdev)
169} 169}
170 170
171#ifdef CONFIG_PM 171#ifdef CONFIG_PM
172static int pwm_backlight_suspend(struct platform_device *pdev, 172static int pwm_backlight_suspend(struct device *dev)
173 pm_message_t state)
174{ 173{
175 struct backlight_device *bl = platform_get_drvdata(pdev); 174 struct backlight_device *bl = dev_get_drvdata(dev);
176 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); 175 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
177 176
178 if (pb->notify) 177 if (pb->notify)
@@ -184,40 +183,32 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
184 return 0; 183 return 0;
185} 184}
186 185
187static int pwm_backlight_resume(struct platform_device *pdev) 186static int pwm_backlight_resume(struct device *dev)
188{ 187{
189 struct backlight_device *bl = platform_get_drvdata(pdev); 188 struct backlight_device *bl = dev_get_drvdata(dev);
190 189
191 backlight_update_status(bl); 190 backlight_update_status(bl);
192 return 0; 191 return 0;
193} 192}
194#else 193
195#define pwm_backlight_suspend NULL 194static SIMPLE_DEV_PM_OPS(pwm_backlight_pm_ops, pwm_backlight_suspend,
196#define pwm_backlight_resume NULL 195 pwm_backlight_resume);
196
197#endif 197#endif
198 198
199static struct platform_driver pwm_backlight_driver = { 199static struct platform_driver pwm_backlight_driver = {
200 .driver = { 200 .driver = {
201 .name = "pwm-backlight", 201 .name = "pwm-backlight",
202 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
203#ifdef CONFIG_PM
204 .pm = &pwm_backlight_pm_ops,
205#endif
203 }, 206 },
204 .probe = pwm_backlight_probe, 207 .probe = pwm_backlight_probe,
205 .remove = pwm_backlight_remove, 208 .remove = pwm_backlight_remove,
206 .suspend = pwm_backlight_suspend,
207 .resume = pwm_backlight_resume,
208}; 209};
209 210
210static int __init pwm_backlight_init(void) 211module_platform_driver(pwm_backlight_driver);
211{
212 return platform_driver_register(&pwm_backlight_driver);
213}
214module_init(pwm_backlight_init);
215
216static void __exit pwm_backlight_exit(void)
217{
218 platform_driver_unregister(&pwm_backlight_driver);
219}
220module_exit(pwm_backlight_exit);
221 212
222MODULE_DESCRIPTION("PWM based Backlight Driver"); 213MODULE_DESCRIPTION("PWM based Backlight Driver");
223MODULE_LICENSE("GPL"); 214MODULE_LICENSE("GPL");
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c
index fbe9e9316f3b..4e915f5eca99 100644
--- a/drivers/video/backlight/wm831x_bl.c
+++ b/drivers/video/backlight/wm831x_bl.c
@@ -236,17 +236,7 @@ static struct platform_driver wm831x_backlight_driver = {
236 .remove = wm831x_backlight_remove, 236 .remove = wm831x_backlight_remove,
237}; 237};
238 238
239static int __init wm831x_backlight_init(void) 239module_platform_driver(wm831x_backlight_driver);
240{
241 return platform_driver_register(&wm831x_backlight_driver);
242}
243module_init(wm831x_backlight_init);
244
245static void __exit wm831x_backlight_exit(void)
246{
247 platform_driver_unregister(&wm831x_backlight_driver);
248}
249module_exit(wm831x_backlight_exit);
250 240
251MODULE_DESCRIPTION("Backlight Driver for WM831x PMICs"); 241MODULE_DESCRIPTION("Backlight Driver for WM831x PMICs");
252MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com"); 242MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com");