aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/88pm860x_bl.c18
-rw-r--r--drivers/video/backlight/atmel-pwm-bl.c7
-rw-r--r--drivers/video/backlight/backlight.c29
-rw-r--r--drivers/video/backlight/corgi_lcd.c20
-rw-r--r--drivers/video/backlight/da903x_bl.c15
-rw-r--r--drivers/video/backlight/da9052_bl.c2
-rw-r--r--drivers/video/backlight/generic_bl.c4
-rw-r--r--drivers/video/backlight/hp680_bl.c4
-rw-r--r--drivers/video/backlight/ili9320.c14
-rw-r--r--drivers/video/backlight/ili9320.h2
-rw-r--r--drivers/video/backlight/jornada720_bl.c31
-rw-r--r--drivers/video/backlight/l4f00242t03.c3
-rw-r--r--drivers/video/backlight/lcd.c8
-rw-r--r--drivers/video/backlight/lm3630_bl.c2
-rw-r--r--drivers/video/backlight/lm3639_bl.c2
-rw-r--r--drivers/video/backlight/lms283gf05.c17
-rw-r--r--drivers/video/backlight/lp855x_bl.c51
-rw-r--r--drivers/video/backlight/max8925_bl.c11
-rw-r--r--drivers/video/backlight/omap1_bl.c4
-rw-r--r--drivers/video/backlight/pandora_bl.c8
-rw-r--r--drivers/video/backlight/pcf50633-backlight.c8
-rw-r--r--drivers/video/backlight/platform_lcd.c2
-rw-r--r--drivers/video/backlight/s6e63m0.c2
-rw-r--r--drivers/video/backlight/tdo24m.c33
-rw-r--r--drivers/video/backlight/tosa_bl.c7
-rw-r--r--drivers/video/backlight/tosa_lcd.c24
-rw-r--r--drivers/video/backlight/vgg2432a4.c10
27 files changed, 177 insertions, 161 deletions
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index b7ec34c57f46..c072ed9aea36 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -117,8 +117,8 @@ static int pm860x_backlight_set(struct backlight_device *bl, int brightness)
117 data->current_brightness = value; 117 data->current_brightness = value;
118 return 0; 118 return 0;
119out: 119out:
120 dev_dbg(chip->dev, "set brightness %d failure with return " 120 dev_dbg(chip->dev, "set brightness %d failure with return value: %d\n",
121 "value:%d\n", value, ret); 121 value, ret);
122 return ret; 122 return ret;
123} 123}
124 124
@@ -208,22 +208,19 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
208 res = platform_get_resource_byname(pdev, IORESOURCE_REG, "duty cycle"); 208 res = platform_get_resource_byname(pdev, IORESOURCE_REG, "duty cycle");
209 if (!res) { 209 if (!res) {
210 dev_err(&pdev->dev, "No REG resource for duty cycle\n"); 210 dev_err(&pdev->dev, "No REG resource for duty cycle\n");
211 ret = -ENXIO; 211 return -ENXIO;
212 goto out;
213 } 212 }
214 data->reg_duty_cycle = res->start; 213 data->reg_duty_cycle = res->start;
215 res = platform_get_resource_byname(pdev, IORESOURCE_REG, "always on"); 214 res = platform_get_resource_byname(pdev, IORESOURCE_REG, "always on");
216 if (!res) { 215 if (!res) {
217 dev_err(&pdev->dev, "No REG resorce for always on\n"); 216 dev_err(&pdev->dev, "No REG resorce for always on\n");
218 ret = -ENXIO; 217 return -ENXIO;
219 goto out;
220 } 218 }
221 data->reg_always_on = res->start; 219 data->reg_always_on = res->start;
222 res = platform_get_resource_byname(pdev, IORESOURCE_REG, "current"); 220 res = platform_get_resource_byname(pdev, IORESOURCE_REG, "current");
223 if (!res) { 221 if (!res) {
224 dev_err(&pdev->dev, "No REG resource for current\n"); 222 dev_err(&pdev->dev, "No REG resource for current\n");
225 ret = -ENXIO; 223 return -ENXIO;
226 goto out;
227 } 224 }
228 data->reg_current = res->start; 225 data->reg_current = res->start;
229 226
@@ -231,8 +228,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
231 sprintf(name, "backlight-%d", pdev->id); 228 sprintf(name, "backlight-%d", pdev->id);
232 data->port = pdev->id; 229 data->port = pdev->id;
233 data->chip = chip; 230 data->chip = chip;
234 data->i2c = (chip->id == CHIP_PM8606) ? chip->client \ 231 data->i2c = (chip->id == CHIP_PM8606) ? chip->client : chip->companion;
235 : chip->companion;
236 data->current_brightness = MAX_BRIGHTNESS; 232 data->current_brightness = MAX_BRIGHTNESS;
237 if (pm860x_backlight_dt_init(pdev, data, name)) { 233 if (pm860x_backlight_dt_init(pdev, data, name)) {
238 if (pdata) { 234 if (pdata) {
@@ -263,8 +259,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
263 return 0; 259 return 0;
264out_brt: 260out_brt:
265 backlight_device_unregister(bl); 261 backlight_device_unregister(bl);
266out:
267 devm_kfree(&pdev->dev, data);
268 return ret; 262 return ret;
269} 263}
270 264
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
index df1cbb7ef6ca..de5e5e74e2a7 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -106,10 +106,9 @@ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
106 pwm_channel_writel(&pwmbl->pwmc, PWM_CPRD, 106 pwm_channel_writel(&pwmbl->pwmc, PWM_CPRD,
107 pwmbl->pdata->pwm_compare_max); 107 pwmbl->pdata->pwm_compare_max);
108 108
109 dev_info(&pwmbl->pdev->dev, "Atmel PWM backlight driver " 109 dev_info(&pwmbl->pdev->dev, "Atmel PWM backlight driver (%lu Hz)\n",
110 "(%lu Hz)\n", pwmbl->pwmc.mck / 110 pwmbl->pwmc.mck / pwmbl->pdata->pwm_compare_max /
111 pwmbl->pdata->pwm_compare_max / 111 (1 << prescale));
112 (1 << prescale));
113 112
114 return pwm_channel_enable(&pwmbl->pwmc); 113 return pwm_channel_enable(&pwmbl->pwmc);
115} 114}
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 297db2fa91f5..345f6660d4b3 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -370,6 +370,35 @@ void backlight_device_unregister(struct backlight_device *bd)
370} 370}
371EXPORT_SYMBOL(backlight_device_unregister); 371EXPORT_SYMBOL(backlight_device_unregister);
372 372
373#ifdef CONFIG_OF
374static int of_parent_match(struct device *dev, void *data)
375{
376 return dev->parent && dev->parent->of_node == data;
377}
378
379/**
380 * of_find_backlight_by_node() - find backlight device by device-tree node
381 * @node: device-tree node of the backlight device
382 *
383 * Returns a pointer to the backlight device corresponding to the given DT
384 * node or NULL if no such backlight device exists or if the device hasn't
385 * been probed yet.
386 *
387 * This function obtains a reference on the backlight device and it is the
388 * caller's responsibility to drop the reference by calling put_device() on
389 * the backlight device's .dev field.
390 */
391struct backlight_device *of_find_backlight_by_node(struct device_node *node)
392{
393 struct device *dev;
394
395 dev = class_find_device(backlight_class, NULL, node, of_parent_match);
396
397 return dev ? to_backlight_device(dev) : NULL;
398}
399EXPORT_SYMBOL(of_find_backlight_by_node);
400#endif
401
373static void __exit backlight_class_exit(void) 402static void __exit backlight_class_exit(void)
374{ 403{
375 class_destroy(backlight_class); 404 class_destroy(backlight_class);
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index eaaebf21993e..e323fcbe884e 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -6,8 +6,8 @@
6 * Based on Sharp's 2.4 Backlight Driver 6 * Based on Sharp's 2.4 Backlight Driver
7 * 7 *
8 * Copyright (c) 2008 Marvell International Ltd. 8 * Copyright (c) 2008 Marvell International Ltd.
9 * Converted to SPI device based LCD/Backlight device driver 9 * Converted to SPI device based LCD/Backlight device driver
10 * by Eric Miao <eric.miao@marvell.com> 10 * by Eric Miao <eric.miao@marvell.com>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -192,7 +192,7 @@ static void lcdtg_set_phadadj(struct corgi_lcd *lcd, int mode)
192{ 192{
193 int adj; 193 int adj;
194 194
195 switch(mode) { 195 switch (mode) {
196 case CORGI_LCD_MODE_VGA: 196 case CORGI_LCD_MODE_VGA:
197 /* Setting for VGA */ 197 /* Setting for VGA */
198 adj = sharpsl_param.phadadj; 198 adj = sharpsl_param.phadadj;
@@ -409,10 +409,10 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity)
409 cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted; 409 cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted;
410 410
411 if (gpio_is_valid(lcd->gpio_backlight_cont)) 411 if (gpio_is_valid(lcd->gpio_backlight_cont))
412 gpio_set_value(lcd->gpio_backlight_cont, cont); 412 gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont);
413 413
414 if (gpio_is_valid(lcd->gpio_backlight_on)) 414 if (gpio_is_valid(lcd->gpio_backlight_on))
415 gpio_set_value(lcd->gpio_backlight_on, intensity); 415 gpio_set_value_cansleep(lcd->gpio_backlight_on, intensity);
416 416
417 if (lcd->kick_battery) 417 if (lcd->kick_battery)
418 lcd->kick_battery(); 418 lcd->kick_battery();
@@ -495,8 +495,9 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
495 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on, 495 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on,
496 "BL_ON"); 496 "BL_ON");
497 if (err) { 497 if (err) {
498 dev_err(&spi->dev, "failed to request GPIO%d for " 498 dev_err(&spi->dev,
499 "backlight_on\n", pdata->gpio_backlight_on); 499 "failed to request GPIO%d for backlight_on\n",
500 pdata->gpio_backlight_on);
500 return err; 501 return err;
501 } 502 }
502 503
@@ -508,8 +509,9 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
508 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont, 509 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont,
509 "BL_CONT"); 510 "BL_CONT");
510 if (err) { 511 if (err) {
511 dev_err(&spi->dev, "failed to request GPIO%d for " 512 dev_err(&spi->dev,
512 "backlight_cont\n", pdata->gpio_backlight_cont); 513 "failed to request GPIO%d for backlight_cont\n",
514 pdata->gpio_backlight_cont);
513 return err; 515 return err;
514 } 516 }
515 517
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c
index 573c7ece0fde..8179cef0730f 100644
--- a/drivers/video/backlight/da903x_bl.c
+++ b/drivers/video/backlight/da903x_bl.c
@@ -2,10 +2,10 @@
2 * Backlight driver for Dialog Semiconductor DA9030/DA9034 2 * Backlight driver for Dialog Semiconductor DA9030/DA9034
3 * 3 *
4 * Copyright (C) 2008 Compulab, Ltd. 4 * Copyright (C) 2008 Compulab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il> 5 * Mike Rapoport <mike@compulab.co.il>
6 * 6 *
7 * Copyright (C) 2006-2008 Marvell International Ltd. 7 * Copyright (C) 2006-2008 Marvell International Ltd.
8 * Eric Miao <eric.miao@marvell.com> 8 * Eric Miao <eric.miao@marvell.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -164,15 +164,14 @@ static int da903x_backlight_remove(struct platform_device *pdev)
164#ifdef CONFIG_PM 164#ifdef CONFIG_PM
165static int da903x_backlight_suspend(struct device *dev) 165static int da903x_backlight_suspend(struct device *dev)
166{ 166{
167 struct platform_device *pdev = to_platform_device(dev); 167 struct backlight_device *bl = dev_get_drvdata(dev);
168 struct backlight_device *bl = platform_get_drvdata(pdev); 168
169 return da903x_backlight_set(bl, 0); 169 return da903x_backlight_set(bl, 0);
170} 170}
171 171
172static int da903x_backlight_resume(struct device *dev) 172static int da903x_backlight_resume(struct device *dev)
173{ 173{
174 struct platform_device *pdev = to_platform_device(dev); 174 struct backlight_device *bl = dev_get_drvdata(dev);
175 struct backlight_device *bl = platform_get_drvdata(pdev);
176 175
177 backlight_update_status(bl); 176 backlight_update_status(bl);
178 return 0; 177 return 0;
@@ -199,7 +198,7 @@ static struct platform_driver da903x_backlight_driver = {
199module_platform_driver(da903x_backlight_driver); 198module_platform_driver(da903x_backlight_driver);
200 199
201MODULE_DESCRIPTION("Backlight Driver for Dialog Semiconductor DA9030/DA9034"); 200MODULE_DESCRIPTION("Backlight Driver for Dialog Semiconductor DA9030/DA9034");
202MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>" 201MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
203 "Mike Rapoport <mike@compulab.co.il>"); 202MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
204MODULE_LICENSE("GPL"); 203MODULE_LICENSE("GPL");
205MODULE_ALIAS("platform:da903x-backlight"); 204MODULE_ALIAS("platform:da903x-backlight");
diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index ac196181fe45..842da5a3ac4f 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -34,7 +34,7 @@ enum {
34 DA9052_TYPE_WLED3, 34 DA9052_TYPE_WLED3,
35}; 35};
36 36
37static unsigned char wled_bank[] = { 37static const unsigned char wled_bank[] = {
38 DA9052_LED1_CONF_REG, 38 DA9052_LED1_CONF_REG,
39 DA9052_LED2_CONF_REG, 39 DA9052_LED2_CONF_REG,
40 DA9052_LED3_CONF_REG, 40 DA9052_LED3_CONF_REG,
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c
index 8c660fcd250d..0ae155be9c89 100644
--- a/drivers/video/backlight/generic_bl.c
+++ b/drivers/video/backlight/generic_bl.c
@@ -97,8 +97,8 @@ static int genericbl_probe(struct platform_device *pdev)
97 props.max_brightness = machinfo->max_intensity; 97 props.max_brightness = machinfo->max_intensity;
98 bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops, 98 bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops,
99 &props); 99 &props);
100 if (IS_ERR (bd)) 100 if (IS_ERR(bd))
101 return PTR_ERR (bd); 101 return PTR_ERR(bd);
102 102
103 platform_set_drvdata(pdev, bd); 103 platform_set_drvdata(pdev, bd);
104 104
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index c99966342448..5cefd73526f8 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -26,7 +26,7 @@
26#define HP680_DEFAULT_INTENSITY 10 26#define HP680_DEFAULT_INTENSITY 10
27 27
28static int hp680bl_suspended; 28static int hp680bl_suspended;
29static int current_intensity = 0; 29static int current_intensity;
30static DEFINE_SPINLOCK(bl_lock); 30static DEFINE_SPINLOCK(bl_lock);
31 31
32static void hp680bl_send_intensity(struct backlight_device *bd) 32static void hp680bl_send_intensity(struct backlight_device *bd)
@@ -168,7 +168,7 @@ static int __init hp680bl_init(void)
168static void __exit hp680bl_exit(void) 168static void __exit hp680bl_exit(void)
169{ 169{
170 platform_device_unregister(hp680bl_device); 170 platform_device_unregister(hp680bl_device);
171 platform_driver_unregister(&hp680bl_driver); 171 platform_driver_unregister(&hp680bl_driver);
172} 172}
173 173
174module_init(hp680bl_init); 174module_init(hp680bl_init);
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c
index 66cc313185ad..1235bf9defc4 100644
--- a/drivers/video/backlight/ili9320.c
+++ b/drivers/video/backlight/ili9320.c
@@ -45,7 +45,7 @@ static inline int ili9320_write_spi(struct ili9320 *ili,
45 /* second message is the data to transfer */ 45 /* second message is the data to transfer */
46 46
47 data[0] = spi->id | ILI9320_SPI_DATA | ILI9320_SPI_WRITE; 47 data[0] = spi->id | ILI9320_SPI_DATA | ILI9320_SPI_WRITE;
48 data[1] = value >> 8; 48 data[1] = value >> 8;
49 data[2] = value; 49 data[2] = value;
50 50
51 return spi_sync(spi->dev, &spi->message); 51 return spi_sync(spi->dev, &spi->message);
@@ -56,11 +56,10 @@ int ili9320_write(struct ili9320 *ili, unsigned int reg, unsigned int value)
56 dev_dbg(ili->dev, "write: reg=%02x, val=%04x\n", reg, value); 56 dev_dbg(ili->dev, "write: reg=%02x, val=%04x\n", reg, value);
57 return ili->write(ili, reg, value); 57 return ili->write(ili, reg, value);
58} 58}
59
60EXPORT_SYMBOL_GPL(ili9320_write); 59EXPORT_SYMBOL_GPL(ili9320_write);
61 60
62int ili9320_write_regs(struct ili9320 *ili, 61int ili9320_write_regs(struct ili9320 *ili,
63 struct ili9320_reg *values, 62 const struct ili9320_reg *values,
64 int nr_values) 63 int nr_values)
65{ 64{
66 int index; 65 int index;
@@ -74,7 +73,6 @@ int ili9320_write_regs(struct ili9320 *ili,
74 73
75 return 0; 74 return 0;
76} 75}
77
78EXPORT_SYMBOL_GPL(ili9320_write_regs); 76EXPORT_SYMBOL_GPL(ili9320_write_regs);
79 77
80static void ili9320_reset(struct ili9320 *lcd) 78static void ili9320_reset(struct ili9320 *lcd)
@@ -260,7 +258,6 @@ int ili9320_probe_spi(struct spi_device *spi,
260 258
261 return ret; 259 return ret;
262} 260}
263
264EXPORT_SYMBOL_GPL(ili9320_probe_spi); 261EXPORT_SYMBOL_GPL(ili9320_probe_spi);
265 262
266int ili9320_remove(struct ili9320 *ili) 263int ili9320_remove(struct ili9320 *ili)
@@ -271,7 +268,6 @@ int ili9320_remove(struct ili9320 *ili)
271 268
272 return 0; 269 return 0;
273} 270}
274
275EXPORT_SYMBOL_GPL(ili9320_remove); 271EXPORT_SYMBOL_GPL(ili9320_remove);
276 272
277#ifdef CONFIG_PM 273#ifdef CONFIG_PM
@@ -296,20 +292,17 @@ int ili9320_suspend(struct ili9320 *lcd, pm_message_t state)
296 292
297 return 0; 293 return 0;
298} 294}
299
300EXPORT_SYMBOL_GPL(ili9320_suspend); 295EXPORT_SYMBOL_GPL(ili9320_suspend);
301 296
302int ili9320_resume(struct ili9320 *lcd) 297int ili9320_resume(struct ili9320 *lcd)
303{ 298{
304 dev_info(lcd->dev, "resuming from power state %d\n", lcd->power); 299 dev_info(lcd->dev, "resuming from power state %d\n", lcd->power);
305 300
306 if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP) { 301 if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP)
307 ili9320_write(lcd, ILI9320_POWER1, 0x00); 302 ili9320_write(lcd, ILI9320_POWER1, 0x00);
308 }
309 303
310 return ili9320_power(lcd, FB_BLANK_UNBLANK); 304 return ili9320_power(lcd, FB_BLANK_UNBLANK);
311} 305}
312
313EXPORT_SYMBOL_GPL(ili9320_resume); 306EXPORT_SYMBOL_GPL(ili9320_resume);
314#endif 307#endif
315 308
@@ -318,7 +311,6 @@ void ili9320_shutdown(struct ili9320 *lcd)
318{ 311{
319 ili9320_power(lcd, FB_BLANK_POWERDOWN); 312 ili9320_power(lcd, FB_BLANK_POWERDOWN);
320} 313}
321
322EXPORT_SYMBOL_GPL(ili9320_shutdown); 314EXPORT_SYMBOL_GPL(ili9320_shutdown);
323 315
324MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>"); 316MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
diff --git a/drivers/video/backlight/ili9320.h b/drivers/video/backlight/ili9320.h
index e388eca7cac5..e0db738f7bb9 100644
--- a/drivers/video/backlight/ili9320.h
+++ b/drivers/video/backlight/ili9320.h
@@ -63,7 +63,7 @@ extern int ili9320_write(struct ili9320 *ili,
63 unsigned int reg, unsigned int value); 63 unsigned int reg, unsigned int value);
64 64
65extern int ili9320_write_regs(struct ili9320 *ili, 65extern int ili9320_write_regs(struct ili9320 *ili,
66 struct ili9320_reg *values, 66 const struct ili9320_reg *values,
67 int nr_values); 67 int nr_values);
68 68
69/* Device probe */ 69/* Device probe */
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c
index 16f593b64427..fef6ce4fad71 100644
--- a/drivers/video/backlight/jornada720_bl.c
+++ b/drivers/video/backlight/jornada720_bl.c
@@ -48,7 +48,7 @@ static int jornada_bl_get_brightness(struct backlight_device *bd)
48 48
49 jornada_ssp_end(); 49 jornada_ssp_end();
50 50
51 return (BL_MAX_BRIGHT - ret); 51 return BL_MAX_BRIGHT - ret;
52} 52}
53 53
54static int jornada_bl_update_status(struct backlight_device *bd) 54static int jornada_bl_update_status(struct backlight_device *bd)
@@ -77,18 +77,23 @@ static int jornada_bl_update_status(struct backlight_device *bd)
77 goto out; 77 goto out;
78 } 78 }
79 79
80 /* at this point we expect that the mcu has accepted 80 /*
81 our command and is waiting for our new value 81 * at this point we expect that the mcu has accepted
82 please note that maximum brightness is 255, 82 * our command and is waiting for our new value
83 but due to physical layout it is equal to 0, so we simply 83 * please note that maximum brightness is 255,
84 invert the value (MAX VALUE - NEW VALUE). */ 84 * but due to physical layout it is equal to 0, so we simply
85 if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness) != TXDUMMY) { 85 * invert the value (MAX VALUE - NEW VALUE).
86 */
87 if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness)
88 != TXDUMMY) {
86 pr_err("set brightness failed\n"); 89 pr_err("set brightness failed\n");
87 ret = -ETIMEDOUT; 90 ret = -ETIMEDOUT;
88 } 91 }
89 92
90 /* If infact we get an TXDUMMY as output we are happy and dont 93 /*
91 make any further comments about it */ 94 * If infact we get an TXDUMMY as output we are happy and dont
95 * make any further comments about it
96 */
92out: 97out:
93 jornada_ssp_end(); 98 jornada_ssp_end();
94 99
@@ -121,9 +126,11 @@ static int jornada_bl_probe(struct platform_device *pdev)
121 126
122 bd->props.power = FB_BLANK_UNBLANK; 127 bd->props.power = FB_BLANK_UNBLANK;
123 bd->props.brightness = BL_DEF_BRIGHT; 128 bd->props.brightness = BL_DEF_BRIGHT;
124 /* note. make sure max brightness is set otherwise 129 /*
125 you will get seemingly non-related errors when 130 * note. make sure max brightness is set otherwise
126 trying to change brightness */ 131 * you will get seemingly non-related errors when
132 * trying to change brightness
133 */
127 jornada_bl_update_status(bd); 134 jornada_bl_update_status(bd);
128 135
129 platform_set_drvdata(pdev, bd); 136 platform_set_drvdata(pdev, bd);
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index f5aa0a5961d6..9a35196d12d7 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -4,7 +4,7 @@
4 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved. 4 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
5 * 5 *
6 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> 6 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
7 * Inspired by Marek Vasut work in l4f00242t03.c 7 * Inspired by Marek Vasut work in l4f00242t03.c
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 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 10 * it under the terms of the GNU General Public License version 2 as
@@ -33,7 +33,6 @@ struct l4f00242t03_priv {
33 struct regulator *core_reg; 33 struct regulator *core_reg;
34}; 34};
35 35
36
37static void l4f00242t03_reset(unsigned int gpio) 36static void l4f00242t03_reset(unsigned int gpio)
38{ 37{
39 pr_debug("l4f00242t03_reset.\n"); 38 pr_debug("l4f00242t03_reset.\n");
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index a5d0d024bb92..34fb6bd798c8 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -108,7 +108,7 @@ static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr,
108static ssize_t lcd_store_power(struct device *dev, 108static ssize_t lcd_store_power(struct device *dev,
109 struct device_attribute *attr, const char *buf, size_t count) 109 struct device_attribute *attr, const char *buf, size_t count)
110{ 110{
111 int rc = -ENXIO; 111 int rc;
112 struct lcd_device *ld = to_lcd_device(dev); 112 struct lcd_device *ld = to_lcd_device(dev);
113 unsigned long power; 113 unsigned long power;
114 114
@@ -116,6 +116,8 @@ static ssize_t lcd_store_power(struct device *dev,
116 if (rc) 116 if (rc)
117 return rc; 117 return rc;
118 118
119 rc = -ENXIO;
120
119 mutex_lock(&ld->ops_lock); 121 mutex_lock(&ld->ops_lock);
120 if (ld->ops && ld->ops->set_power) { 122 if (ld->ops && ld->ops->set_power) {
121 pr_debug("set power to %lu\n", power); 123 pr_debug("set power to %lu\n", power);
@@ -144,7 +146,7 @@ static ssize_t lcd_show_contrast(struct device *dev,
144static ssize_t lcd_store_contrast(struct device *dev, 146static ssize_t lcd_store_contrast(struct device *dev,
145 struct device_attribute *attr, const char *buf, size_t count) 147 struct device_attribute *attr, const char *buf, size_t count)
146{ 148{
147 int rc = -ENXIO; 149 int rc;
148 struct lcd_device *ld = to_lcd_device(dev); 150 struct lcd_device *ld = to_lcd_device(dev);
149 unsigned long contrast; 151 unsigned long contrast;
150 152
@@ -152,6 +154,8 @@ static ssize_t lcd_store_contrast(struct device *dev,
152 if (rc) 154 if (rc)
153 return rc; 155 return rc;
154 156
157 rc = -ENXIO;
158
155 mutex_lock(&ld->ops_lock); 159 mutex_lock(&ld->ops_lock);
156 if (ld->ops && ld->ops->set_contrast) { 160 if (ld->ops && ld->ops->set_contrast) {
157 pr_debug("set contrast to %lu\n", contrast); 161 pr_debug("set contrast to %lu\n", contrast);
diff --git a/drivers/video/backlight/lm3630_bl.c b/drivers/video/backlight/lm3630_bl.c
index 0207bc0a4407..a6d637b5c68f 100644
--- a/drivers/video/backlight/lm3630_bl.c
+++ b/drivers/video/backlight/lm3630_bl.c
@@ -37,7 +37,7 @@ enum lm3630_leds {
37 BLED_2 37 BLED_2
38}; 38};
39 39
40static const char *bled_name[] = { 40static const char * const bled_name[] = {
41 [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */ 41 [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */
42 [BLED_1] = "lm3630_bled1", /*Bank1 controls bled1 */ 42 [BLED_1] = "lm3630_bled1", /*Bank1 controls bled1 */
43 [BLED_2] = "lm3630_bled2", /*Bank1 or 2 controls bled2 */ 43 [BLED_2] = "lm3630_bled2", /*Bank1 or 2 controls bled2 */
diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
index b0e1e8ba4d9f..7ab2d2a04e41 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -214,7 +214,7 @@ out_input:
214 214
215} 215}
216 216
217static DEVICE_ATTR(bled_mode, 0666, NULL, lm3639_bled_mode_store); 217static DEVICE_ATTR(bled_mode, S_IWUSR, NULL, lm3639_bled_mode_store);
218 218
219/* torch */ 219/* torch */
220static void lm3639_torch_brightness_set(struct led_classdev *cdev, 220static void lm3639_torch_brightness_set(struct led_classdev *cdev,
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
index b29c7071c9db..55819b384701 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -31,7 +31,7 @@ struct lms283gf05_seq {
31}; 31};
32 32
33/* Magic sequences supplied by manufacturer, for details refer to datasheet */ 33/* Magic sequences supplied by manufacturer, for details refer to datasheet */
34static struct lms283gf05_seq disp_initseq[] = { 34static const struct lms283gf05_seq disp_initseq[] = {
35 /* REG, VALUE, DELAY */ 35 /* REG, VALUE, DELAY */
36 { 0x07, 0x0000, 0 }, 36 { 0x07, 0x0000, 0 },
37 { 0x13, 0x0000, 10 }, 37 { 0x13, 0x0000, 10 },
@@ -78,7 +78,7 @@ static struct lms283gf05_seq disp_initseq[] = {
78 { 0x22, 0x0000, 0 } 78 { 0x22, 0x0000, 0 }
79}; 79};
80 80
81static struct lms283gf05_seq disp_pdwnseq[] = { 81static const struct lms283gf05_seq disp_pdwnseq[] = {
82 { 0x07, 0x0016, 30 }, 82 { 0x07, 0x0016, 30 },
83 83
84 { 0x07, 0x0004, 0 }, 84 { 0x07, 0x0004, 0 },
@@ -104,7 +104,7 @@ static void lms283gf05_reset(unsigned long gpio, bool inverted)
104} 104}
105 105
106static void lms283gf05_toggle(struct spi_device *spi, 106static void lms283gf05_toggle(struct spi_device *spi,
107 struct lms283gf05_seq *seq, int sz) 107 const struct lms283gf05_seq *seq, int sz)
108{ 108{
109 char buf[3]; 109 char buf[3];
110 int i; 110 int i;
@@ -158,13 +158,10 @@ static int lms283gf05_probe(struct spi_device *spi)
158 int ret = 0; 158 int ret = 0;
159 159
160 if (pdata != NULL) { 160 if (pdata != NULL) {
161 ret = devm_gpio_request(&spi->dev, pdata->reset_gpio, 161 ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
162 "LMS285GF05 RESET"); 162 GPIOF_DIR_OUT | (!pdata->reset_inverted ?
163 if (ret) 163 GPIOF_INIT_HIGH : GPIOF_INIT_LOW),
164 return ret; 164 "LMS285GF05 RESET");
165
166 ret = gpio_direction_output(pdata->reset_gpio,
167 !pdata->reset_inverted);
168 if (ret) 165 if (ret)
169 return ret; 166 return ret;
170 } 167 }
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index fd985e0681e9..6e4db0c874c8 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -15,6 +15,7 @@
15#include <linux/backlight.h> 15#include <linux/backlight.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/platform_data/lp855x.h> 17#include <linux/platform_data/lp855x.h>
18#include <linux/pwm.h>
18 19
19/* Registers */ 20/* Registers */
20#define BRIGHTNESS_CTRL 0x00 21#define BRIGHTNESS_CTRL 0x00
@@ -34,22 +35,19 @@ struct lp855x {
34 struct i2c_client *client; 35 struct i2c_client *client;
35 struct backlight_device *bl; 36 struct backlight_device *bl;
36 struct device *dev; 37 struct device *dev;
37 struct mutex xfer_lock;
38 struct lp855x_platform_data *pdata; 38 struct lp855x_platform_data *pdata;
39 struct pwm_device *pwm;
39}; 40};
40 41
41static int lp855x_read_byte(struct lp855x *lp, u8 reg, u8 *data) 42static int lp855x_read_byte(struct lp855x *lp, u8 reg, u8 *data)
42{ 43{
43 int ret; 44 int ret;
44 45
45 mutex_lock(&lp->xfer_lock);
46 ret = i2c_smbus_read_byte_data(lp->client, reg); 46 ret = i2c_smbus_read_byte_data(lp->client, reg);
47 if (ret < 0) { 47 if (ret < 0) {
48 mutex_unlock(&lp->xfer_lock);
49 dev_err(lp->dev, "failed to read 0x%.2x\n", reg); 48 dev_err(lp->dev, "failed to read 0x%.2x\n", reg);
50 return ret; 49 return ret;
51 } 50 }
52 mutex_unlock(&lp->xfer_lock);
53 51
54 *data = (u8)ret; 52 *data = (u8)ret;
55 return 0; 53 return 0;
@@ -57,13 +55,7 @@ static int lp855x_read_byte(struct lp855x *lp, u8 reg, u8 *data)
57 55
58static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data) 56static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
59{ 57{
60 int ret; 58 return i2c_smbus_write_byte_data(lp->client, reg, data);
61
62 mutex_lock(&lp->xfer_lock);
63 ret = i2c_smbus_write_byte_data(lp->client, reg, data);
64 mutex_unlock(&lp->xfer_lock);
65
66 return ret;
67} 59}
68 60
69static bool lp855x_is_valid_rom_area(struct lp855x *lp, u8 addr) 61static bool lp855x_is_valid_rom_area(struct lp855x *lp, u8 addr)
@@ -121,6 +113,28 @@ static int lp855x_init_registers(struct lp855x *lp)
121 return ret; 113 return ret;
122} 114}
123 115
116static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
117{
118 unsigned int period = lp->pdata->period_ns;
119 unsigned int duty = br * period / max_br;
120 struct pwm_device *pwm;
121
122 /* request pwm device with the consumer name */
123 if (!lp->pwm) {
124 pwm = devm_pwm_get(lp->dev, lp->chipname);
125 if (IS_ERR(pwm))
126 return;
127
128 lp->pwm = pwm;
129 }
130
131 pwm_config(lp->pwm, duty, period);
132 if (duty)
133 pwm_enable(lp->pwm);
134 else
135 pwm_disable(lp->pwm);
136}
137
124static int lp855x_bl_update_status(struct backlight_device *bl) 138static int lp855x_bl_update_status(struct backlight_device *bl)
125{ 139{
126 struct lp855x *lp = bl_get_data(bl); 140 struct lp855x *lp = bl_get_data(bl);
@@ -130,12 +144,10 @@ static int lp855x_bl_update_status(struct backlight_device *bl)
130 bl->props.brightness = 0; 144 bl->props.brightness = 0;
131 145
132 if (mode == PWM_BASED) { 146 if (mode == PWM_BASED) {
133 struct lp855x_pwm_data *pd = &lp->pdata->pwm_data;
134 int br = bl->props.brightness; 147 int br = bl->props.brightness;
135 int max_br = bl->props.max_brightness; 148 int max_br = bl->props.max_brightness;
136 149
137 if (pd->pwm_set_intensity) 150 lp855x_pwm_ctrl(lp, br, max_br);
138 pd->pwm_set_intensity(br, max_br);
139 151
140 } else if (mode == REGISTER_BASED) { 152 } else if (mode == REGISTER_BASED) {
141 u8 val = bl->props.brightness; 153 u8 val = bl->props.brightness;
@@ -150,14 +162,7 @@ static int lp855x_bl_get_brightness(struct backlight_device *bl)
150 struct lp855x *lp = bl_get_data(bl); 162 struct lp855x *lp = bl_get_data(bl);
151 enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode; 163 enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode;
152 164
153 if (mode == PWM_BASED) { 165 if (mode == REGISTER_BASED) {
154 struct lp855x_pwm_data *pd = &lp->pdata->pwm_data;
155 int max_br = bl->props.max_brightness;
156
157 if (pd->pwm_get_intensity)
158 bl->props.brightness = pd->pwm_get_intensity(max_br);
159
160 } else if (mode == REGISTER_BASED) {
161 u8 val = 0; 166 u8 val = 0;
162 167
163 lp855x_read_byte(lp, BRIGHTNESS_CTRL, &val); 168 lp855x_read_byte(lp, BRIGHTNESS_CTRL, &val);
@@ -266,8 +271,6 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
266 lp->chip_id = id->driver_data; 271 lp->chip_id = id->driver_data;
267 i2c_set_clientdata(cl, lp); 272 i2c_set_clientdata(cl, lp);
268 273
269 mutex_init(&lp->xfer_lock);
270
271 ret = lp855x_init_registers(lp); 274 ret = lp855x_init_registers(lp);
272 if (ret) { 275 if (ret) {
273 dev_err(lp->dev, "i2c communication err: %d", ret); 276 dev_err(lp->dev, "i2c communication err: %d", ret);
diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c
index c6bec7aab87b..2c9bce050aa9 100644
--- a/drivers/video/backlight/max8925_bl.c
+++ b/drivers/video/backlight/max8925_bl.c
@@ -120,15 +120,13 @@ static int max8925_backlight_probe(struct platform_device *pdev)
120 res = platform_get_resource(pdev, IORESOURCE_REG, 0); 120 res = platform_get_resource(pdev, IORESOURCE_REG, 0);
121 if (!res) { 121 if (!res) {
122 dev_err(&pdev->dev, "No REG resource for mode control!\n"); 122 dev_err(&pdev->dev, "No REG resource for mode control!\n");
123 ret = -ENXIO; 123 return -ENXIO;
124 goto out;
125 } 124 }
126 data->reg_mode_cntl = res->start; 125 data->reg_mode_cntl = res->start;
127 res = platform_get_resource(pdev, IORESOURCE_REG, 1); 126 res = platform_get_resource(pdev, IORESOURCE_REG, 1);
128 if (!res) { 127 if (!res) {
129 dev_err(&pdev->dev, "No REG resource for control!\n"); 128 dev_err(&pdev->dev, "No REG resource for control!\n");
130 ret = -ENXIO; 129 return -ENXIO;
131 goto out;
132 } 130 }
133 data->reg_cntl = res->start; 131 data->reg_cntl = res->start;
134 132
@@ -142,8 +140,7 @@ static int max8925_backlight_probe(struct platform_device *pdev)
142 &max8925_backlight_ops, &props); 140 &max8925_backlight_ops, &props);
143 if (IS_ERR(bl)) { 141 if (IS_ERR(bl)) {
144 dev_err(&pdev->dev, "failed to register backlight\n"); 142 dev_err(&pdev->dev, "failed to register backlight\n");
145 ret = PTR_ERR(bl); 143 return PTR_ERR(bl);
146 goto out;
147 } 144 }
148 bl->props.brightness = MAX_BRIGHTNESS; 145 bl->props.brightness = MAX_BRIGHTNESS;
149 146
@@ -166,8 +163,6 @@ static int max8925_backlight_probe(struct platform_device *pdev)
166 return 0; 163 return 0;
167out_brt: 164out_brt:
168 backlight_device_unregister(bl); 165 backlight_device_unregister(bl);
169out:
170 devm_kfree(&pdev->dev, data);
171 return ret; 166 return ret;
172} 167}
173 168
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c
index 9a046a4c98f5..af31c269baa6 100644
--- a/drivers/video/backlight/omap1_bl.c
+++ b/drivers/video/backlight/omap1_bl.c
@@ -42,12 +42,12 @@ struct omap_backlight {
42 struct omap_backlight_config *pdata; 42 struct omap_backlight_config *pdata;
43}; 43};
44 44
45static void inline omapbl_send_intensity(int intensity) 45static inline void omapbl_send_intensity(int intensity)
46{ 46{
47 omap_writeb(intensity, OMAP_PWL_ENABLE); 47 omap_writeb(intensity, OMAP_PWL_ENABLE);
48} 48}
49 49
50static void inline omapbl_send_enable(int enable) 50static inline void omapbl_send_enable(int enable)
51{ 51{
52 omap_writeb(enable, OMAP_PWL_CLK_ENABLE); 52 omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
53} 53}
diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c
index 4ec30748b447..633b0a22fd64 100644
--- a/drivers/video/backlight/pandora_bl.c
+++ b/drivers/video/backlight/pandora_bl.c
@@ -71,8 +71,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
71 * set PWM duty cycle to max. TPS61161 seems to use this 71 * set PWM duty cycle to max. TPS61161 seems to use this
72 * to calibrate it's PWM sensitivity when it starts. 72 * to calibrate it's PWM sensitivity when it starts.
73 */ 73 */
74 twl_i2c_write_u8(TWL4030_MODULE_PWM0, MAX_VALUE, 74 twl_i2c_write_u8(TWL_MODULE_PWM, MAX_VALUE, TWL_PWM0_OFF);
75 TWL_PWM0_OFF);
76 75
77 /* first enable clock, then PWM0 out */ 76 /* first enable clock, then PWM0 out */
78 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1); 77 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1);
@@ -90,8 +89,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
90 usleep_range(2000, 10000); 89 usleep_range(2000, 10000);
91 } 90 }
92 91
93 twl_i2c_write_u8(TWL4030_MODULE_PWM0, MIN_VALUE + brightness, 92 twl_i2c_write_u8(TWL_MODULE_PWM, MIN_VALUE + brightness, TWL_PWM0_OFF);
94 TWL_PWM0_OFF);
95 93
96done: 94done:
97 if (brightness != 0) 95 if (brightness != 0)
@@ -132,7 +130,7 @@ static int pandora_backlight_probe(struct platform_device *pdev)
132 platform_set_drvdata(pdev, bl); 130 platform_set_drvdata(pdev, bl);
133 131
134 /* 64 cycle period, ON position 0 */ 132 /* 64 cycle period, ON position 0 */
135 twl_i2c_write_u8(TWL4030_MODULE_PWM0, 0x80, TWL_PWM0_ON); 133 twl_i2c_write_u8(TWL_MODULE_PWM, 0x80, TWL_PWM0_ON);
136 134
137 bl->props.state |= PANDORABL_WAS_OFF; 135 bl->props.state |= PANDORABL_WAS_OFF;
138 bl->props.brightness = MAX_USER_VALUE; 136 bl->props.brightness = MAX_USER_VALUE;
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c
index 0087396007e4..e87c7a3394f3 100644
--- a/drivers/video/backlight/pcf50633-backlight.c
+++ b/drivers/video/backlight/pcf50633-backlight.c
@@ -52,7 +52,7 @@ int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit)
52 pcf_bl->brightness_limit = limit & 0x3f; 52 pcf_bl->brightness_limit = limit & 0x3f;
53 backlight_update_status(pcf_bl->bl); 53 backlight_update_status(pcf_bl->bl);
54 54
55 return 0; 55 return 0;
56} 56}
57 57
58static int pcf50633_bl_update_status(struct backlight_device *bl) 58static int pcf50633_bl_update_status(struct backlight_device *bl)
@@ -136,8 +136,10 @@ static int pcf50633_bl_probe(struct platform_device *pdev)
136 136
137 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDDIM, pdata->ramp_time); 137 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDDIM, pdata->ramp_time);
138 138
139 /* Should be different from bl_props.brightness, so we do not exit 139 /*
140 * update_status early the first time it's called */ 140 * Should be different from bl_props.brightness, so we do not exit
141 * update_status early the first time it's called
142 */
141 pcf_bl->brightness = pcf_bl->bl->props.brightness + 1; 143 pcf_bl->brightness = pcf_bl->bl->props.brightness + 1;
142 144
143 backlight_update_status(pcf_bl->bl); 145 backlight_update_status(pcf_bl->bl);
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index 894bfc5ce422..17a6b83f97af 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -27,7 +27,7 @@ struct platform_lcd {
27 struct plat_lcd_data *pdata; 27 struct plat_lcd_data *pdata;
28 28
29 unsigned int power; 29 unsigned int power;
30 unsigned int suspended : 1; 30 unsigned int suspended:1;
31}; 31};
32 32
33static inline struct platform_lcd *to_our_lcd(struct lcd_device *lcd) 33static inline struct platform_lcd *to_our_lcd(struct lcd_device *lcd)
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
index 484e10dd1a8e..3e1c1135f6df 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -757,7 +757,7 @@ static int s6e63m0_probe(struct spi_device *spi)
757 lcd->spi = spi; 757 lcd->spi = spi;
758 lcd->dev = &spi->dev; 758 lcd->dev = &spi->dev;
759 759
760 lcd->lcd_pd = (struct lcd_platform_data *)spi->dev.platform_data; 760 lcd->lcd_pd = spi->dev.platform_data;
761 if (!lcd->lcd_pd) { 761 if (!lcd->lcd_pd) {
762 dev_err(&spi->dev, "platform data is NULL.\n"); 762 dev_err(&spi->dev, "platform data is NULL.\n");
763 return -EFAULT; 763 return -EFAULT;
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 146ffb9404d1..ad2325f3d652 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -2,7 +2,7 @@
2 * tdo24m - SPI-based drivers for Toppoly TDO24M series LCD panels 2 * tdo24m - SPI-based drivers for Toppoly TDO24M series LCD panels
3 * 3 *
4 * Copyright (C) 2008 Marvell International Ltd. 4 * Copyright (C) 2008 Marvell International Ltd.
5 * Eric Miao <eric.miao@marvell.com> 5 * Eric Miao <eric.miao@marvell.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -47,7 +47,7 @@ struct tdo24m {
47 ((x1) << 9) | 0x100 | (x2)) 47 ((x1) << 9) | 0x100 | (x2))
48#define CMD_NULL (-1) 48#define CMD_NULL (-1)
49 49
50static uint32_t lcd_panel_reset[] = { 50static const uint32_t lcd_panel_reset[] = {
51 CMD0(0x1), /* reset */ 51 CMD0(0x1), /* reset */
52 CMD0(0x0), /* nop */ 52 CMD0(0x0), /* nop */
53 CMD0(0x0), /* nop */ 53 CMD0(0x0), /* nop */
@@ -55,7 +55,7 @@ static uint32_t lcd_panel_reset[] = {
55 CMD_NULL, 55 CMD_NULL,
56}; 56};
57 57
58static uint32_t lcd_panel_on[] = { 58static const uint32_t lcd_panel_on[] = {
59 CMD0(0x29), /* Display ON */ 59 CMD0(0x29), /* Display ON */
60 CMD2(0xB8, 0xFF, 0xF9), /* Output Control */ 60 CMD2(0xB8, 0xFF, 0xF9), /* Output Control */
61 CMD0(0x11), /* Sleep out */ 61 CMD0(0x11), /* Sleep out */
@@ -63,7 +63,7 @@ static uint32_t lcd_panel_on[] = {
63 CMD_NULL, 63 CMD_NULL,
64}; 64};
65 65
66static uint32_t lcd_panel_off[] = { 66static const uint32_t lcd_panel_off[] = {
67 CMD0(0x28), /* Display OFF */ 67 CMD0(0x28), /* Display OFF */
68 CMD2(0xB8, 0x80, 0x02), /* Output Control */ 68 CMD2(0xB8, 0x80, 0x02), /* Output Control */
69 CMD0(0x10), /* Sleep in */ 69 CMD0(0x10), /* Sleep in */
@@ -71,7 +71,7 @@ static uint32_t lcd_panel_off[] = {
71 CMD_NULL, 71 CMD_NULL,
72}; 72};
73 73
74static uint32_t lcd_vga_pass_through_tdo24m[] = { 74static const uint32_t lcd_vga_pass_through_tdo24m[] = {
75 CMD1(0xB0, 0x16), 75 CMD1(0xB0, 0x16),
76 CMD1(0xBC, 0x80), 76 CMD1(0xBC, 0x80),
77 CMD1(0xE1, 0x00), 77 CMD1(0xE1, 0x00),
@@ -80,7 +80,7 @@ static uint32_t lcd_vga_pass_through_tdo24m[] = {
80 CMD_NULL, 80 CMD_NULL,
81}; 81};
82 82
83static uint32_t lcd_qvga_pass_through_tdo24m[] = { 83static const uint32_t lcd_qvga_pass_through_tdo24m[] = {
84 CMD1(0xB0, 0x16), 84 CMD1(0xB0, 0x16),
85 CMD1(0xBC, 0x81), 85 CMD1(0xBC, 0x81),
86 CMD1(0xE1, 0x00), 86 CMD1(0xE1, 0x00),
@@ -89,8 +89,8 @@ static uint32_t lcd_qvga_pass_through_tdo24m[] = {
89 CMD_NULL, 89 CMD_NULL,
90}; 90};
91 91
92static uint32_t lcd_vga_transfer_tdo24m[] = { 92static const uint32_t lcd_vga_transfer_tdo24m[] = {
93 CMD1(0xcf, 0x02), /* Blanking period control (1) */ 93 CMD1(0xcf, 0x02), /* Blanking period control (1) */
94 CMD2(0xd0, 0x08, 0x04), /* Blanking period control (2) */ 94 CMD2(0xd0, 0x08, 0x04), /* Blanking period control (2) */
95 CMD1(0xd1, 0x01), /* CKV timing control on/off */ 95 CMD1(0xd1, 0x01), /* CKV timing control on/off */
96 CMD2(0xd2, 0x14, 0x00), /* CKV 1,2 timing control */ 96 CMD2(0xd2, 0x14, 0x00), /* CKV 1,2 timing control */
@@ -102,7 +102,7 @@ static uint32_t lcd_vga_transfer_tdo24m[] = {
102 CMD_NULL, 102 CMD_NULL,
103}; 103};
104 104
105static uint32_t lcd_qvga_transfer[] = { 105static const uint32_t lcd_qvga_transfer[] = {
106 CMD1(0xd6, 0x02), /* Blanking period control (1) */ 106 CMD1(0xd6, 0x02), /* Blanking period control (1) */
107 CMD2(0xd7, 0x08, 0x04), /* Blanking period control (2) */ 107 CMD2(0xd7, 0x08, 0x04), /* Blanking period control (2) */
108 CMD1(0xd8, 0x01), /* CKV timing control on/off */ 108 CMD1(0xd8, 0x01), /* CKV timing control on/off */
@@ -115,7 +115,7 @@ static uint32_t lcd_qvga_transfer[] = {
115 CMD_NULL, 115 CMD_NULL,
116}; 116};
117 117
118static uint32_t lcd_vga_pass_through_tdo35s[] = { 118static const uint32_t lcd_vga_pass_through_tdo35s[] = {
119 CMD1(0xB0, 0x16), 119 CMD1(0xB0, 0x16),
120 CMD1(0xBC, 0x80), 120 CMD1(0xBC, 0x80),
121 CMD1(0xE1, 0x00), 121 CMD1(0xE1, 0x00),
@@ -123,7 +123,7 @@ static uint32_t lcd_vga_pass_through_tdo35s[] = {
123 CMD_NULL, 123 CMD_NULL,
124}; 124};
125 125
126static uint32_t lcd_qvga_pass_through_tdo35s[] = { 126static const uint32_t lcd_qvga_pass_through_tdo35s[] = {
127 CMD1(0xB0, 0x16), 127 CMD1(0xB0, 0x16),
128 CMD1(0xBC, 0x81), 128 CMD1(0xBC, 0x81),
129 CMD1(0xE1, 0x00), 129 CMD1(0xE1, 0x00),
@@ -131,8 +131,8 @@ static uint32_t lcd_qvga_pass_through_tdo35s[] = {
131 CMD_NULL, 131 CMD_NULL,
132}; 132};
133 133
134static uint32_t lcd_vga_transfer_tdo35s[] = { 134static const uint32_t lcd_vga_transfer_tdo35s[] = {
135 CMD1(0xcf, 0x02), /* Blanking period control (1) */ 135 CMD1(0xcf, 0x02), /* Blanking period control (1) */
136 CMD2(0xd0, 0x08, 0x04), /* Blanking period control (2) */ 136 CMD2(0xd0, 0x08, 0x04), /* Blanking period control (2) */
137 CMD1(0xd1, 0x01), /* CKV timing control on/off */ 137 CMD1(0xd1, 0x01), /* CKV timing control on/off */
138 CMD2(0xd2, 0x00, 0x1e), /* CKV 1,2 timing control */ 138 CMD2(0xd2, 0x00, 0x1e), /* CKV 1,2 timing control */
@@ -144,7 +144,7 @@ static uint32_t lcd_vga_transfer_tdo35s[] = {
144 CMD_NULL, 144 CMD_NULL,
145}; 145};
146 146
147static uint32_t lcd_panel_config[] = { 147static const uint32_t lcd_panel_config[] = {
148 CMD2(0xb8, 0xff, 0xf9), /* Output control */ 148 CMD2(0xb8, 0xff, 0xf9), /* Output control */
149 CMD0(0x11), /* sleep out */ 149 CMD0(0x11), /* sleep out */
150 CMD1(0xba, 0x01), /* Display mode (1) */ 150 CMD1(0xba, 0x01), /* Display mode (1) */
@@ -175,10 +175,11 @@ static uint32_t lcd_panel_config[] = {
175 CMD_NULL, 175 CMD_NULL,
176}; 176};
177 177
178static int tdo24m_writes(struct tdo24m *lcd, uint32_t *array) 178static int tdo24m_writes(struct tdo24m *lcd, const uint32_t *array)
179{ 179{
180 struct spi_transfer *x = &lcd->xfer; 180 struct spi_transfer *x = &lcd->xfer;
181 uint32_t data, *p = array; 181 const uint32_t *p = array;
182 uint32_t data;
182 int nparams, err = 0; 183 int nparams, err = 0;
183 184
184 for (; *p != CMD_NULL; p++) { 185 for (; *p != CMD_NULL; p++) {
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index a0521abdcd8a..588682cc1614 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -92,14 +92,12 @@ static int tosa_bl_probe(struct i2c_client *client,
92 92
93 data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj; 93 data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj;
94 94
95 ret = devm_gpio_request(&client->dev, TOSA_GPIO_BL_C20MA, "backlight"); 95 ret = devm_gpio_request_one(&client->dev, TOSA_GPIO_BL_C20MA,
96 GPIOF_OUT_INIT_LOW, "backlight");
96 if (ret) { 97 if (ret) {
97 dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); 98 dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
98 return ret; 99 return ret;
99 } 100 }
100 ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0);
101 if (ret)
102 return ret;
103 101
104 i2c_set_clientdata(client, data); 102 i2c_set_clientdata(client, data);
105 data->i2c = client; 103 data->i2c = client;
@@ -163,7 +161,6 @@ static const struct i2c_device_id tosa_bl_id[] = {
163 { }, 161 { },
164}; 162};
165 163
166
167static struct i2c_driver tosa_bl_driver = { 164static struct i2c_driver tosa_bl_driver = {
168 .driver = { 165 .driver = {
169 .name = "tosa-bl", 166 .name = "tosa-bl",
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 86fff88c2e4a..96bae941585a 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -63,7 +63,7 @@ static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data)
63int tosa_bl_enable(struct spi_device *spi, int enable) 63int tosa_bl_enable(struct spi_device *spi, int enable)
64{ 64{
65 /* bl_enable GP04=1 otherwise GP04=0*/ 65 /* bl_enable GP04=1 otherwise GP04=0*/
66 return tosa_tg_send(spi, TG_GPODR2, enable? 0x01 : 0x00); 66 return tosa_tg_send(spi, TG_GPODR2, enable ? 0x01 : 0x00);
67} 67}
68EXPORT_SYMBOL(tosa_bl_enable); 68EXPORT_SYMBOL(tosa_bl_enable);
69 69
@@ -91,15 +91,17 @@ static void tosa_lcd_tg_on(struct tosa_lcd_data *data)
91 tosa_tg_send(spi, TG_PNLCTL, value); 91 tosa_tg_send(spi, TG_PNLCTL, value);
92 92
93 /* TG LCD pannel power up */ 93 /* TG LCD pannel power up */
94 tosa_tg_send(spi, TG_PINICTL,0x4); 94 tosa_tg_send(spi, TG_PINICTL, 0x4);
95 mdelay(50); 95 mdelay(50);
96 96
97 /* TG LCD GVSS */ 97 /* TG LCD GVSS */
98 tosa_tg_send(spi, TG_PINICTL,0x0); 98 tosa_tg_send(spi, TG_PINICTL, 0x0);
99 99
100 if (!data->i2c) { 100 if (!data->i2c) {
101 /* after the pannel is powered up the first time, we can access the i2c bus */ 101 /*
102 /* so probe for the DAC */ 102 * after the pannel is powered up the first time,
103 * we can access the i2c bus so probe for the DAC
104 */
103 struct i2c_adapter *adap = i2c_get_adapter(0); 105 struct i2c_adapter *adap = i2c_get_adapter(0);
104 struct i2c_board_info info = { 106 struct i2c_board_info info = {
105 .type = "tosa-bl", 107 .type = "tosa-bl",
@@ -115,11 +117,11 @@ static void tosa_lcd_tg_off(struct tosa_lcd_data *data)
115 struct spi_device *spi = data->spi; 117 struct spi_device *spi = data->spi;
116 118
117 /* TG LCD VHSA off */ 119 /* TG LCD VHSA off */
118 tosa_tg_send(spi, TG_PINICTL,0x4); 120 tosa_tg_send(spi, TG_PINICTL, 0x4);
119 mdelay(50); 121 mdelay(50);
120 122
121 /* TG LCD signal off */ 123 /* TG LCD signal off */
122 tosa_tg_send(spi, TG_PINICTL,0x6); 124 tosa_tg_send(spi, TG_PINICTL, 0x6);
123 mdelay(50); 125 mdelay(50);
124 126
125 /* TG Off */ 127 /* TG Off */
@@ -193,17 +195,13 @@ static int tosa_lcd_probe(struct spi_device *spi)
193 data->spi = spi; 195 data->spi = spi;
194 dev_set_drvdata(&spi->dev, data); 196 dev_set_drvdata(&spi->dev, data);
195 197
196 ret = devm_gpio_request(&spi->dev, TOSA_GPIO_TG_ON, "tg #pwr"); 198 ret = devm_gpio_request_one(&spi->dev, TOSA_GPIO_TG_ON,
199 GPIOF_OUT_INIT_LOW, "tg #pwr");
197 if (ret < 0) 200 if (ret < 0)
198 goto err_gpio_tg; 201 goto err_gpio_tg;
199 202
200 mdelay(60); 203 mdelay(60);
201 204
202 ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0);
203 if (ret < 0)
204 goto err_gpio_tg;
205
206 mdelay(60);
207 tosa_lcd_tg_init(data); 205 tosa_lcd_tg_init(data);
208 206
209 tosa_lcd_tg_on(data); 207 tosa_lcd_tg_on(data);
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 712b0acfd339..45e81b4cf8b4 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -26,7 +26,7 @@
26 26
27/* Device initialisation sequences */ 27/* Device initialisation sequences */
28 28
29static struct ili9320_reg vgg_init1[] = { 29static const struct ili9320_reg vgg_init1[] = {
30 { 30 {
31 .address = ILI9320_POWER1, 31 .address = ILI9320_POWER1,
32 .value = ILI9320_POWER1_AP(0) | ILI9320_POWER1_BT(0), 32 .value = ILI9320_POWER1_AP(0) | ILI9320_POWER1_BT(0),
@@ -43,7 +43,7 @@ static struct ili9320_reg vgg_init1[] = {
43 }, 43 },
44}; 44};
45 45
46static struct ili9320_reg vgg_init2[] = { 46static const struct ili9320_reg vgg_init2[] = {
47 { 47 {
48 .address = ILI9320_POWER1, 48 .address = ILI9320_POWER1,
49 .value = (ILI9320_POWER1_AP(3) | ILI9320_POWER1_APE | 49 .value = (ILI9320_POWER1_AP(3) | ILI9320_POWER1_APE |
@@ -54,7 +54,7 @@ static struct ili9320_reg vgg_init2[] = {
54 } 54 }
55}; 55};
56 56
57static struct ili9320_reg vgg_gamma[] = { 57static const struct ili9320_reg vgg_gamma[] = {
58 { 58 {
59 .address = ILI9320_GAMMA1, 59 .address = ILI9320_GAMMA1,
60 .value = 0x0000, 60 .value = 0x0000,
@@ -89,7 +89,7 @@ static struct ili9320_reg vgg_gamma[] = {
89 89
90}; 90};
91 91
92static struct ili9320_reg vgg_init0[] = { 92static const struct ili9320_reg vgg_init0[] = {
93 [0] = { 93 [0] = {
94 /* set direction and scan mode gate */ 94 /* set direction and scan mode gate */
95 .address = ILI9320_DRIVER, 95 .address = ILI9320_DRIVER,
@@ -217,7 +217,7 @@ static int vgg2432a4_resume(struct spi_device *spi)
217} 217}
218#else 218#else
219#define vgg2432a4_suspend NULL 219#define vgg2432a4_suspend NULL
220#define vgg2432a4_resume NULL 220#define vgg2432a4_resume NULL
221#endif 221#endif
222 222
223static struct ili9320_client vgg2432a4_client = { 223static struct ili9320_client vgg2432a4_client = {