diff options
Diffstat (limited to 'drivers/video/backlight')
30 files changed, 447 insertions, 60 deletions
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index b8f705cca438..68d2518fadaa 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/backlight.h> | 17 | #include <linux/backlight.h> |
18 | #include <linux/mfd/88pm860x.h> | 18 | #include <linux/mfd/88pm860x.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #define MAX_BRIGHTNESS (0xFF) | 21 | #define MAX_BRIGHTNESS (0xFF) |
21 | #define MIN_BRIGHTNESS (0) | 22 | #define MIN_BRIGHTNESS (0) |
@@ -187,6 +188,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
187 | struct pm860x_backlight_data *data; | 188 | struct pm860x_backlight_data *data; |
188 | struct backlight_device *bl; | 189 | struct backlight_device *bl; |
189 | struct resource *res; | 190 | struct resource *res; |
191 | struct backlight_properties props; | ||
190 | unsigned char value; | 192 | unsigned char value; |
191 | char name[MFD_NAME_SIZE]; | 193 | char name[MFD_NAME_SIZE]; |
192 | int ret; | 194 | int ret; |
@@ -223,14 +225,15 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
223 | return -EINVAL; | 225 | return -EINVAL; |
224 | } | 226 | } |
225 | 227 | ||
228 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
229 | props.max_brightness = MAX_BRIGHTNESS; | ||
226 | bl = backlight_device_register(name, &pdev->dev, data, | 230 | bl = backlight_device_register(name, &pdev->dev, data, |
227 | &pm860x_backlight_ops); | 231 | &pm860x_backlight_ops, &props); |
228 | if (IS_ERR(bl)) { | 232 | if (IS_ERR(bl)) { |
229 | dev_err(&pdev->dev, "failed to register backlight\n"); | 233 | dev_err(&pdev->dev, "failed to register backlight\n"); |
230 | kfree(data); | 234 | kfree(data); |
231 | return PTR_ERR(bl); | 235 | return PTR_ERR(bl); |
232 | } | 236 | } |
233 | bl->props.max_brightness = MAX_BRIGHTNESS; | ||
234 | bl->props.brightness = MAX_BRIGHTNESS; | 237 | bl->props.brightness = MAX_BRIGHTNESS; |
235 | 238 | ||
236 | platform_set_drvdata(pdev, bl); | 239 | platform_set_drvdata(pdev, bl); |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 0c77fc610212..c025c84601b0 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -31,6 +31,13 @@ config LCD_CORGI | |||
31 | Say y here to support the LCD panels usually found on SHARP | 31 | Say y here to support the LCD panels usually found on SHARP |
32 | corgi (C7x0) and spitz (Cxx00) models. | 32 | corgi (C7x0) and spitz (Cxx00) models. |
33 | 33 | ||
34 | config LCD_L4F00242T03 | ||
35 | tristate "Epson L4F00242T03 LCD" | ||
36 | depends on LCD_CLASS_DEVICE && SPI_MASTER && GENERIC_GPIO | ||
37 | help | ||
38 | SPI driver for Epson L4F00242T03. This provides basic support | ||
39 | for init and powering the LCD up/down through a sysfs interface. | ||
40 | |||
34 | config LCD_LMS283GF05 | 41 | config LCD_LMS283GF05 |
35 | tristate "Samsung LMS283GF05 LCD" | 42 | tristate "Samsung LMS283GF05 LCD" |
36 | depends on LCD_CLASS_DEVICE && SPI_MASTER && GENERIC_GPIO | 43 | depends on LCD_CLASS_DEVICE && SPI_MASTER && GENERIC_GPIO |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 6c704d41462d..09d1f14d6257 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o | 3 | obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o |
4 | obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o | 4 | obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o |
5 | obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o | 5 | obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o |
6 | obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o | ||
6 | obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o | 7 | obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o |
7 | obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o | 8 | obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o |
8 | obj-$(CONFIG_LCD_ILI9320) += ili9320.o | 9 | obj-$(CONFIG_LCD_ILI9320) += ili9320.o |
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 86d95c228adb..9f436e014f85 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/fb.h> | 12 | #include <linux/fb.h> |
13 | #include <linux/backlight.h> | 13 | #include <linux/backlight.h> |
14 | #include <linux/mfd/adp5520.h> | 14 | #include <linux/mfd/adp5520.h> |
15 | #include <linux/slab.h> | ||
15 | 16 | ||
16 | struct adp5520_bl { | 17 | struct adp5520_bl { |
17 | struct device *master; | 18 | struct device *master; |
@@ -278,6 +279,7 @@ static const struct attribute_group adp5520_bl_attr_group = { | |||
278 | 279 | ||
279 | static int __devinit adp5520_bl_probe(struct platform_device *pdev) | 280 | static int __devinit adp5520_bl_probe(struct platform_device *pdev) |
280 | { | 281 | { |
282 | struct backlight_properties props; | ||
281 | struct backlight_device *bl; | 283 | struct backlight_device *bl; |
282 | struct adp5520_bl *data; | 284 | struct adp5520_bl *data; |
283 | int ret = 0; | 285 | int ret = 0; |
@@ -300,17 +302,17 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
300 | 302 | ||
301 | mutex_init(&data->lock); | 303 | mutex_init(&data->lock); |
302 | 304 | ||
303 | bl = backlight_device_register(pdev->name, data->master, | 305 | memset(&props, 0, sizeof(struct backlight_properties)); |
304 | data, &adp5520_bl_ops); | 306 | props.max_brightness = ADP5020_MAX_BRIGHTNESS; |
307 | bl = backlight_device_register(pdev->name, data->master, data, | ||
308 | &adp5520_bl_ops, &props); | ||
305 | if (IS_ERR(bl)) { | 309 | if (IS_ERR(bl)) { |
306 | dev_err(&pdev->dev, "failed to register backlight\n"); | 310 | dev_err(&pdev->dev, "failed to register backlight\n"); |
307 | kfree(data); | 311 | kfree(data); |
308 | return PTR_ERR(bl); | 312 | return PTR_ERR(bl); |
309 | } | 313 | } |
310 | 314 | ||
311 | bl->props.max_brightness = | 315 | bl->props.brightness = ADP5020_MAX_BRIGHTNESS; |
312 | bl->props.brightness = ADP5020_MAX_BRIGHTNESS; | ||
313 | |||
314 | if (data->pdata->en_ambl_sens) | 316 | if (data->pdata->en_ambl_sens) |
315 | ret = sysfs_create_group(&bl->dev.kobj, | 317 | ret = sysfs_create_group(&bl->dev.kobj, |
316 | &adp5520_bl_attr_group); | 318 | &adp5520_bl_attr_group); |
diff --git a/drivers/video/backlight/adx_bl.c b/drivers/video/backlight/adx_bl.c index d769b0bab21a..7f4a7c30a98b 100644 --- a/drivers/video/backlight/adx_bl.c +++ b/drivers/video/backlight/adx_bl.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/backlight.h> | 13 | #include <linux/backlight.h> |
14 | #include <linux/fb.h> | 14 | #include <linux/fb.h> |
15 | #include <linux/gfp.h> | ||
15 | #include <linux/io.h> | 16 | #include <linux/io.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
@@ -56,7 +57,7 @@ static int adx_backlight_get_brightness(struct backlight_device *bldev) | |||
56 | return brightness & 0xff; | 57 | return brightness & 0xff; |
57 | } | 58 | } |
58 | 59 | ||
59 | static int adx_backlight_check_fb(struct fb_info *fb) | 60 | static int adx_backlight_check_fb(struct backlight_device *bldev, struct fb_info *fb) |
60 | { | 61 | { |
61 | return 1; | 62 | return 1; |
62 | } | 63 | } |
@@ -70,6 +71,7 @@ static const struct backlight_ops adx_backlight_ops = { | |||
70 | 71 | ||
71 | static int __devinit adx_backlight_probe(struct platform_device *pdev) | 72 | static int __devinit adx_backlight_probe(struct platform_device *pdev) |
72 | { | 73 | { |
74 | struct backlight_properties props; | ||
73 | struct backlight_device *bldev; | 75 | struct backlight_device *bldev; |
74 | struct resource *res; | 76 | struct resource *res; |
75 | struct adxbl *bl; | 77 | struct adxbl *bl; |
@@ -101,14 +103,15 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev) | |||
101 | goto out; | 103 | goto out; |
102 | } | 104 | } |
103 | 105 | ||
104 | bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, bl, | 106 | memset(&props, 0, sizeof(struct backlight_properties)); |
105 | &adx_backlight_ops); | 107 | props.max_brightness = 0xff; |
108 | bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, | ||
109 | bl, &adx_backlight_ops, &props); | ||
106 | if (!bldev) { | 110 | if (!bldev) { |
107 | ret = -ENOMEM; | 111 | ret = -ENOMEM; |
108 | goto out; | 112 | goto out; |
109 | } | 113 | } |
110 | 114 | ||
111 | bldev->props.max_brightness = 0xff; | ||
112 | bldev->props.brightness = 0xff; | 115 | bldev->props.brightness = 0xff; |
113 | bldev->props.power = FB_BLANK_UNBLANK; | 116 | bldev->props.power = FB_BLANK_UNBLANK; |
114 | 117 | ||
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index f625ffc69ad3..e6a66dab088c 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/backlight.h> | 17 | #include <linux/backlight.h> |
18 | #include <linux/atmel_pwm.h> | 18 | #include <linux/atmel_pwm.h> |
19 | #include <linux/atmel-pwm-bl.h> | 19 | #include <linux/atmel-pwm-bl.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | struct atmel_pwm_bl { | 22 | struct atmel_pwm_bl { |
22 | const struct atmel_pwm_bl_platform_data *pdata; | 23 | const struct atmel_pwm_bl_platform_data *pdata; |
@@ -120,6 +121,7 @@ static const struct backlight_ops atmel_pwm_bl_ops = { | |||
120 | 121 | ||
121 | static int atmel_pwm_bl_probe(struct platform_device *pdev) | 122 | static int atmel_pwm_bl_probe(struct platform_device *pdev) |
122 | { | 123 | { |
124 | struct backlight_properties props; | ||
123 | const struct atmel_pwm_bl_platform_data *pdata; | 125 | const struct atmel_pwm_bl_platform_data *pdata; |
124 | struct backlight_device *bldev; | 126 | struct backlight_device *bldev; |
125 | struct atmel_pwm_bl *pwmbl; | 127 | struct atmel_pwm_bl *pwmbl; |
@@ -165,8 +167,10 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
165 | goto err_free_gpio; | 167 | goto err_free_gpio; |
166 | } | 168 | } |
167 | 169 | ||
168 | bldev = backlight_device_register("atmel-pwm-bl", | 170 | memset(&props, 0, sizeof(struct backlight_properties)); |
169 | &pdev->dev, pwmbl, &atmel_pwm_bl_ops); | 171 | props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; |
172 | bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl, | ||
173 | &atmel_pwm_bl_ops, &props); | ||
170 | if (IS_ERR(bldev)) { | 174 | if (IS_ERR(bldev)) { |
171 | retval = PTR_ERR(bldev); | 175 | retval = PTR_ERR(bldev); |
172 | goto err_free_gpio; | 176 | goto err_free_gpio; |
@@ -178,7 +182,6 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
178 | 182 | ||
179 | /* Power up the backlight by default at middle intesity. */ | 183 | /* Power up the backlight by default at middle intesity. */ |
180 | bldev->props.power = FB_BLANK_UNBLANK; | 184 | bldev->props.power = FB_BLANK_UNBLANK; |
181 | bldev->props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; | ||
182 | bldev->props.brightness = bldev->props.max_brightness / 2; | 185 | bldev->props.brightness = bldev->props.max_brightness / 2; |
183 | 186 | ||
184 | retval = atmel_pwm_bl_init_pwm(pwmbl); | 187 | retval = atmel_pwm_bl_init_pwm(pwmbl); |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 18829cf68b1b..e207810bba3c 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/ctype.h> | 13 | #include <linux/ctype.h> |
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
16 | #include <linux/slab.h> | ||
16 | 17 | ||
17 | #ifdef CONFIG_PMAC_BACKLIGHT | 18 | #ifdef CONFIG_PMAC_BACKLIGHT |
18 | #include <asm/backlight.h> | 19 | #include <asm/backlight.h> |
@@ -38,7 +39,7 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
38 | mutex_lock(&bd->ops_lock); | 39 | mutex_lock(&bd->ops_lock); |
39 | if (bd->ops) | 40 | if (bd->ops) |
40 | if (!bd->ops->check_fb || | 41 | if (!bd->ops->check_fb || |
41 | bd->ops->check_fb(evdata->info)) { | 42 | bd->ops->check_fb(bd, evdata->info)) { |
42 | bd->props.fb_blank = *(int *)evdata->data; | 43 | bd->props.fb_blank = *(int *)evdata->data; |
43 | if (bd->props.fb_blank == FB_BLANK_UNBLANK) | 44 | if (bd->props.fb_blank == FB_BLANK_UNBLANK) |
44 | bd->props.state &= ~BL_CORE_FBBLANK; | 45 | bd->props.state &= ~BL_CORE_FBBLANK; |
@@ -269,7 +270,8 @@ EXPORT_SYMBOL(backlight_force_update); | |||
269 | * ERR_PTR() or a pointer to the newly allocated device. | 270 | * ERR_PTR() or a pointer to the newly allocated device. |
270 | */ | 271 | */ |
271 | struct backlight_device *backlight_device_register(const char *name, | 272 | struct backlight_device *backlight_device_register(const char *name, |
272 | struct device *parent, void *devdata, const struct backlight_ops *ops) | 273 | struct device *parent, void *devdata, const struct backlight_ops *ops, |
274 | const struct backlight_properties *props) | ||
273 | { | 275 | { |
274 | struct backlight_device *new_bd; | 276 | struct backlight_device *new_bd; |
275 | int rc; | 277 | int rc; |
@@ -289,6 +291,11 @@ struct backlight_device *backlight_device_register(const char *name, | |||
289 | dev_set_name(&new_bd->dev, name); | 291 | dev_set_name(&new_bd->dev, name); |
290 | dev_set_drvdata(&new_bd->dev, devdata); | 292 | dev_set_drvdata(&new_bd->dev, devdata); |
291 | 293 | ||
294 | /* Set default properties */ | ||
295 | if (props) | ||
296 | memcpy(&new_bd->props, props, | ||
297 | sizeof(struct backlight_properties)); | ||
298 | |||
292 | rc = device_register(&new_bd->dev); | 299 | rc = device_register(&new_bd->dev); |
293 | if (rc) { | 300 | if (rc) { |
294 | kfree(new_bd); | 301 | kfree(new_bd); |
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index b4bcf8043797..1e71c35083bb 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/lcd.h> | 24 | #include <linux/lcd.h> |
25 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
26 | #include <linux/spi/corgi_lcd.h> | 26 | #include <linux/spi/corgi_lcd.h> |
27 | #include <linux/slab.h> | ||
27 | #include <asm/mach/sharpsl_param.h> | 28 | #include <asm/mach/sharpsl_param.h> |
28 | 29 | ||
29 | #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) | 30 | #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) |
@@ -533,6 +534,7 @@ err_free_backlight_on: | |||
533 | 534 | ||
534 | static int __devinit corgi_lcd_probe(struct spi_device *spi) | 535 | static int __devinit corgi_lcd_probe(struct spi_device *spi) |
535 | { | 536 | { |
537 | struct backlight_properties props; | ||
536 | struct corgi_lcd_platform_data *pdata = spi->dev.platform_data; | 538 | struct corgi_lcd_platform_data *pdata = spi->dev.platform_data; |
537 | struct corgi_lcd *lcd; | 539 | struct corgi_lcd *lcd; |
538 | int ret = 0; | 540 | int ret = 0; |
@@ -559,13 +561,14 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi) | |||
559 | lcd->power = FB_BLANK_POWERDOWN; | 561 | lcd->power = FB_BLANK_POWERDOWN; |
560 | lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; | 562 | lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; |
561 | 563 | ||
562 | lcd->bl_dev = backlight_device_register("corgi_bl", &spi->dev, | 564 | memset(&props, 0, sizeof(struct backlight_properties)); |
563 | lcd, &corgi_bl_ops); | 565 | props.max_brightness = pdata->max_intensity; |
566 | lcd->bl_dev = backlight_device_register("corgi_bl", &spi->dev, lcd, | ||
567 | &corgi_bl_ops, &props); | ||
564 | if (IS_ERR(lcd->bl_dev)) { | 568 | if (IS_ERR(lcd->bl_dev)) { |
565 | ret = PTR_ERR(lcd->bl_dev); | 569 | ret = PTR_ERR(lcd->bl_dev); |
566 | goto err_unregister_lcd; | 570 | goto err_unregister_lcd; |
567 | } | 571 | } |
568 | lcd->bl_dev->props.max_brightness = pdata->max_intensity; | ||
569 | lcd->bl_dev->props.brightness = pdata->default_intensity; | 572 | lcd->bl_dev->props.brightness = pdata->default_intensity; |
570 | lcd->bl_dev->props.power = FB_BLANK_UNBLANK; | 573 | lcd->bl_dev->props.power = FB_BLANK_UNBLANK; |
571 | 574 | ||
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index da86db4374a0..a4f4546f0be0 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/backlight.h> | 36 | #include <linux/backlight.h> |
37 | #include <linux/lcd.h> | 37 | #include <linux/lcd.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/slab.h> | ||
39 | 40 | ||
40 | /* The LVDS- and panel power controls sits on the | 41 | /* The LVDS- and panel power controls sits on the |
41 | * GPIO port of the ISA bridge. | 42 | * GPIO port of the ISA bridge. |
@@ -170,6 +171,7 @@ static struct lcd_ops cr_lcd_ops = { | |||
170 | 171 | ||
171 | static int cr_backlight_probe(struct platform_device *pdev) | 172 | static int cr_backlight_probe(struct platform_device *pdev) |
172 | { | 173 | { |
174 | struct backlight_properties props; | ||
173 | struct backlight_device *bdp; | 175 | struct backlight_device *bdp; |
174 | struct lcd_device *ldp; | 176 | struct lcd_device *ldp; |
175 | struct cr_panel *crp; | 177 | struct cr_panel *crp; |
@@ -190,8 +192,9 @@ static int cr_backlight_probe(struct platform_device *pdev) | |||
190 | return -ENODEV; | 192 | return -ENODEV; |
191 | } | 193 | } |
192 | 194 | ||
193 | bdp = backlight_device_register("cr-backlight", | 195 | memset(&props, 0, sizeof(struct backlight_properties)); |
194 | &pdev->dev, NULL, &cr_backlight_ops); | 196 | bdp = backlight_device_register("cr-backlight", &pdev->dev, NULL, |
197 | &cr_backlight_ops, &props); | ||
195 | if (IS_ERR(bdp)) { | 198 | if (IS_ERR(bdp)) { |
196 | pci_dev_put(lpc_dev); | 199 | pci_dev_put(lpc_dev); |
197 | return PTR_ERR(bdp); | 200 | return PTR_ERR(bdp); |
@@ -220,9 +223,7 @@ static int cr_backlight_probe(struct platform_device *pdev) | |||
220 | crp->cr_lcd_device = ldp; | 223 | crp->cr_lcd_device = ldp; |
221 | crp->cr_backlight_device->props.power = FB_BLANK_UNBLANK; | 224 | crp->cr_backlight_device->props.power = FB_BLANK_UNBLANK; |
222 | crp->cr_backlight_device->props.brightness = 0; | 225 | crp->cr_backlight_device->props.brightness = 0; |
223 | crp->cr_backlight_device->props.max_brightness = 0; | ||
224 | cr_backlight_set_intensity(crp->cr_backlight_device); | 226 | cr_backlight_set_intensity(crp->cr_backlight_device); |
225 | |||
226 | cr_lcd_set_power(crp->cr_lcd_device, FB_BLANK_UNBLANK); | 227 | cr_lcd_set_power(crp->cr_lcd_device, FB_BLANK_UNBLANK); |
227 | 228 | ||
228 | platform_set_drvdata(pdev, crp); | 229 | platform_set_drvdata(pdev, crp); |
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 74cdc640173d..87659ed79bd7 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/fb.h> | 18 | #include <linux/fb.h> |
19 | #include <linux/backlight.h> | 19 | #include <linux/backlight.h> |
20 | #include <linux/mfd/da903x.h> | 20 | #include <linux/mfd/da903x.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #define DA9030_WLED_CONTROL 0x25 | 23 | #define DA9030_WLED_CONTROL 0x25 |
23 | #define DA9030_WLED_CP_EN (1 << 6) | 24 | #define DA9030_WLED_CP_EN (1 << 6) |
@@ -105,6 +106,7 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
105 | struct da9034_backlight_pdata *pdata = pdev->dev.platform_data; | 106 | struct da9034_backlight_pdata *pdata = pdev->dev.platform_data; |
106 | struct da903x_backlight_data *data; | 107 | struct da903x_backlight_data *data; |
107 | struct backlight_device *bl; | 108 | struct backlight_device *bl; |
109 | struct backlight_properties props; | ||
108 | int max_brightness; | 110 | int max_brightness; |
109 | 111 | ||
110 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 112 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -134,15 +136,15 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
134 | da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2, | 136 | da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2, |
135 | DA9034_WLED_ISET(pdata->output_current)); | 137 | DA9034_WLED_ISET(pdata->output_current)); |
136 | 138 | ||
137 | bl = backlight_device_register(pdev->name, data->da903x_dev, | 139 | props.max_brightness = max_brightness; |
138 | data, &da903x_backlight_ops); | 140 | bl = backlight_device_register(pdev->name, data->da903x_dev, data, |
141 | &da903x_backlight_ops, &props); | ||
139 | if (IS_ERR(bl)) { | 142 | if (IS_ERR(bl)) { |
140 | dev_err(&pdev->dev, "failed to register backlight\n"); | 143 | dev_err(&pdev->dev, "failed to register backlight\n"); |
141 | kfree(data); | 144 | kfree(data); |
142 | return PTR_ERR(bl); | 145 | return PTR_ERR(bl); |
143 | } | 146 | } |
144 | 147 | ||
145 | bl->props.max_brightness = max_brightness; | ||
146 | bl->props.brightness = max_brightness; | 148 | bl->props.brightness = max_brightness; |
147 | 149 | ||
148 | platform_set_drvdata(pdev, bl); | 150 | platform_set_drvdata(pdev, bl); |
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c index e6d348e63596..312ca619735d 100644 --- a/drivers/video/backlight/generic_bl.c +++ b/drivers/video/backlight/generic_bl.c | |||
@@ -78,6 +78,7 @@ static const struct backlight_ops genericbl_ops = { | |||
78 | 78 | ||
79 | static int genericbl_probe(struct platform_device *pdev) | 79 | static int genericbl_probe(struct platform_device *pdev) |
80 | { | 80 | { |
81 | struct backlight_properties props; | ||
81 | struct generic_bl_info *machinfo = pdev->dev.platform_data; | 82 | struct generic_bl_info *machinfo = pdev->dev.platform_data; |
82 | const char *name = "generic-bl"; | 83 | const char *name = "generic-bl"; |
83 | struct backlight_device *bd; | 84 | struct backlight_device *bd; |
@@ -89,14 +90,15 @@ static int genericbl_probe(struct platform_device *pdev) | |||
89 | if (machinfo->name) | 90 | if (machinfo->name) |
90 | name = machinfo->name; | 91 | name = machinfo->name; |
91 | 92 | ||
92 | bd = backlight_device_register (name, | 93 | memset(&props, 0, sizeof(struct backlight_properties)); |
93 | &pdev->dev, NULL, &genericbl_ops); | 94 | props.max_brightness = machinfo->max_intensity; |
95 | bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops, | ||
96 | &props); | ||
94 | if (IS_ERR (bd)) | 97 | if (IS_ERR (bd)) |
95 | return PTR_ERR (bd); | 98 | return PTR_ERR (bd); |
96 | 99 | ||
97 | platform_set_drvdata(pdev, bd); | 100 | platform_set_drvdata(pdev, bd); |
98 | 101 | ||
99 | bd->props.max_brightness = machinfo->max_intensity; | ||
100 | bd->props.power = FB_BLANK_UNBLANK; | 102 | bd->props.power = FB_BLANK_UNBLANK; |
101 | bd->props.brightness = machinfo->default_intensity; | 103 | bd->props.brightness = machinfo->default_intensity; |
102 | backlight_update_status(bd); | 104 | backlight_update_status(bd); |
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index f7cc528d5be7..267d23f8d645 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c | |||
@@ -105,16 +105,18 @@ static const struct backlight_ops hp680bl_ops = { | |||
105 | 105 | ||
106 | static int __devinit hp680bl_probe(struct platform_device *pdev) | 106 | static int __devinit hp680bl_probe(struct platform_device *pdev) |
107 | { | 107 | { |
108 | struct backlight_properties props; | ||
108 | struct backlight_device *bd; | 109 | struct backlight_device *bd; |
109 | 110 | ||
110 | bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL, | 111 | memset(&props, 0, sizeof(struct backlight_properties)); |
111 | &hp680bl_ops); | 112 | props.max_brightness = HP680_MAX_INTENSITY; |
113 | bd = backlight_device_register("hp680-bl", &pdev->dev, NULL, | ||
114 | &hp680bl_ops, &props); | ||
112 | if (IS_ERR(bd)) | 115 | if (IS_ERR(bd)) |
113 | return PTR_ERR(bd); | 116 | return PTR_ERR(bd); |
114 | 117 | ||
115 | platform_set_drvdata(pdev, bd); | 118 | platform_set_drvdata(pdev, bd); |
116 | 119 | ||
117 | bd->props.max_brightness = HP680_MAX_INTENSITY; | ||
118 | bd->props.brightness = HP680_DEFAULT_INTENSITY; | 120 | bd->props.brightness = HP680_DEFAULT_INTENSITY; |
119 | hp680bl_send_intensity(bd); | 121 | hp680bl_send_intensity(bd); |
120 | 122 | ||
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c index ba89b41b639c..5118a9f029ab 100644 --- a/drivers/video/backlight/ili9320.c +++ b/drivers/video/backlight/ili9320.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/lcd.h> | 18 | #include <linux/lcd.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
22 | 23 | ||
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index db9071fc5665..2f177b3a4885 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c | |||
@@ -101,10 +101,14 @@ static const struct backlight_ops jornada_bl_ops = { | |||
101 | 101 | ||
102 | static int jornada_bl_probe(struct platform_device *pdev) | 102 | static int jornada_bl_probe(struct platform_device *pdev) |
103 | { | 103 | { |
104 | struct backlight_properties props; | ||
104 | int ret; | 105 | int ret; |
105 | struct backlight_device *bd; | 106 | struct backlight_device *bd; |
106 | 107 | ||
107 | bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL, &jornada_bl_ops); | 108 | memset(&props, 0, sizeof(struct backlight_properties)); |
109 | props.max_brightness = BL_MAX_BRIGHT; | ||
110 | bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL, | ||
111 | &jornada_bl_ops, &props); | ||
108 | 112 | ||
109 | if (IS_ERR(bd)) { | 113 | if (IS_ERR(bd)) { |
110 | ret = PTR_ERR(bd); | 114 | ret = PTR_ERR(bd); |
@@ -117,7 +121,6 @@ static int jornada_bl_probe(struct platform_device *pdev) | |||
117 | /* note. make sure max brightness is set otherwise | 121 | /* note. make sure max brightness is set otherwise |
118 | you will get seemingly non-related errors when | 122 | you will get seemingly non-related errors when |
119 | trying to change brightness */ | 123 | trying to change brightness */ |
120 | bd->props.max_brightness = BL_MAX_BRIGHT; | ||
121 | jornada_bl_update_status(bd); | 124 | jornada_bl_update_status(bd); |
122 | 125 | ||
123 | platform_set_drvdata(pdev, bd); | 126 | platform_set_drvdata(pdev, bd); |
diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index 939e7b830cf3..f439a8632287 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c | |||
@@ -141,20 +141,24 @@ static const struct backlight_ops kb3886bl_ops = { | |||
141 | 141 | ||
142 | static int kb3886bl_probe(struct platform_device *pdev) | 142 | static int kb3886bl_probe(struct platform_device *pdev) |
143 | { | 143 | { |
144 | struct backlight_properties props; | ||
144 | struct kb3886bl_machinfo *machinfo = pdev->dev.platform_data; | 145 | struct kb3886bl_machinfo *machinfo = pdev->dev.platform_data; |
145 | 146 | ||
146 | bl_machinfo = machinfo; | 147 | bl_machinfo = machinfo; |
147 | if (!machinfo->limit_mask) | 148 | if (!machinfo->limit_mask) |
148 | machinfo->limit_mask = -1; | 149 | machinfo->limit_mask = -1; |
149 | 150 | ||
151 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
152 | props.max_brightness = machinfo->max_intensity; | ||
150 | kb3886_backlight_device = backlight_device_register("kb3886-bl", | 153 | kb3886_backlight_device = backlight_device_register("kb3886-bl", |
151 | &pdev->dev, NULL, &kb3886bl_ops); | 154 | &pdev->dev, NULL, |
155 | &kb3886bl_ops, | ||
156 | &props); | ||
152 | if (IS_ERR(kb3886_backlight_device)) | 157 | if (IS_ERR(kb3886_backlight_device)) |
153 | return PTR_ERR(kb3886_backlight_device); | 158 | return PTR_ERR(kb3886_backlight_device); |
154 | 159 | ||
155 | platform_set_drvdata(pdev, kb3886_backlight_device); | 160 | platform_set_drvdata(pdev, kb3886_backlight_device); |
156 | 161 | ||
157 | kb3886_backlight_device->props.max_brightness = machinfo->max_intensity; | ||
158 | kb3886_backlight_device->props.power = FB_BLANK_UNBLANK; | 162 | kb3886_backlight_device->props.power = FB_BLANK_UNBLANK; |
159 | kb3886_backlight_device->props.brightness = machinfo->default_intensity; | 163 | kb3886_backlight_device->props.brightness = machinfo->default_intensity; |
160 | backlight_update_status(kb3886_backlight_device); | 164 | backlight_update_status(kb3886_backlight_device); |
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c new file mode 100644 index 000000000000..bcdb12c93efd --- /dev/null +++ b/drivers/video/backlight/l4f00242t03.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * l4f00242t03.c -- support for Epson L4F00242T03 LCD | ||
3 | * | ||
4 | * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved. | ||
5 | * | ||
6 | * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> | ||
7 | * Inspired by Marek Vasut work in l4f00242t03.c | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/device.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/lcd.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/regulator/consumer.h> | ||
21 | |||
22 | #include <linux/spi/spi.h> | ||
23 | #include <linux/spi/l4f00242t03.h> | ||
24 | |||
25 | struct l4f00242t03_priv { | ||
26 | struct spi_device *spi; | ||
27 | struct lcd_device *ld; | ||
28 | int lcd_on:1; | ||
29 | struct regulator *io_reg; | ||
30 | struct regulator *core_reg; | ||
31 | }; | ||
32 | |||
33 | |||
34 | static void l4f00242t03_reset(unsigned int gpio) | ||
35 | { | ||
36 | pr_debug("l4f00242t03_reset.\n"); | ||
37 | gpio_set_value(gpio, 1); | ||
38 | mdelay(100); | ||
39 | gpio_set_value(gpio, 0); | ||
40 | mdelay(10); /* tRES >= 100us */ | ||
41 | gpio_set_value(gpio, 1); | ||
42 | mdelay(20); | ||
43 | } | ||
44 | |||
45 | #define param(x) ((x) | 0x100) | ||
46 | |||
47 | static void l4f00242t03_lcd_init(struct spi_device *spi) | ||
48 | { | ||
49 | struct l4f00242t03_pdata *pdata = spi->dev.platform_data; | ||
50 | struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); | ||
51 | const u16 cmd[] = { 0x36, param(0), 0x3A, param(0x60) }; | ||
52 | |||
53 | dev_dbg(&spi->dev, "initializing LCD\n"); | ||
54 | |||
55 | if (priv->io_reg) { | ||
56 | regulator_set_voltage(priv->io_reg, 1800000, 1800000); | ||
57 | regulator_enable(priv->io_reg); | ||
58 | } | ||
59 | |||
60 | if (priv->core_reg) { | ||
61 | regulator_set_voltage(priv->core_reg, 2800000, 2800000); | ||
62 | regulator_enable(priv->core_reg); | ||
63 | } | ||
64 | |||
65 | gpio_set_value(pdata->data_enable_gpio, 1); | ||
66 | msleep(60); | ||
67 | spi_write(spi, (const u8 *)cmd, ARRAY_SIZE(cmd) * sizeof(u16)); | ||
68 | } | ||
69 | |||
70 | static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power) | ||
71 | { | ||
72 | struct l4f00242t03_priv *priv = lcd_get_data(ld); | ||
73 | struct spi_device *spi = priv->spi; | ||
74 | |||
75 | const u16 slpout = 0x11; | ||
76 | const u16 dison = 0x29; | ||
77 | |||
78 | const u16 slpin = 0x10; | ||
79 | const u16 disoff = 0x28; | ||
80 | |||
81 | if (power) { | ||
82 | if (priv->lcd_on) | ||
83 | return 0; | ||
84 | |||
85 | dev_dbg(&spi->dev, "turning on LCD\n"); | ||
86 | |||
87 | spi_write(spi, (const u8 *)&slpout, sizeof(u16)); | ||
88 | msleep(60); | ||
89 | spi_write(spi, (const u8 *)&dison, sizeof(u16)); | ||
90 | |||
91 | priv->lcd_on = 1; | ||
92 | } else { | ||
93 | if (!priv->lcd_on) | ||
94 | return 0; | ||
95 | |||
96 | dev_dbg(&spi->dev, "turning off LCD\n"); | ||
97 | |||
98 | spi_write(spi, (const u8 *)&disoff, sizeof(u16)); | ||
99 | msleep(60); | ||
100 | spi_write(spi, (const u8 *)&slpin, sizeof(u16)); | ||
101 | |||
102 | priv->lcd_on = 0; | ||
103 | } | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static struct lcd_ops l4f_ops = { | ||
109 | .set_power = l4f00242t03_lcd_power_set, | ||
110 | .get_power = NULL, | ||
111 | }; | ||
112 | |||
113 | static int __devinit l4f00242t03_probe(struct spi_device *spi) | ||
114 | { | ||
115 | struct l4f00242t03_priv *priv; | ||
116 | struct l4f00242t03_pdata *pdata = spi->dev.platform_data; | ||
117 | int ret; | ||
118 | |||
119 | if (pdata == NULL) { | ||
120 | dev_err(&spi->dev, "Uninitialized platform data.\n"); | ||
121 | return -EINVAL; | ||
122 | } | ||
123 | |||
124 | priv = kzalloc(sizeof(struct l4f00242t03_priv), GFP_KERNEL); | ||
125 | |||
126 | if (priv == NULL) { | ||
127 | dev_err(&spi->dev, "No memory for this device.\n"); | ||
128 | ret = -ENOMEM; | ||
129 | goto err; | ||
130 | } | ||
131 | |||
132 | dev_set_drvdata(&spi->dev, priv); | ||
133 | spi->bits_per_word = 9; | ||
134 | spi_setup(spi); | ||
135 | |||
136 | priv->spi = spi; | ||
137 | |||
138 | ret = gpio_request(pdata->reset_gpio, "lcd l4f00242t03 reset"); | ||
139 | if (ret) { | ||
140 | dev_err(&spi->dev, | ||
141 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); | ||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | ret = gpio_direction_output(pdata->reset_gpio, 1); | ||
146 | if (ret) | ||
147 | goto err2; | ||
148 | |||
149 | ret = gpio_request(pdata->data_enable_gpio, | ||
150 | "lcd l4f00242t03 data enable"); | ||
151 | if (ret) { | ||
152 | dev_err(&spi->dev, | ||
153 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); | ||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | ret = gpio_direction_output(pdata->data_enable_gpio, 0); | ||
158 | if (ret) | ||
159 | goto err3; | ||
160 | |||
161 | if (pdata->io_supply) { | ||
162 | priv->io_reg = regulator_get(NULL, pdata->io_supply); | ||
163 | |||
164 | if (IS_ERR(priv->io_reg)) { | ||
165 | pr_err("%s: Unable to get the IO regulator\n", | ||
166 | __func__); | ||
167 | goto err3; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | if (pdata->core_supply) { | ||
172 | priv->core_reg = regulator_get(NULL, pdata->core_supply); | ||
173 | |||
174 | if (IS_ERR(priv->core_reg)) { | ||
175 | pr_err("%s: Unable to get the core regulator\n", | ||
176 | __func__); | ||
177 | goto err4; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | priv->ld = lcd_device_register("l4f00242t03", | ||
182 | &spi->dev, priv, &l4f_ops); | ||
183 | if (IS_ERR(priv->ld)) { | ||
184 | ret = PTR_ERR(priv->ld); | ||
185 | goto err5; | ||
186 | } | ||
187 | |||
188 | /* Init the LCD */ | ||
189 | l4f00242t03_reset(pdata->reset_gpio); | ||
190 | l4f00242t03_lcd_init(spi); | ||
191 | l4f00242t03_lcd_power_set(priv->ld, 1); | ||
192 | |||
193 | dev_info(&spi->dev, "Epson l4f00242t03 lcd probed.\n"); | ||
194 | |||
195 | return 0; | ||
196 | |||
197 | err5: | ||
198 | if (priv->core_reg) | ||
199 | regulator_put(priv->core_reg); | ||
200 | err4: | ||
201 | if (priv->io_reg) | ||
202 | regulator_put(priv->io_reg); | ||
203 | err3: | ||
204 | gpio_free(pdata->data_enable_gpio); | ||
205 | err2: | ||
206 | gpio_free(pdata->reset_gpio); | ||
207 | err: | ||
208 | kfree(priv); | ||
209 | |||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | static int __devexit l4f00242t03_remove(struct spi_device *spi) | ||
214 | { | ||
215 | struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); | ||
216 | struct l4f00242t03_pdata *pdata = priv->spi->dev.platform_data; | ||
217 | |||
218 | l4f00242t03_lcd_power_set(priv->ld, 0); | ||
219 | lcd_device_unregister(priv->ld); | ||
220 | |||
221 | gpio_free(pdata->data_enable_gpio); | ||
222 | gpio_free(pdata->reset_gpio); | ||
223 | |||
224 | if (priv->io_reg) | ||
225 | regulator_put(priv->core_reg); | ||
226 | if (priv->core_reg) | ||
227 | regulator_put(priv->io_reg); | ||
228 | |||
229 | kfree(priv); | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static struct spi_driver l4f00242t03_driver = { | ||
235 | .driver = { | ||
236 | .name = "l4f00242t03", | ||
237 | .owner = THIS_MODULE, | ||
238 | }, | ||
239 | .probe = l4f00242t03_probe, | ||
240 | .remove = __devexit_p(l4f00242t03_remove), | ||
241 | }; | ||
242 | |||
243 | static __init int l4f00242t03_init(void) | ||
244 | { | ||
245 | return spi_register_driver(&l4f00242t03_driver); | ||
246 | } | ||
247 | |||
248 | static __exit void l4f00242t03_exit(void) | ||
249 | { | ||
250 | spi_unregister_driver(&l4f00242t03_driver); | ||
251 | } | ||
252 | |||
253 | module_init(l4f00242t03_init); | ||
254 | module_exit(l4f00242t03_exit); | ||
255 | |||
256 | MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>"); | ||
257 | MODULE_DESCRIPTION("EPSON L4F00242T03 LCD"); | ||
258 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 9b3be74cee5a..71a11cadffc4 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/ctype.h> | 13 | #include <linux/ctype.h> |
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
16 | #include <linux/slab.h> | ||
16 | 17 | ||
17 | #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ | 18 | #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ |
18 | defined(CONFIG_LCD_CLASS_DEVICE_MODULE)) | 19 | defined(CONFIG_LCD_CLASS_DEVICE_MODULE)) |
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c index 447b542a20ca..abc43a0eb97d 100644 --- a/drivers/video/backlight/lms283gf05.c +++ b/drivers/video/backlight/lms283gf05.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
15 | #include <linux/lcd.h> | 16 | #include <linux/lcd.h> |
16 | 17 | ||
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index 00a9591b0003..7571bc26071e 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -167,6 +167,7 @@ static int locomolcd_resume(struct locomo_dev *dev) | |||
167 | 167 | ||
168 | static int locomolcd_probe(struct locomo_dev *ldev) | 168 | static int locomolcd_probe(struct locomo_dev *ldev) |
169 | { | 169 | { |
170 | struct backlight_properties props; | ||
170 | unsigned long flags; | 171 | unsigned long flags; |
171 | 172 | ||
172 | local_irq_save(flags); | 173 | local_irq_save(flags); |
@@ -182,13 +183,16 @@ static int locomolcd_probe(struct locomo_dev *ldev) | |||
182 | 183 | ||
183 | local_irq_restore(flags); | 184 | local_irq_restore(flags); |
184 | 185 | ||
185 | locomolcd_bl_device = backlight_device_register("locomo-bl", &ldev->dev, NULL, &locomobl_data); | 186 | memset(&props, 0, sizeof(struct backlight_properties)); |
187 | props.max_brightness = 4; | ||
188 | locomolcd_bl_device = backlight_device_register("locomo-bl", | ||
189 | &ldev->dev, NULL, | ||
190 | &locomobl_data, &props); | ||
186 | 191 | ||
187 | if (IS_ERR (locomolcd_bl_device)) | 192 | if (IS_ERR (locomolcd_bl_device)) |
188 | return PTR_ERR (locomolcd_bl_device); | 193 | return PTR_ERR (locomolcd_bl_device); |
189 | 194 | ||
190 | /* Set up frontlight so that screen is readable */ | 195 | /* Set up frontlight so that screen is readable */ |
191 | locomolcd_bl_device->props.max_brightness = 4, | ||
192 | locomolcd_bl_device->props.brightness = 2; | 196 | locomolcd_bl_device->props.brightness = 2; |
193 | locomolcd_set_intensity(locomolcd_bl_device); | 197 | locomolcd_set_intensity(locomolcd_bl_device); |
194 | 198 | ||
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c index 4631ca8fa4a4..8010aaeb5adb 100644 --- a/drivers/video/backlight/ltv350qv.c +++ b/drivers/video/backlight/ltv350qv.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/lcd.h> | 14 | #include <linux/lcd.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
17 | 18 | ||
18 | #include "ltv350qv.h" | 19 | #include "ltv350qv.h" |
diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index c267069a52a3..b5accc957ad3 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/backlight.h> | 17 | #include <linux/backlight.h> |
18 | #include <linux/mfd/max8925.h> | 18 | #include <linux/mfd/max8925.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #define MAX_BRIGHTNESS (0xff) | 21 | #define MAX_BRIGHTNESS (0xff) |
21 | #define MIN_BRIGHTNESS (0) | 22 | #define MIN_BRIGHTNESS (0) |
@@ -104,6 +105,7 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) | |||
104 | struct max8925_backlight_pdata *pdata = NULL; | 105 | struct max8925_backlight_pdata *pdata = NULL; |
105 | struct max8925_backlight_data *data; | 106 | struct max8925_backlight_data *data; |
106 | struct backlight_device *bl; | 107 | struct backlight_device *bl; |
108 | struct backlight_properties props; | ||
107 | struct resource *res; | 109 | struct resource *res; |
108 | char name[MAX8925_NAME_SIZE]; | 110 | char name[MAX8925_NAME_SIZE]; |
109 | unsigned char value; | 111 | unsigned char value; |
@@ -133,14 +135,15 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) | |||
133 | data->chip = chip; | 135 | data->chip = chip; |
134 | data->current_brightness = 0; | 136 | data->current_brightness = 0; |
135 | 137 | ||
138 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
139 | props.max_brightness = MAX_BRIGHTNESS; | ||
136 | bl = backlight_device_register(name, &pdev->dev, data, | 140 | bl = backlight_device_register(name, &pdev->dev, data, |
137 | &max8925_backlight_ops); | 141 | &max8925_backlight_ops, &props); |
138 | if (IS_ERR(bl)) { | 142 | if (IS_ERR(bl)) { |
139 | dev_err(&pdev->dev, "failed to register backlight\n"); | 143 | dev_err(&pdev->dev, "failed to register backlight\n"); |
140 | kfree(data); | 144 | kfree(data); |
141 | return PTR_ERR(bl); | 145 | return PTR_ERR(bl); |
142 | } | 146 | } |
143 | bl->props.max_brightness = MAX_BRIGHTNESS; | ||
144 | bl->props.brightness = MAX_BRIGHTNESS; | 147 | bl->props.brightness = MAX_BRIGHTNESS; |
145 | 148 | ||
146 | platform_set_drvdata(pdev, bl); | 149 | platform_set_drvdata(pdev, bl); |
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c index 2e78b0784bdc..1b5d3fe6bbbc 100644 --- a/drivers/video/backlight/mbp_nvidia_bl.c +++ b/drivers/video/backlight/mbp_nvidia_bl.c | |||
@@ -139,6 +139,51 @@ static int mbp_dmi_match(const struct dmi_system_id *id) | |||
139 | static const struct dmi_system_id __initdata mbp_device_table[] = { | 139 | static const struct dmi_system_id __initdata mbp_device_table[] = { |
140 | { | 140 | { |
141 | .callback = mbp_dmi_match, | 141 | .callback = mbp_dmi_match, |
142 | .ident = "MacBook 1,1", | ||
143 | .matches = { | ||
144 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
145 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"), | ||
146 | }, | ||
147 | .driver_data = (void *)&intel_chipset_data, | ||
148 | }, | ||
149 | { | ||
150 | .callback = mbp_dmi_match, | ||
151 | .ident = "MacBook 2,1", | ||
152 | .matches = { | ||
153 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
154 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook2,1"), | ||
155 | }, | ||
156 | .driver_data = (void *)&intel_chipset_data, | ||
157 | }, | ||
158 | { | ||
159 | .callback = mbp_dmi_match, | ||
160 | .ident = "MacBook 3,1", | ||
161 | .matches = { | ||
162 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
163 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook3,1"), | ||
164 | }, | ||
165 | .driver_data = (void *)&intel_chipset_data, | ||
166 | }, | ||
167 | { | ||
168 | .callback = mbp_dmi_match, | ||
169 | .ident = "MacBook 4,1", | ||
170 | .matches = { | ||
171 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
172 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook4,1"), | ||
173 | }, | ||
174 | .driver_data = (void *)&intel_chipset_data, | ||
175 | }, | ||
176 | { | ||
177 | .callback = mbp_dmi_match, | ||
178 | .ident = "MacBook 4,2", | ||
179 | .matches = { | ||
180 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
181 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook4,2"), | ||
182 | }, | ||
183 | .driver_data = (void *)&intel_chipset_data, | ||
184 | }, | ||
185 | { | ||
186 | .callback = mbp_dmi_match, | ||
142 | .ident = "MacBookPro 3,1", | 187 | .ident = "MacBookPro 3,1", |
143 | .matches = { | 188 | .matches = { |
144 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 189 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
@@ -250,6 +295,7 @@ static const struct dmi_system_id __initdata mbp_device_table[] = { | |||
250 | 295 | ||
251 | static int __init mbp_init(void) | 296 | static int __init mbp_init(void) |
252 | { | 297 | { |
298 | struct backlight_properties props; | ||
253 | if (!dmi_check_system(mbp_device_table)) | 299 | if (!dmi_check_system(mbp_device_table)) |
254 | return -ENODEV; | 300 | return -ENODEV; |
255 | 301 | ||
@@ -257,14 +303,17 @@ static int __init mbp_init(void) | |||
257 | "Macbook Pro backlight")) | 303 | "Macbook Pro backlight")) |
258 | return -ENXIO; | 304 | return -ENXIO; |
259 | 305 | ||
260 | mbp_backlight_device = backlight_device_register("mbp_backlight", | 306 | memset(&props, 0, sizeof(struct backlight_properties)); |
261 | NULL, NULL, &driver_data->backlight_ops); | 307 | props.max_brightness = 15; |
308 | mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, | ||
309 | NULL, | ||
310 | &driver_data->backlight_ops, | ||
311 | &props); | ||
262 | if (IS_ERR(mbp_backlight_device)) { | 312 | if (IS_ERR(mbp_backlight_device)) { |
263 | release_region(driver_data->iostart, driver_data->iolen); | 313 | release_region(driver_data->iostart, driver_data->iolen); |
264 | return PTR_ERR(mbp_backlight_device); | 314 | return PTR_ERR(mbp_backlight_device); |
265 | } | 315 | } |
266 | 316 | ||
267 | mbp_backlight_device->props.max_brightness = 15; | ||
268 | mbp_backlight_device->props.brightness = | 317 | mbp_backlight_device->props.brightness = |
269 | driver_data->backlight_ops.get_brightness(mbp_backlight_device); | 318 | driver_data->backlight_ops.get_brightness(mbp_backlight_device); |
270 | backlight_update_status(mbp_backlight_device); | 319 | backlight_update_status(mbp_backlight_device); |
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index a3a7f8938175..d3bc56296c8d 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | #include <linux/backlight.h> | 26 | #include <linux/backlight.h> |
27 | #include <linux/slab.h> | ||
27 | 28 | ||
28 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
29 | #include <plat/board.h> | 30 | #include <plat/board.h> |
@@ -132,6 +133,7 @@ static const struct backlight_ops omapbl_ops = { | |||
132 | 133 | ||
133 | static int omapbl_probe(struct platform_device *pdev) | 134 | static int omapbl_probe(struct platform_device *pdev) |
134 | { | 135 | { |
136 | struct backlight_properties props; | ||
135 | struct backlight_device *dev; | 137 | struct backlight_device *dev; |
136 | struct omap_backlight *bl; | 138 | struct omap_backlight *bl; |
137 | struct omap_backlight_config *pdata = pdev->dev.platform_data; | 139 | struct omap_backlight_config *pdata = pdev->dev.platform_data; |
@@ -143,7 +145,10 @@ static int omapbl_probe(struct platform_device *pdev) | |||
143 | if (unlikely(!bl)) | 145 | if (unlikely(!bl)) |
144 | return -ENOMEM; | 146 | return -ENOMEM; |
145 | 147 | ||
146 | dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops); | 148 | memset(&props, 0, sizeof(struct backlight_properties)); |
149 | props.max_brightness = OMAPBL_MAX_INTENSITY; | ||
150 | dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops, | ||
151 | &props); | ||
147 | if (IS_ERR(dev)) { | 152 | if (IS_ERR(dev)) { |
148 | kfree(bl); | 153 | kfree(bl); |
149 | return PTR_ERR(dev); | 154 | return PTR_ERR(dev); |
@@ -160,7 +165,6 @@ static int omapbl_probe(struct platform_device *pdev) | |||
160 | omap_cfg_reg(PWL); /* Conflicts with UART3 */ | 165 | omap_cfg_reg(PWL); /* Conflicts with UART3 */ |
161 | 166 | ||
162 | dev->props.fb_blank = FB_BLANK_UNBLANK; | 167 | dev->props.fb_blank = FB_BLANK_UNBLANK; |
163 | dev->props.max_brightness = OMAPBL_MAX_INTENSITY; | ||
164 | dev->props.brightness = pdata->default_intensity; | 168 | dev->props.brightness = pdata->default_intensity; |
165 | omapbl_update_status(dev); | 169 | omapbl_update_status(dev); |
166 | 170 | ||
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c index 738694d23889..302330acf628 100644 --- a/drivers/video/backlight/platform_lcd.c +++ b/drivers/video/backlight/platform_lcd.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
17 | #include <linux/backlight.h> | 17 | #include <linux/backlight.h> |
18 | #include <linux/lcd.h> | 18 | #include <linux/lcd.h> |
19 | #include <linux/slab.h> | ||
19 | 20 | ||
20 | #include <video/platform_lcd.h> | 21 | #include <video/platform_lcd.h> |
21 | 22 | ||
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c index 075786e05034..809278c90738 100644 --- a/drivers/video/backlight/progear_bl.c +++ b/drivers/video/backlight/progear_bl.c | |||
@@ -61,8 +61,10 @@ static const struct backlight_ops progearbl_ops = { | |||
61 | 61 | ||
62 | static int progearbl_probe(struct platform_device *pdev) | 62 | static int progearbl_probe(struct platform_device *pdev) |
63 | { | 63 | { |
64 | struct backlight_properties props; | ||
64 | u8 temp; | 65 | u8 temp; |
65 | struct backlight_device *progear_backlight_device; | 66 | struct backlight_device *progear_backlight_device; |
67 | int ret; | ||
66 | 68 | ||
67 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); | 69 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); |
68 | if (!pmu_dev) { | 70 | if (!pmu_dev) { |
@@ -73,28 +75,37 @@ static int progearbl_probe(struct platform_device *pdev) | |||
73 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 75 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); |
74 | if (!sb_dev) { | 76 | if (!sb_dev) { |
75 | printk("ALI 1533 SB not found.\n"); | 77 | printk("ALI 1533 SB not found.\n"); |
76 | pci_dev_put(pmu_dev); | 78 | ret = -ENODEV; |
77 | return -ENODEV; | 79 | goto put_pmu; |
78 | } | 80 | } |
79 | 81 | ||
80 | /* Set SB_MPS1 to enable brightness control. */ | 82 | /* Set SB_MPS1 to enable brightness control. */ |
81 | pci_read_config_byte(sb_dev, SB_MPS1, &temp); | 83 | pci_read_config_byte(sb_dev, SB_MPS1, &temp); |
82 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); | 84 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); |
83 | 85 | ||
86 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
87 | props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | ||
84 | progear_backlight_device = backlight_device_register("progear-bl", | 88 | progear_backlight_device = backlight_device_register("progear-bl", |
85 | &pdev->dev, NULL, | 89 | &pdev->dev, NULL, |
86 | &progearbl_ops); | 90 | &progearbl_ops, |
87 | if (IS_ERR(progear_backlight_device)) | 91 | &props); |
88 | return PTR_ERR(progear_backlight_device); | 92 | if (IS_ERR(progear_backlight_device)) { |
93 | ret = PTR_ERR(progear_backlight_device); | ||
94 | goto put_sb; | ||
95 | } | ||
89 | 96 | ||
90 | platform_set_drvdata(pdev, progear_backlight_device); | 97 | platform_set_drvdata(pdev, progear_backlight_device); |
91 | 98 | ||
92 | progear_backlight_device->props.power = FB_BLANK_UNBLANK; | 99 | progear_backlight_device->props.power = FB_BLANK_UNBLANK; |
93 | progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | 100 | progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; |
94 | progear_backlight_device->props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | ||
95 | progearbl_set_intensity(progear_backlight_device); | 101 | progearbl_set_intensity(progear_backlight_device); |
96 | 102 | ||
97 | return 0; | 103 | return 0; |
104 | put_sb: | ||
105 | pci_dev_put(sb_dev); | ||
106 | put_pmu: | ||
107 | pci_dev_put(pmu_dev); | ||
108 | return ret; | ||
98 | } | 109 | } |
99 | 110 | ||
100 | static int progearbl_remove(struct platform_device *pdev) | 111 | static int progearbl_remove(struct platform_device *pdev) |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 9d2ec2a1cce8..550443518891 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/pwm.h> | 20 | #include <linux/pwm.h> |
21 | #include <linux/pwm_backlight.h> | 21 | #include <linux/pwm_backlight.h> |
22 | #include <linux/slab.h> | ||
22 | 23 | ||
23 | struct pwm_bl_data { | 24 | struct pwm_bl_data { |
24 | struct pwm_device *pwm; | 25 | struct pwm_device *pwm; |
@@ -65,6 +66,7 @@ static const struct backlight_ops pwm_backlight_ops = { | |||
65 | 66 | ||
66 | static int pwm_backlight_probe(struct platform_device *pdev) | 67 | static int pwm_backlight_probe(struct platform_device *pdev) |
67 | { | 68 | { |
69 | struct backlight_properties props; | ||
68 | struct platform_pwm_backlight_data *data = pdev->dev.platform_data; | 70 | struct platform_pwm_backlight_data *data = pdev->dev.platform_data; |
69 | struct backlight_device *bl; | 71 | struct backlight_device *bl; |
70 | struct pwm_bl_data *pb; | 72 | struct pwm_bl_data *pb; |
@@ -100,15 +102,16 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
100 | } else | 102 | } else |
101 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); | 103 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); |
102 | 104 | ||
103 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, | 105 | memset(&props, 0, sizeof(struct backlight_properties)); |
104 | pb, &pwm_backlight_ops); | 106 | props.max_brightness = data->max_brightness; |
107 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb, | ||
108 | &pwm_backlight_ops, &props); | ||
105 | if (IS_ERR(bl)) { | 109 | if (IS_ERR(bl)) { |
106 | dev_err(&pdev->dev, "failed to register backlight\n"); | 110 | dev_err(&pdev->dev, "failed to register backlight\n"); |
107 | ret = PTR_ERR(bl); | 111 | ret = PTR_ERR(bl); |
108 | goto err_bl; | 112 | goto err_bl; |
109 | } | 113 | } |
110 | 114 | ||
111 | bl->props.max_brightness = data->max_brightness; | ||
112 | bl->props.brightness = data->dft_brightness; | 115 | bl->props.brightness = data->dft_brightness; |
113 | backlight_update_status(bl); | 116 | backlight_update_status(bl); |
114 | 117 | ||
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c index 4a3d46e08016..1997e12a1057 100644 --- a/drivers/video/backlight/tdo24m.c +++ b/drivers/video/backlight/tdo24m.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/spi/tdo24m.h> | 17 | #include <linux/spi/tdo24m.h> |
18 | #include <linux/fb.h> | 18 | #include <linux/fb.h> |
19 | #include <linux/lcd.h> | 19 | #include <linux/lcd.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) | 22 | #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) |
22 | 23 | ||
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index e14ce4d469f5..e03e60bbfd85 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
20 | #include <linux/backlight.h> | 20 | #include <linux/backlight.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <asm/mach/sharpsl_param.h> | 23 | #include <asm/mach/sharpsl_param.h> |
23 | 24 | ||
@@ -80,6 +81,7 @@ static const struct backlight_ops bl_ops = { | |||
80 | static int __devinit tosa_bl_probe(struct i2c_client *client, | 81 | static int __devinit tosa_bl_probe(struct i2c_client *client, |
81 | const struct i2c_device_id *id) | 82 | const struct i2c_device_id *id) |
82 | { | 83 | { |
84 | struct backlight_properties props; | ||
83 | struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); | 85 | struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); |
84 | int ret = 0; | 86 | int ret = 0; |
85 | if (!data) | 87 | if (!data) |
@@ -99,15 +101,16 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, | |||
99 | i2c_set_clientdata(client, data); | 101 | i2c_set_clientdata(client, data); |
100 | data->i2c = client; | 102 | data->i2c = client; |
101 | 103 | ||
102 | data->bl = backlight_device_register("tosa-bl", &client->dev, | 104 | memset(&props, 0, sizeof(struct backlight_properties)); |
103 | data, &bl_ops); | 105 | props.max_brightness = 512 - 1; |
106 | data->bl = backlight_device_register("tosa-bl", &client->dev, data, | ||
107 | &bl_ops, &props); | ||
104 | if (IS_ERR(data->bl)) { | 108 | if (IS_ERR(data->bl)) { |
105 | ret = PTR_ERR(data->bl); | 109 | ret = PTR_ERR(data->bl); |
106 | goto err_reg; | 110 | goto err_reg; |
107 | } | 111 | } |
108 | 112 | ||
109 | data->bl->props.brightness = 69; | 113 | data->bl->props.brightness = 69; |
110 | data->bl->props.max_brightness = 512 - 1; | ||
111 | data->bl->props.power = FB_BLANK_UNBLANK; | 114 | data->bl->props.power = FB_BLANK_UNBLANK; |
112 | 115 | ||
113 | backlight_update_status(data->bl); | 116 | backlight_update_status(data->bl); |
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index fa32b94a4546..772f6015219a 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
18 | #include <linux/slab.h> | ||
18 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
20 | #include <linux/lcd.h> | 21 | #include <linux/lcd.h> |
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index e32add37a203..08fd87f3aecc 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/fb.h> | 14 | #include <linux/fb.h> |
15 | #include <linux/backlight.h> | 15 | #include <linux/backlight.h> |
16 | #include <linux/slab.h> | ||
16 | 17 | ||
17 | #include <linux/mfd/wm831x/core.h> | 18 | #include <linux/mfd/wm831x/core.h> |
18 | #include <linux/mfd/wm831x/pdata.h> | 19 | #include <linux/mfd/wm831x/pdata.h> |
@@ -125,6 +126,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
125 | struct wm831x_backlight_pdata *pdata; | 126 | struct wm831x_backlight_pdata *pdata; |
126 | struct wm831x_backlight_data *data; | 127 | struct wm831x_backlight_data *data; |
127 | struct backlight_device *bl; | 128 | struct backlight_device *bl; |
129 | struct backlight_properties props; | ||
128 | int ret, i, max_isel, isink_reg, dcdc_cfg; | 130 | int ret, i, max_isel, isink_reg, dcdc_cfg; |
129 | 131 | ||
130 | /* We need platform data */ | 132 | /* We need platform data */ |
@@ -191,15 +193,15 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
191 | data->current_brightness = 0; | 193 | data->current_brightness = 0; |
192 | data->isink_reg = isink_reg; | 194 | data->isink_reg = isink_reg; |
193 | 195 | ||
194 | bl = backlight_device_register("wm831x", &pdev->dev, | 196 | props.max_brightness = max_isel; |
195 | data, &wm831x_backlight_ops); | 197 | bl = backlight_device_register("wm831x", &pdev->dev, data, |
198 | &wm831x_backlight_ops, &props); | ||
196 | if (IS_ERR(bl)) { | 199 | if (IS_ERR(bl)) { |
197 | dev_err(&pdev->dev, "failed to register backlight\n"); | 200 | dev_err(&pdev->dev, "failed to register backlight\n"); |
198 | kfree(data); | 201 | kfree(data); |
199 | return PTR_ERR(bl); | 202 | return PTR_ERR(bl); |
200 | } | 203 | } |
201 | 204 | ||
202 | bl->props.max_brightness = max_isel; | ||
203 | bl->props.brightness = max_isel; | 205 | bl->props.brightness = max_isel; |
204 | 206 | ||
205 | platform_set_drvdata(pdev, bl); | 207 | platform_set_drvdata(pdev, bl); |