aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/arcfb.c4
-rw-r--r--drivers/video/atmel_lcdfb.c2
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/aty/radeon_base.c2
-rw-r--r--drivers/video/aty/radeon_monitor.c35
-rw-r--r--drivers/video/backlight/88pm860x_bl.c1
-rw-r--r--drivers/video/backlight/Kconfig2
-rw-r--r--drivers/video/backlight/atmel-pwm-bl.c19
-rw-r--r--drivers/video/backlight/corgi_lcd.c19
-rw-r--r--drivers/video/backlight/l4f00242t03.c29
-rw-r--r--drivers/video/backlight/lm3533_bl.c8
-rw-r--r--drivers/video/backlight/lms283gf05.c24
-rw-r--r--drivers/video/backlight/lp855x_bl.c10
-rw-r--r--drivers/video/backlight/ot200_bl.c21
-rw-r--r--drivers/video/backlight/pwm_bl.c159
-rw-r--r--drivers/video/backlight/tosa_bl.c8
-rw-r--r--drivers/video/backlight/tosa_lcd.c7
-rw-r--r--drivers/video/bfin_adv7393fb.c2
-rw-r--r--drivers/video/cirrusfb.c2
-rw-r--r--drivers/video/exynos/exynos_dp_reg.c2
-rw-r--r--drivers/video/exynos/exynos_mipi_dsi.c2
-rw-r--r--drivers/video/fb_defio.c2
-rw-r--r--drivers/video/i740fb.c6
-rw-r--r--drivers/video/mxsfb.c62
-rw-r--r--drivers/video/s3c-fb.c2
-rw-r--r--drivers/video/savage/savagefb_driver.c6
-rw-r--r--drivers/video/sis/init.c3
-rw-r--r--drivers/video/smscufx.c8
-rw-r--r--drivers/video/sunxvr500.c2
29 files changed, 294 insertions, 157 deletions
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index c22e8d39a2cb..a1d58e9d3073 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -336,8 +336,8 @@ static void arcfb_lcd_update_horiz(struct arcfb_par *par, unsigned int left,
336} 336}
337 337
338/* 338/*
339 * here we start the process of spliting out the fb update into 339 * here we start the process of splitting out the fb update into
340 * individual blocks of pixels. we end up spliting into 64x64 blocks 340 * individual blocks of pixels. we end up splitting into 64x64 blocks
341 * and finally down to 64x8 pages. 341 * and finally down to 64x8 pages.
342 */ 342 */
343static void arcfb_lcd_update(struct arcfb_par *par, unsigned int dx, 343static void arcfb_lcd_update(struct arcfb_par *par, unsigned int dx,
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index d99505b16374..15055395cd95 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -939,7 +939,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
939 * up a splash image. 939 * up a splash image.
940 */ 940 */
941 } else { 941 } else {
942 /* alocate memory buffer */ 942 /* allocate memory buffer */
943 ret = atmel_lcdfb_alloc_video_memory(sinfo); 943 ret = atmel_lcdfb_alloc_video_memory(sinfo);
944 if (ret < 0) { 944 if (ret < 0) {
945 dev_err(dev, "cannot allocate framebuffer: %d\n", ret); 945 dev_err(dev, "cannot allocate framebuffer: %d\n", ret);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 622f12b62a47..3f2e8c13f1ca 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -863,7 +863,7 @@ static int aty_var_to_crtc(const struct fb_info *info,
863 863
864 if ((xres > 1600) || (yres > 1200)) { 864 if ((xres > 1600) || (yres > 1200)) {
865 FAIL("MACH64 chips are designed for max 1600x1200\n" 865 FAIL("MACH64 chips are designed for max 1600x1200\n"
866 "select anoter resolution."); 866 "select another resolution.");
867 } 867 }
868 h_sync_strt = h_disp + var->right_margin; 868 h_sync_strt = h_disp + var->right_margin;
869 h_sync_end = h_sync_strt + var->hsync_len; 869 h_sync_end = h_sync_strt + var->hsync_len;
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index ce1506b75adf..9e279ee38da8 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2018,7 +2018,7 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo)
2018 if ((rinfo->family == CHIP_FAMILY_RS100) || 2018 if ((rinfo->family == CHIP_FAMILY_RS100) ||
2019 (rinfo->family == CHIP_FAMILY_RS200)) { 2019 (rinfo->family == CHIP_FAMILY_RS200)) {
2020 /* This is to workaround the asic bug for RMX, some versions 2020 /* This is to workaround the asic bug for RMX, some versions
2021 of BIOS dosen't have this register initialized correctly. 2021 of BIOS doesn't have this register initialized correctly.
2022 */ 2022 */
2023 OUTREGP(CRTC_MORE_CNTL, CRTC_H_CUTOFF_ACTIVE_EN, 2023 OUTREGP(CRTC_MORE_CNTL, CRTC_H_CUTOFF_ACTIVE_EN,
2024 ~CRTC_H_CUTOFF_ACTIVE_EN); 2024 ~CRTC_H_CUTOFF_ACTIVE_EN);
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
index 9261c918fde8..5c23eac0eb9a 100644
--- a/drivers/video/aty/radeon_monitor.c
+++ b/drivers/video/aty/radeon_monitor.c
@@ -730,6 +730,25 @@ static void radeon_videomode_to_var(struct fb_var_screeninfo *var,
730 var->vmode = mode->vmode; 730 var->vmode = mode->vmode;
731} 731}
732 732
733#ifdef CONFIG_PPC_PSERIES
734static int is_powerblade(const char *model)
735{
736 struct device_node *root;
737 const char* cp;
738 int len, l, rc = 0;
739
740 root = of_find_node_by_path("/");
741 if (root && model) {
742 l = strlen(model);
743 cp = of_get_property(root, "model", &len);
744 if (cp)
745 rc = memcmp(model, cp, min(len, l)) == 0;
746 of_node_put(root);
747 }
748 return rc;
749}
750#endif
751
733/* 752/*
734 * Build the modedb for head 1 (head 2 will come later), check panel infos 753 * Build the modedb for head 1 (head 2 will come later), check panel infos
735 * from either BIOS or EDID, and pick up the default mode 754 * from either BIOS or EDID, and pick up the default mode
@@ -865,6 +884,22 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_
865 has_default_mode = 1; 884 has_default_mode = 1;
866 } 885 }
867 886
887#ifdef CONFIG_PPC_PSERIES
888 if (!has_default_mode && (
889 is_powerblade("IBM,8842") || /* JS20 */
890 is_powerblade("IBM,8844") || /* JS21 */
891 is_powerblade("IBM,7998") || /* JS12/JS21/JS22 */
892 is_powerblade("IBM,0792") || /* QS21 */
893 is_powerblade("IBM,0793") /* QS22 */
894 )) {
895 printk("Falling back to 800x600 on JSxx hardware\n");
896 if (fb_find_mode(&info->var, info, "800x600@60",
897 info->monspecs.modedb,
898 info->monspecs.modedb_len, NULL, 8) != 0)
899 has_default_mode = 1;
900 }
901#endif
902
868 /* 903 /*
869 * Still no mode, let's pick up a default from the db 904 * Still no mode, let's pick up a default from the db
870 */ 905 */
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index f49181c73113..f75da8758adc 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -228,6 +228,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
228 data->port = pdata->flags; 228 data->port = pdata->flags;
229 if (data->port < 0) { 229 if (data->port < 0) {
230 dev_err(&pdev->dev, "wrong platform data is assigned"); 230 dev_err(&pdev->dev, "wrong platform data is assigned");
231 kfree(data);
231 return -EINVAL; 232 return -EINVAL;
232 } 233 }
233 234
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 2979292650d6..cf282763a8dc 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -245,7 +245,7 @@ config BACKLIGHT_CARILLO_RANCH
245 245
246config BACKLIGHT_PWM 246config BACKLIGHT_PWM
247 tristate "Generic PWM based Backlight Driver" 247 tristate "Generic PWM based Backlight Driver"
248 depends on HAVE_PWM 248 depends on PWM
249 help 249 help
250 If you have a LCD backlight adjustable by PWM, say Y to enable 250 If you have a LCD backlight adjustable by PWM, say Y to enable
251 this driver. 251 this driver.
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
index 0443a4f71858..df1cbb7ef6ca 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -127,7 +127,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
127 struct atmel_pwm_bl *pwmbl; 127 struct atmel_pwm_bl *pwmbl;
128 int retval; 128 int retval;
129 129
130 pwmbl = kzalloc(sizeof(struct atmel_pwm_bl), GFP_KERNEL); 130 pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl),
131 GFP_KERNEL);
131 if (!pwmbl) 132 if (!pwmbl)
132 return -ENOMEM; 133 return -ENOMEM;
133 134
@@ -154,7 +155,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
154 goto err_free_mem; 155 goto err_free_mem;
155 156
156 if (pwmbl->gpio_on != -1) { 157 if (pwmbl->gpio_on != -1) {
157 retval = gpio_request(pwmbl->gpio_on, "gpio_atmel_pwm_bl"); 158 retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on,
159 "gpio_atmel_pwm_bl");
158 if (retval) { 160 if (retval) {
159 pwmbl->gpio_on = -1; 161 pwmbl->gpio_on = -1;
160 goto err_free_pwm; 162 goto err_free_pwm;
@@ -164,7 +166,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
164 retval = gpio_direction_output(pwmbl->gpio_on, 166 retval = gpio_direction_output(pwmbl->gpio_on,
165 0 ^ pdata->on_active_low); 167 0 ^ pdata->on_active_low);
166 if (retval) 168 if (retval)
167 goto err_free_gpio; 169 goto err_free_pwm;
168 } 170 }
169 171
170 memset(&props, 0, sizeof(struct backlight_properties)); 172 memset(&props, 0, sizeof(struct backlight_properties));
@@ -174,7 +176,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
174 &atmel_pwm_bl_ops, &props); 176 &atmel_pwm_bl_ops, &props);
175 if (IS_ERR(bldev)) { 177 if (IS_ERR(bldev)) {
176 retval = PTR_ERR(bldev); 178 retval = PTR_ERR(bldev);
177 goto err_free_gpio; 179 goto err_free_pwm;
178 } 180 }
179 181
180 pwmbl->bldev = bldev; 182 pwmbl->bldev = bldev;
@@ -196,13 +198,9 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
196err_free_bl_dev: 198err_free_bl_dev:
197 platform_set_drvdata(pdev, NULL); 199 platform_set_drvdata(pdev, NULL);
198 backlight_device_unregister(bldev); 200 backlight_device_unregister(bldev);
199err_free_gpio:
200 if (pwmbl->gpio_on != -1)
201 gpio_free(pwmbl->gpio_on);
202err_free_pwm: 201err_free_pwm:
203 pwm_channel_free(&pwmbl->pwmc); 202 pwm_channel_free(&pwmbl->pwmc);
204err_free_mem: 203err_free_mem:
205 kfree(pwmbl);
206 return retval; 204 return retval;
207} 205}
208 206
@@ -210,15 +208,12 @@ static int __exit atmel_pwm_bl_remove(struct platform_device *pdev)
210{ 208{
211 struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); 209 struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
212 210
213 if (pwmbl->gpio_on != -1) { 211 if (pwmbl->gpio_on != -1)
214 gpio_set_value(pwmbl->gpio_on, 0); 212 gpio_set_value(pwmbl->gpio_on, 0);
215 gpio_free(pwmbl->gpio_on);
216 }
217 pwm_channel_disable(&pwmbl->pwmc); 213 pwm_channel_disable(&pwmbl->pwmc);
218 pwm_channel_free(&pwmbl->pwmc); 214 pwm_channel_free(&pwmbl->pwmc);
219 backlight_device_unregister(pwmbl->bldev); 215 backlight_device_unregister(pwmbl->bldev);
220 platform_set_drvdata(pdev, NULL); 216 platform_set_drvdata(pdev, NULL);
221 kfree(pwmbl);
222 217
223 return 0; 218 return 0;
224} 219}
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 23d732677ba1..c781768ba892 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -492,7 +492,8 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
492 lcd->gpio_backlight_cont = -1; 492 lcd->gpio_backlight_cont = -1;
493 493
494 if (gpio_is_valid(pdata->gpio_backlight_on)) { 494 if (gpio_is_valid(pdata->gpio_backlight_on)) {
495 err = gpio_request(pdata->gpio_backlight_on, "BL_ON"); 495 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on,
496 "BL_ON");
496 if (err) { 497 if (err) {
497 dev_err(&spi->dev, "failed to request GPIO%d for " 498 dev_err(&spi->dev, "failed to request GPIO%d for "
498 "backlight_on\n", pdata->gpio_backlight_on); 499 "backlight_on\n", pdata->gpio_backlight_on);
@@ -504,11 +505,12 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
504 } 505 }
505 506
506 if (gpio_is_valid(pdata->gpio_backlight_cont)) { 507 if (gpio_is_valid(pdata->gpio_backlight_cont)) {
507 err = gpio_request(pdata->gpio_backlight_cont, "BL_CONT"); 508 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont,
509 "BL_CONT");
508 if (err) { 510 if (err) {
509 dev_err(&spi->dev, "failed to request GPIO%d for " 511 dev_err(&spi->dev, "failed to request GPIO%d for "
510 "backlight_cont\n", pdata->gpio_backlight_cont); 512 "backlight_cont\n", pdata->gpio_backlight_cont);
511 goto err_free_backlight_on; 513 return err;
512 } 514 }
513 515
514 lcd->gpio_backlight_cont = pdata->gpio_backlight_cont; 516 lcd->gpio_backlight_cont = pdata->gpio_backlight_cont;
@@ -525,11 +527,6 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
525 } 527 }
526 } 528 }
527 return 0; 529 return 0;
528
529err_free_backlight_on:
530 if (gpio_is_valid(lcd->gpio_backlight_on))
531 gpio_free(lcd->gpio_backlight_on);
532 return err;
533} 530}
534 531
535static int __devinit corgi_lcd_probe(struct spi_device *spi) 532static int __devinit corgi_lcd_probe(struct spi_device *spi)
@@ -602,12 +599,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi)
602 backlight_update_status(lcd->bl_dev); 599 backlight_update_status(lcd->bl_dev);
603 backlight_device_unregister(lcd->bl_dev); 600 backlight_device_unregister(lcd->bl_dev);
604 601
605 if (gpio_is_valid(lcd->gpio_backlight_on))
606 gpio_free(lcd->gpio_backlight_on);
607
608 if (gpio_is_valid(lcd->gpio_backlight_cont))
609 gpio_free(lcd->gpio_backlight_cont);
610
611 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); 602 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);
612 lcd_device_unregister(lcd->lcd_dev); 603 lcd_device_unregister(lcd->lcd_dev);
613 604
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index 40f606a86093..2d90c0648aa0 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -175,28 +175,27 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
175 175
176 priv->spi = spi; 176 priv->spi = spi;
177 177
178 ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH, 178 ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
179 "lcd l4f00242t03 reset"); 179 GPIOF_OUT_INIT_HIGH, "lcd l4f00242t03 reset");
180 if (ret) { 180 if (ret) {
181 dev_err(&spi->dev, 181 dev_err(&spi->dev,
182 "Unable to get the lcd l4f00242t03 reset gpio.\n"); 182 "Unable to get the lcd l4f00242t03 reset gpio.\n");
183 return ret; 183 return ret;
184 } 184 }
185 185
186 ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, 186 ret = devm_gpio_request_one(&spi->dev, pdata->data_enable_gpio,
187 "lcd l4f00242t03 data enable"); 187 GPIOF_OUT_INIT_LOW, "lcd l4f00242t03 data enable");
188 if (ret) { 188 if (ret) {
189 dev_err(&spi->dev, 189 dev_err(&spi->dev,
190 "Unable to get the lcd l4f00242t03 data en gpio.\n"); 190 "Unable to get the lcd l4f00242t03 data en gpio.\n");
191 goto err; 191 return ret;
192 } 192 }
193 193
194 priv->io_reg = regulator_get(&spi->dev, "vdd"); 194 priv->io_reg = regulator_get(&spi->dev, "vdd");
195 if (IS_ERR(priv->io_reg)) { 195 if (IS_ERR(priv->io_reg)) {
196 ret = PTR_ERR(priv->io_reg);
197 dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", 196 dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
198 __func__); 197 __func__);
199 goto err2; 198 return PTR_ERR(priv->io_reg);
200 } 199 }
201 200
202 priv->core_reg = regulator_get(&spi->dev, "vcore"); 201 priv->core_reg = regulator_get(&spi->dev, "vcore");
@@ -204,14 +203,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
204 ret = PTR_ERR(priv->core_reg); 203 ret = PTR_ERR(priv->core_reg);
205 dev_err(&spi->dev, "%s: Unable to get the core regulator\n", 204 dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
206 __func__); 205 __func__);
207 goto err3; 206 goto err1;
208 } 207 }
209 208
210 priv->ld = lcd_device_register("l4f00242t03", 209 priv->ld = lcd_device_register("l4f00242t03",
211 &spi->dev, priv, &l4f_ops); 210 &spi->dev, priv, &l4f_ops);
212 if (IS_ERR(priv->ld)) { 211 if (IS_ERR(priv->ld)) {
213 ret = PTR_ERR(priv->ld); 212 ret = PTR_ERR(priv->ld);
214 goto err4; 213 goto err2;
215 } 214 }
216 215
217 /* Init the LCD */ 216 /* Init the LCD */
@@ -223,14 +222,10 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
223 222
224 return 0; 223 return 0;
225 224
226err4: 225err2:
227 regulator_put(priv->core_reg); 226 regulator_put(priv->core_reg);
228err3: 227err1:
229 regulator_put(priv->io_reg); 228 regulator_put(priv->io_reg);
230err2:
231 gpio_free(pdata->data_enable_gpio);
232err:
233 gpio_free(pdata->reset_gpio);
234 229
235 return ret; 230 return ret;
236} 231}
@@ -238,16 +233,12 @@ err:
238static int __devexit l4f00242t03_remove(struct spi_device *spi) 233static int __devexit l4f00242t03_remove(struct spi_device *spi)
239{ 234{
240 struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); 235 struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev);
241 struct l4f00242t03_pdata *pdata = priv->spi->dev.platform_data;
242 236
243 l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); 237 l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN);
244 lcd_device_unregister(priv->ld); 238 lcd_device_unregister(priv->ld);
245 239
246 dev_set_drvdata(&spi->dev, NULL); 240 dev_set_drvdata(&spi->dev, NULL);
247 241
248 gpio_free(pdata->data_enable_gpio);
249 gpio_free(pdata->reset_gpio);
250
251 regulator_put(priv->io_reg); 242 regulator_put(priv->io_reg);
252 regulator_put(priv->core_reg); 243 regulator_put(priv->core_reg);
253 244
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index bebeb63607db..18dca0c29c68 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -295,7 +295,7 @@ static int __devinit lm3533_bl_probe(struct platform_device *pdev)
295 return -EINVAL; 295 return -EINVAL;
296 } 296 }
297 297
298 bl = kzalloc(sizeof(*bl), GFP_KERNEL); 298 bl = devm_kzalloc(&pdev->dev, sizeof(*bl), GFP_KERNEL);
299 if (!bl) { 299 if (!bl) {
300 dev_err(&pdev->dev, 300 dev_err(&pdev->dev,
301 "failed to allocate memory for backlight\n"); 301 "failed to allocate memory for backlight\n");
@@ -317,8 +317,7 @@ static int __devinit lm3533_bl_probe(struct platform_device *pdev)
317 &lm3533_bl_ops, &props); 317 &lm3533_bl_ops, &props);
318 if (IS_ERR(bd)) { 318 if (IS_ERR(bd)) {
319 dev_err(&pdev->dev, "failed to register backlight device\n"); 319 dev_err(&pdev->dev, "failed to register backlight device\n");
320 ret = PTR_ERR(bd); 320 return PTR_ERR(bd);
321 goto err_free;
322 } 321 }
323 322
324 bl->bd = bd; 323 bl->bd = bd;
@@ -348,8 +347,6 @@ err_sysfs_remove:
348 sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group); 347 sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
349err_unregister: 348err_unregister:
350 backlight_device_unregister(bd); 349 backlight_device_unregister(bd);
351err_free:
352 kfree(bl);
353 350
354 return ret; 351 return ret;
355} 352}
@@ -367,7 +364,6 @@ static int __devexit lm3533_bl_remove(struct platform_device *pdev)
367 lm3533_ctrlbank_disable(&bl->cb); 364 lm3533_ctrlbank_disable(&bl->cb);
368 sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group); 365 sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
369 backlight_device_unregister(bd); 366 backlight_device_unregister(bd);
370 kfree(bl);
371 367
372 return 0; 368 return 0;
373} 369}
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
index a9f2c36966f1..ea43f2254196 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -158,29 +158,27 @@ static int __devinit 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 = gpio_request(pdata->reset_gpio, "LMS285GF05 RESET"); 161 ret = devm_gpio_request(&spi->dev, pdata->reset_gpio,
162 "LMS285GF05 RESET");
162 if (ret) 163 if (ret)
163 return ret; 164 return ret;
164 165
165 ret = gpio_direction_output(pdata->reset_gpio, 166 ret = gpio_direction_output(pdata->reset_gpio,
166 !pdata->reset_inverted); 167 !pdata->reset_inverted);
167 if (ret) 168 if (ret)
168 goto err; 169 return ret;
169 } 170 }
170 171
171 st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), 172 st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
172 GFP_KERNEL); 173 GFP_KERNEL);
173 if (st == NULL) { 174 if (st == NULL) {
174 dev_err(&spi->dev, "No memory for device state\n"); 175 dev_err(&spi->dev, "No memory for device state\n");
175 ret = -ENOMEM; 176 return -ENOMEM;
176 goto err;
177 } 177 }
178 178
179 ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); 179 ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
180 if (IS_ERR(ld)) { 180 if (IS_ERR(ld))
181 ret = PTR_ERR(ld); 181 return PTR_ERR(ld);
182 goto err;
183 }
184 182
185 st->spi = spi; 183 st->spi = spi;
186 st->ld = ld; 184 st->ld = ld;
@@ -193,24 +191,14 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
193 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); 191 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
194 192
195 return 0; 193 return 0;
196
197err:
198 if (pdata != NULL)
199 gpio_free(pdata->reset_gpio);
200
201 return ret;
202} 194}
203 195
204static int __devexit lms283gf05_remove(struct spi_device *spi) 196static int __devexit lms283gf05_remove(struct spi_device *spi)
205{ 197{
206 struct lms283gf05_state *st = dev_get_drvdata(&spi->dev); 198 struct lms283gf05_state *st = dev_get_drvdata(&spi->dev);
207 struct lms283gf05_pdata *pdata = st->spi->dev.platform_data;
208 199
209 lcd_device_unregister(st->ld); 200 lcd_device_unregister(st->ld);
210 201
211 if (pdata != NULL)
212 gpio_free(pdata->reset_gpio);
213
214 return 0; 202 return 0;
215} 203}
216 204
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 72a0e0c917cf..aa6d4f71131f 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -14,11 +14,15 @@
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/backlight.h> 15#include <linux/backlight.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/lp855x.h> 17#include <linux/platform_data/lp855x.h>
18 18
19/* Registers */ 19/* Registers */
20#define BRIGHTNESS_CTRL (0x00) 20#define BRIGHTNESS_CTRL 0x00
21#define DEVICE_CTRL (0x01) 21#define DEVICE_CTRL 0x01
22#define EEPROM_START 0xA0
23#define EEPROM_END 0xA7
24#define EPROM_START 0xA0
25#define EPROM_END 0xAF
22 26
23#define BUF_SIZE 20 27#define BUF_SIZE 20
24#define DEFAULT_BL_NAME "lcd-backlight" 28#define DEFAULT_BL_NAME "lcd-backlight"
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c
index f519d55a294c..469cf0f109d2 100644
--- a/drivers/video/backlight/ot200_bl.c
+++ b/drivers/video/backlight/ot200_bl.c
@@ -84,7 +84,8 @@ static int ot200_backlight_probe(struct platform_device *pdev)
84 int retval = 0; 84 int retval = 0;
85 85
86 /* request gpio */ 86 /* request gpio */
87 if (gpio_request(GPIO_DIMM, "ot200 backlight dimmer") < 0) { 87 if (devm_gpio_request(&pdev->dev, GPIO_DIMM,
88 "ot200 backlight dimmer") < 0) {
88 dev_err(&pdev->dev, "failed to request GPIO %d\n", GPIO_DIMM); 89 dev_err(&pdev->dev, "failed to request GPIO %d\n", GPIO_DIMM);
89 return -ENODEV; 90 return -ENODEV;
90 } 91 }
@@ -93,14 +94,13 @@ static int ot200_backlight_probe(struct platform_device *pdev)
93 pwm_timer = cs5535_mfgpt_alloc_timer(7, MFGPT_DOMAIN_ANY); 94 pwm_timer = cs5535_mfgpt_alloc_timer(7, MFGPT_DOMAIN_ANY);
94 if (!pwm_timer) { 95 if (!pwm_timer) {
95 dev_err(&pdev->dev, "MFGPT 7 not available\n"); 96 dev_err(&pdev->dev, "MFGPT 7 not available\n");
96 retval = -ENODEV; 97 return -ENODEV;
97 goto error_mfgpt_alloc;
98 } 98 }
99 99
100 data = kzalloc(sizeof(*data), GFP_KERNEL); 100 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
101 if (!data) { 101 if (!data) {
102 retval = -ENOMEM; 102 retval = -ENOMEM;
103 goto error_kzalloc; 103 goto error_devm_kzalloc;
104 } 104 }
105 105
106 /* setup gpio */ 106 /* setup gpio */
@@ -122,26 +122,21 @@ static int ot200_backlight_probe(struct platform_device *pdev)
122 if (IS_ERR(bl)) { 122 if (IS_ERR(bl)) {
123 dev_err(&pdev->dev, "failed to register backlight\n"); 123 dev_err(&pdev->dev, "failed to register backlight\n");
124 retval = PTR_ERR(bl); 124 retval = PTR_ERR(bl);
125 goto error_backlight_device_register; 125 goto error_devm_kzalloc;
126 } 126 }
127 127
128 platform_set_drvdata(pdev, bl); 128 platform_set_drvdata(pdev, bl);
129 129
130 return 0; 130 return 0;
131 131
132error_backlight_device_register: 132error_devm_kzalloc:
133 kfree(data);
134error_kzalloc:
135 cs5535_mfgpt_free_timer(pwm_timer); 133 cs5535_mfgpt_free_timer(pwm_timer);
136error_mfgpt_alloc:
137 gpio_free(GPIO_DIMM);
138 return retval; 134 return retval;
139} 135}
140 136
141static int ot200_backlight_remove(struct platform_device *pdev) 137static int ot200_backlight_remove(struct platform_device *pdev)
142{ 138{
143 struct backlight_device *bl = platform_get_drvdata(pdev); 139 struct backlight_device *bl = platform_get_drvdata(pdev);
144 struct ot200_backlight_data *data = bl_get_data(bl);
145 140
146 backlight_device_unregister(bl); 141 backlight_device_unregister(bl);
147 142
@@ -152,9 +147,7 @@ static int ot200_backlight_remove(struct platform_device *pdev)
152 MAX_COMP2 - dim_table[100]); 147 MAX_COMP2 - dim_table[100]);
153 148
154 cs5535_mfgpt_free_timer(pwm_timer); 149 cs5535_mfgpt_free_timer(pwm_timer);
155 gpio_free(GPIO_DIMM);
156 150
157 kfree(data);
158 return 0; 151 return 0;
159} 152}
160 153
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 342b7d7cbb63..995f0164c9b0 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -26,11 +26,13 @@ struct pwm_bl_data {
26 struct device *dev; 26 struct device *dev;
27 unsigned int period; 27 unsigned int period;
28 unsigned int lth_brightness; 28 unsigned int lth_brightness;
29 unsigned int *levels;
29 int (*notify)(struct device *, 30 int (*notify)(struct device *,
30 int brightness); 31 int brightness);
31 void (*notify_after)(struct device *, 32 void (*notify_after)(struct device *,
32 int brightness); 33 int brightness);
33 int (*check_fb)(struct device *, struct fb_info *); 34 int (*check_fb)(struct device *, struct fb_info *);
35 void (*exit)(struct device *);
34}; 36};
35 37
36static int pwm_backlight_update_status(struct backlight_device *bl) 38static int pwm_backlight_update_status(struct backlight_device *bl)
@@ -52,9 +54,18 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
52 pwm_config(pb->pwm, 0, pb->period); 54 pwm_config(pb->pwm, 0, pb->period);
53 pwm_disable(pb->pwm); 55 pwm_disable(pb->pwm);
54 } else { 56 } else {
55 brightness = pb->lth_brightness + 57 int duty_cycle;
56 (brightness * (pb->period - pb->lth_brightness) / max); 58
57 pwm_config(pb->pwm, brightness, pb->period); 59 if (pb->levels) {
60 duty_cycle = pb->levels[brightness];
61 max = pb->levels[max];
62 } else {
63 duty_cycle = brightness;
64 }
65
66 duty_cycle = pb->lth_brightness +
67 (duty_cycle * (pb->period - pb->lth_brightness) / max);
68 pwm_config(pb->pwm, duty_cycle, pb->period);
58 pwm_enable(pb->pwm); 69 pwm_enable(pb->pwm);
59 } 70 }
60 71
@@ -83,17 +94,98 @@ static const struct backlight_ops pwm_backlight_ops = {
83 .check_fb = pwm_backlight_check_fb, 94 .check_fb = pwm_backlight_check_fb,
84}; 95};
85 96
97#ifdef CONFIG_OF
98static int pwm_backlight_parse_dt(struct device *dev,
99 struct platform_pwm_backlight_data *data)
100{
101 struct device_node *node = dev->of_node;
102 struct property *prop;
103 int length;
104 u32 value;
105 int ret;
106
107 if (!node)
108 return -ENODEV;
109
110 memset(data, 0, sizeof(*data));
111
112 /* determine the number of brightness levels */
113 prop = of_find_property(node, "brightness-levels", &length);
114 if (!prop)
115 return -EINVAL;
116
117 data->max_brightness = length / sizeof(u32);
118
119 /* read brightness levels from DT property */
120 if (data->max_brightness > 0) {
121 size_t size = sizeof(*data->levels) * data->max_brightness;
122
123 data->levels = devm_kzalloc(dev, size, GFP_KERNEL);
124 if (!data->levels)
125 return -ENOMEM;
126
127 ret = of_property_read_u32_array(node, "brightness-levels",
128 data->levels,
129 data->max_brightness);
130 if (ret < 0)
131 return ret;
132
133 ret = of_property_read_u32(node, "default-brightness-level",
134 &value);
135 if (ret < 0)
136 return ret;
137
138 if (value >= data->max_brightness) {
139 dev_warn(dev, "invalid default brightness level: %u, using %u\n",
140 value, data->max_brightness - 1);
141 value = data->max_brightness - 1;
142 }
143
144 data->dft_brightness = value;
145 data->max_brightness--;
146 }
147
148 /*
149 * TODO: Most users of this driver use a number of GPIOs to control
150 * backlight power. Support for specifying these needs to be
151 * added.
152 */
153
154 return 0;
155}
156
157static struct of_device_id pwm_backlight_of_match[] = {
158 { .compatible = "pwm-backlight" },
159 { }
160};
161
162MODULE_DEVICE_TABLE(of, pwm_backlight_of_match);
163#else
164static int pwm_backlight_parse_dt(struct device *dev,
165 struct platform_pwm_backlight_data *data)
166{
167 return -ENODEV;
168}
169#endif
170
86static int pwm_backlight_probe(struct platform_device *pdev) 171static int pwm_backlight_probe(struct platform_device *pdev)
87{ 172{
88 struct backlight_properties props;
89 struct platform_pwm_backlight_data *data = pdev->dev.platform_data; 173 struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
174 struct platform_pwm_backlight_data defdata;
175 struct backlight_properties props;
90 struct backlight_device *bl; 176 struct backlight_device *bl;
91 struct pwm_bl_data *pb; 177 struct pwm_bl_data *pb;
178 unsigned int max;
92 int ret; 179 int ret;
93 180
94 if (!data) { 181 if (!data) {
95 dev_err(&pdev->dev, "failed to find platform data\n"); 182 ret = pwm_backlight_parse_dt(&pdev->dev, &defdata);
96 return -EINVAL; 183 if (ret < 0) {
184 dev_err(&pdev->dev, "failed to find platform data\n");
185 return ret;
186 }
187
188 data = &defdata;
97 } 189 }
98 190
99 if (data->init) { 191 if (data->init) {
@@ -109,21 +201,42 @@ static int pwm_backlight_probe(struct platform_device *pdev)
109 goto err_alloc; 201 goto err_alloc;
110 } 202 }
111 203
112 pb->period = data->pwm_period_ns; 204 if (data->levels) {
205 max = data->levels[data->max_brightness];
206 pb->levels = data->levels;
207 } else
208 max = data->max_brightness;
209
113 pb->notify = data->notify; 210 pb->notify = data->notify;
114 pb->notify_after = data->notify_after; 211 pb->notify_after = data->notify_after;
115 pb->check_fb = data->check_fb; 212 pb->check_fb = data->check_fb;
116 pb->lth_brightness = data->lth_brightness * 213 pb->exit = data->exit;
117 (data->pwm_period_ns / data->max_brightness);
118 pb->dev = &pdev->dev; 214 pb->dev = &pdev->dev;
119 215
120 pb->pwm = pwm_request(data->pwm_id, "backlight"); 216 pb->pwm = pwm_get(&pdev->dev, NULL);
121 if (IS_ERR(pb->pwm)) { 217 if (IS_ERR(pb->pwm)) {
122 dev_err(&pdev->dev, "unable to request PWM for backlight\n"); 218 dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
123 ret = PTR_ERR(pb->pwm); 219
124 goto err_alloc; 220 pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
125 } else 221 if (IS_ERR(pb->pwm)) {
126 dev_dbg(&pdev->dev, "got pwm for backlight\n"); 222 dev_err(&pdev->dev, "unable to request legacy PWM\n");
223 ret = PTR_ERR(pb->pwm);
224 goto err_alloc;
225 }
226 }
227
228 dev_dbg(&pdev->dev, "got pwm for backlight\n");
229
230 /*
231 * The DT case will set the pwm_period_ns field to 0 and store the
232 * period, parsed from the DT, in the PWM device. For the non-DT case,
233 * set the period from platform data.
234 */
235 if (data->pwm_period_ns > 0)
236 pwm_set_period(pb->pwm, data->pwm_period_ns);
237
238 pb->period = pwm_get_period(pb->pwm);
239 pb->lth_brightness = data->lth_brightness * (pb->period / max);
127 240
128 memset(&props, 0, sizeof(struct backlight_properties)); 241 memset(&props, 0, sizeof(struct backlight_properties));
129 props.type = BACKLIGHT_RAW; 242 props.type = BACKLIGHT_RAW;
@@ -143,7 +256,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
143 return 0; 256 return 0;
144 257
145err_bl: 258err_bl:
146 pwm_free(pb->pwm); 259 pwm_put(pb->pwm);
147err_alloc: 260err_alloc:
148 if (data->exit) 261 if (data->exit)
149 data->exit(&pdev->dev); 262 data->exit(&pdev->dev);
@@ -152,16 +265,15 @@ err_alloc:
152 265
153static int pwm_backlight_remove(struct platform_device *pdev) 266static int pwm_backlight_remove(struct platform_device *pdev)
154{ 267{
155 struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
156 struct backlight_device *bl = platform_get_drvdata(pdev); 268 struct backlight_device *bl = platform_get_drvdata(pdev);
157 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); 269 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
158 270
159 backlight_device_unregister(bl); 271 backlight_device_unregister(bl);
160 pwm_config(pb->pwm, 0, pb->period); 272 pwm_config(pb->pwm, 0, pb->period);
161 pwm_disable(pb->pwm); 273 pwm_disable(pb->pwm);
162 pwm_free(pb->pwm); 274 pwm_put(pb->pwm);
163 if (data->exit) 275 if (pb->exit)
164 data->exit(&pdev->dev); 276 pb->exit(&pdev->dev);
165 return 0; 277 return 0;
166} 278}
167 279
@@ -195,11 +307,12 @@ static SIMPLE_DEV_PM_OPS(pwm_backlight_pm_ops, pwm_backlight_suspend,
195 307
196static struct platform_driver pwm_backlight_driver = { 308static struct platform_driver pwm_backlight_driver = {
197 .driver = { 309 .driver = {
198 .name = "pwm-backlight", 310 .name = "pwm-backlight",
199 .owner = THIS_MODULE, 311 .owner = THIS_MODULE,
200#ifdef CONFIG_PM 312#ifdef CONFIG_PM
201 .pm = &pwm_backlight_pm_ops, 313 .pm = &pwm_backlight_pm_ops,
202#endif 314#endif
315 .of_match_table = of_match_ptr(pwm_backlight_of_match),
203 }, 316 },
204 .probe = pwm_backlight_probe, 317 .probe = pwm_backlight_probe,
205 .remove = pwm_backlight_remove, 318 .remove = pwm_backlight_remove,
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index 0d54e607e82d..49342e1d20be 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -92,14 +92,14 @@ static int __devinit 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 = gpio_request(TOSA_GPIO_BL_C20MA, "backlight"); 95 ret = devm_gpio_request(&client->dev, TOSA_GPIO_BL_C20MA, "backlight");
96 if (ret) { 96 if (ret) {
97 dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); 97 dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
98 return ret; 98 return ret;
99 } 99 }
100 ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0); 100 ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0);
101 if (ret) 101 if (ret)
102 goto err_gpio_dir; 102 return ret;
103 103
104 i2c_set_clientdata(client, data); 104 i2c_set_clientdata(client, data);
105 data->i2c = client; 105 data->i2c = client;
@@ -123,8 +123,6 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
123 123
124err_reg: 124err_reg:
125 data->bl = NULL; 125 data->bl = NULL;
126err_gpio_dir:
127 gpio_free(TOSA_GPIO_BL_C20MA);
128 return ret; 126 return ret;
129} 127}
130 128
@@ -135,8 +133,6 @@ static int __devexit tosa_bl_remove(struct i2c_client *client)
135 backlight_device_unregister(data->bl); 133 backlight_device_unregister(data->bl);
136 data->bl = NULL; 134 data->bl = NULL;
137 135
138 gpio_free(TOSA_GPIO_BL_C20MA);
139
140 return 0; 136 return 0;
141} 137}
142 138
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 47823b8efff0..33047a66cc24 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -193,7 +193,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
193 data->spi = spi; 193 data->spi = spi;
194 dev_set_drvdata(&spi->dev, data); 194 dev_set_drvdata(&spi->dev, data);
195 195
196 ret = gpio_request(TOSA_GPIO_TG_ON, "tg #pwr"); 196 ret = devm_gpio_request(&spi->dev, TOSA_GPIO_TG_ON, "tg #pwr");
197 if (ret < 0) 197 if (ret < 0)
198 goto err_gpio_tg; 198 goto err_gpio_tg;
199 199
@@ -201,7 +201,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
201 201
202 ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0); 202 ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0);
203 if (ret < 0) 203 if (ret < 0)
204 goto err_gpio_dir; 204 goto err_gpio_tg;
205 205
206 mdelay(60); 206 mdelay(60);
207 tosa_lcd_tg_init(data); 207 tosa_lcd_tg_init(data);
@@ -221,8 +221,6 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
221 221
222err_register: 222err_register:
223 tosa_lcd_tg_off(data); 223 tosa_lcd_tg_off(data);
224err_gpio_dir:
225 gpio_free(TOSA_GPIO_TG_ON);
226err_gpio_tg: 224err_gpio_tg:
227 dev_set_drvdata(&spi->dev, NULL); 225 dev_set_drvdata(&spi->dev, NULL);
228 return ret; 226 return ret;
@@ -239,7 +237,6 @@ static int __devexit tosa_lcd_remove(struct spi_device *spi)
239 237
240 tosa_lcd_tg_off(data); 238 tosa_lcd_tg_off(data);
241 239
242 gpio_free(TOSA_GPIO_TG_ON);
243 dev_set_drvdata(&spi->dev, NULL); 240 dev_set_drvdata(&spi->dev, NULL);
244 241
245 return 0; 242 return 0;
diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c
index 9bdd4b0c18c8..d0f121bd8b25 100644
--- a/drivers/video/bfin_adv7393fb.c
+++ b/drivers/video/bfin_adv7393fb.c
@@ -58,7 +58,7 @@ static const unsigned short ppi_pins[] = {
58 */ 58 */
59 59
60static struct bfin_adv7393_fb_par { 60static struct bfin_adv7393_fb_par {
61 /* structure holding blackfin / adv7393 paramters when 61 /* structure holding blackfin / adv7393 parameters when
62 screen is blanked */ 62 screen is blanked */
63 struct { 63 struct {
64 u8 Mode; /* ntsc/pal/? */ 64 u8 Mode; /* ntsc/pal/? */
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 738c8ce7d132..bc67d05cad60 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -1611,7 +1611,7 @@ static void init_vgachip(struct fb_info *info)
1611 /* ext. display controls: ext.adr. wrap */ 1611 /* ext. display controls: ext.adr. wrap */
1612 vga_wcrt(cinfo->regbase, CL_CRT1B, 0x02); 1612 vga_wcrt(cinfo->regbase, CL_CRT1B, 0x02);
1613 1613
1614 /* Set/Reset registes: - */ 1614 /* Set/Reset registers: - */
1615 vga_wgfx(cinfo->regbase, VGA_GFX_SR_VALUE, 0x00); 1615 vga_wgfx(cinfo->regbase, VGA_GFX_SR_VALUE, 0x00);
1616 /* Set/Reset enable: - */ 1616 /* Set/Reset enable: - */
1617 vga_wgfx(cinfo->regbase, VGA_GFX_SR_ENABLE, 0x00); 1617 vga_wgfx(cinfo->regbase, VGA_GFX_SR_ENABLE, 0x00);
diff --git a/drivers/video/exynos/exynos_dp_reg.c b/drivers/video/exynos/exynos_dp_reg.c
index ce401c83f638..2db5b9aa250a 100644
--- a/drivers/video/exynos/exynos_dp_reg.c
+++ b/drivers/video/exynos/exynos_dp_reg.c
@@ -752,7 +752,7 @@ int exynos_dp_read_bytes_from_i2c(struct exynos_dp_device *dp,
752 752
753 /* 753 /*
754 * If Rx sends defer, Tx sends only reads 754 * If Rx sends defer, Tx sends only reads
755 * request without sending addres 755 * request without sending address
756 */ 756 */
757 if (!defer) 757 if (!defer)
758 retval = exynos_dp_select_i2c_device(dp, 758 retval = exynos_dp_select_i2c_device(dp,
diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
index 939064064a4f..4bc2b8a5dd8b 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -106,7 +106,7 @@ static void exynos_mipi_update_cfg(struct mipi_dsim_device *dsim)
106 106
107 /* 107 /*
108 * data from Display controller(FIMD) is transferred in video mode 108 * data from Display controller(FIMD) is transferred in video mode
109 * but in case of command mode, all settigs is updated to registers. 109 * but in case of command mode, all settings are updated to registers.
110 */ 110 */
111 exynos_mipi_dsi_stand_by(dsim, 1); 111 exynos_mipi_dsi_stand_by(dsim, 1);
112} 112}
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 1ddeb11659d4..64cda560c488 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -104,6 +104,8 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
104 deferred framebuffer IO. then if userspace touches a page 104 deferred framebuffer IO. then if userspace touches a page
105 again, we repeat the same scheme */ 105 again, we repeat the same scheme */
106 106
107 file_update_time(vma->vm_file);
108
107 /* protect against the workqueue changing the page list */ 109 /* protect against the workqueue changing the page list */
108 mutex_lock(&fbdefio->lock); 110 mutex_lock(&fbdefio->lock);
109 111
diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
index fe574d84ed99..ff3f8808e4e9 100644
--- a/drivers/video/i740fb.c
+++ b/drivers/video/i740fb.c
@@ -497,7 +497,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,
497 497
498 mem = vxres * vyres * ((bpp + 1) / 8); 498 mem = vxres * vyres * ((bpp + 1) / 8);
499 if (mem > info->screen_size) { 499 if (mem > info->screen_size) {
500 dev_err(info->device, "not enough video memory (%d KB requested, %ld KB avaliable)\n", 500 dev_err(info->device, "not enough video memory (%d KB requested, %ld KB available)\n",
501 mem >> 10, info->screen_size >> 10); 501 mem >> 10, info->screen_size >> 10);
502 return -ENOMEM; 502 return -ENOMEM;
503 } 503 }
@@ -728,7 +728,7 @@ static void vga_protect(struct i740fb_par *par)
728 i740outreg_mask(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, 0x20, 0x20); 728 i740outreg_mask(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, 0x20, 0x20);
729 729
730 i740inb(par, 0x3DA); 730 i740inb(par, 0x3DA);
731 i740outb(par, VGA_ATT_W, 0x00); /* enable pallete access */ 731 i740outb(par, VGA_ATT_W, 0x00); /* enable palette access */
732} 732}
733 733
734static void vga_unprotect(struct i740fb_par *par) 734static void vga_unprotect(struct i740fb_par *par)
@@ -737,7 +737,7 @@ static void vga_unprotect(struct i740fb_par *par)
737 i740outreg_mask(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, 0, 0x20); 737 i740outreg_mask(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, 0, 0x20);
738 738
739 i740inb(par, 0x3DA); 739 i740inb(par, 0x3DA);
740 i740outb(par, VGA_ATT_W, 0x20); /* disable pallete access */ 740 i740outb(par, VGA_ATT_W, 0x20); /* disable palette access */
741} 741}
742 742
743static int i740fb_set_par(struct fb_info *info) 743static int i740fb_set_par(struct fb_info *info)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index abbe691047bd..49619b441500 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -41,12 +41,14 @@
41 41
42#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/of_device.h>
45#include <linux/of_gpio.h>
44#include <linux/platform_device.h> 46#include <linux/platform_device.h>
45#include <linux/clk.h> 47#include <linux/clk.h>
46#include <linux/dma-mapping.h> 48#include <linux/dma-mapping.h>
47#include <linux/io.h> 49#include <linux/io.h>
48#include <linux/pinctrl/consumer.h> 50#include <linux/pinctrl/consumer.h>
49#include <mach/mxsfb.h> 51#include <linux/mxsfb.h>
50 52
51#define REG_SET 4 53#define REG_SET 4
52#define REG_CLR 8 54#define REG_CLR 8
@@ -750,16 +752,43 @@ static void __devexit mxsfb_free_videomem(struct mxsfb_info *host)
750 } 752 }
751} 753}
752 754
755static struct platform_device_id mxsfb_devtype[] = {
756 {
757 .name = "imx23-fb",
758 .driver_data = MXSFB_V3,
759 }, {
760 .name = "imx28-fb",
761 .driver_data = MXSFB_V4,
762 }, {
763 /* sentinel */
764 }
765};
766MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
767
768static const struct of_device_id mxsfb_dt_ids[] = {
769 { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devtype[0], },
770 { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devtype[1], },
771 { /* sentinel */ }
772};
773MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
774
753static int __devinit mxsfb_probe(struct platform_device *pdev) 775static int __devinit mxsfb_probe(struct platform_device *pdev)
754{ 776{
777 const struct of_device_id *of_id =
778 of_match_device(mxsfb_dt_ids, &pdev->dev);
755 struct mxsfb_platform_data *pdata = pdev->dev.platform_data; 779 struct mxsfb_platform_data *pdata = pdev->dev.platform_data;
756 struct resource *res; 780 struct resource *res;
757 struct mxsfb_info *host; 781 struct mxsfb_info *host;
758 struct fb_info *fb_info; 782 struct fb_info *fb_info;
759 struct fb_modelist *modelist; 783 struct fb_modelist *modelist;
760 struct pinctrl *pinctrl; 784 struct pinctrl *pinctrl;
785 int panel_enable;
786 enum of_gpio_flags flags;
761 int i, ret; 787 int i, ret;
762 788
789 if (of_id)
790 pdev->id_entry = of_id->data;
791
763 if (!pdata) { 792 if (!pdata) {
764 dev_err(&pdev->dev, "No platformdata. Giving up\n"); 793 dev_err(&pdev->dev, "No platformdata. Giving up\n");
765 return -ENODEV; 794 return -ENODEV;
@@ -807,6 +836,22 @@ static int __devinit mxsfb_probe(struct platform_device *pdev)
807 goto error_getclock; 836 goto error_getclock;
808 } 837 }
809 838
839 panel_enable = of_get_named_gpio_flags(pdev->dev.of_node,
840 "panel-enable-gpios", 0, &flags);
841 if (gpio_is_valid(panel_enable)) {
842 unsigned long f = GPIOF_OUT_INIT_HIGH;
843 if (flags == OF_GPIO_ACTIVE_LOW)
844 f = GPIOF_OUT_INIT_LOW;
845 ret = devm_gpio_request_one(&pdev->dev, panel_enable,
846 f, "panel-enable");
847 if (ret) {
848 dev_err(&pdev->dev,
849 "failed to request gpio %d: %d\n",
850 panel_enable, ret);
851 goto error_panel_enable;
852 }
853 }
854
810 fb_info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 855 fb_info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
811 if (!fb_info->pseudo_palette) { 856 if (!fb_info->pseudo_palette) {
812 ret = -ENOMEM; 857 ret = -ENOMEM;
@@ -854,6 +899,7 @@ error_register:
854error_init_fb: 899error_init_fb:
855 kfree(fb_info->pseudo_palette); 900 kfree(fb_info->pseudo_palette);
856error_pseudo_pallette: 901error_pseudo_pallette:
902error_panel_enable:
857 clk_put(host->clk); 903 clk_put(host->clk);
858error_getclock: 904error_getclock:
859error_getpin: 905error_getpin:
@@ -901,19 +947,6 @@ static void mxsfb_shutdown(struct platform_device *pdev)
901 writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR); 947 writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR);
902} 948}
903 949
904static struct platform_device_id mxsfb_devtype[] = {
905 {
906 .name = "imx23-fb",
907 .driver_data = MXSFB_V3,
908 }, {
909 .name = "imx28-fb",
910 .driver_data = MXSFB_V4,
911 }, {
912 /* sentinel */
913 }
914};
915MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
916
917static struct platform_driver mxsfb_driver = { 950static struct platform_driver mxsfb_driver = {
918 .probe = mxsfb_probe, 951 .probe = mxsfb_probe,
919 .remove = __devexit_p(mxsfb_remove), 952 .remove = __devexit_p(mxsfb_remove),
@@ -921,6 +954,7 @@ static struct platform_driver mxsfb_driver = {
921 .id_table = mxsfb_devtype, 954 .id_table = mxsfb_devtype,
922 .driver = { 955 .driver = {
923 .name = DRIVER_NAME, 956 .name = DRIVER_NAME,
957 .of_match_table = mxsfb_dt_ids,
924 }, 958 },
925}; 959};
926 960
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index ea7b661e7229..69bf9d07c237 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -189,7 +189,7 @@ struct s3c_fb_vsync {
189 189
190/** 190/**
191 * struct s3c_fb - overall hardware state of the hardware 191 * struct s3c_fb - overall hardware state of the hardware
192 * @slock: The spinlock protection for this data sturcture. 192 * @slock: The spinlock protection for this data sturucture.
193 * @dev: The device that we bound to, for printing, etc. 193 * @dev: The device that we bound to, for printing, etc.
194 * @bus_clk: The clk (hclk) feeding our interface and possibly pixclk. 194 * @bus_clk: The clk (hclk) feeding our interface and possibly pixclk.
195 * @lcd_clk: The clk (sclk) feeding pixclk. 195 * @lcd_clk: The clk (sclk) feeding pixclk.
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index f3d3b9ce4751..0d0f52c18fd8 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -662,7 +662,7 @@ static void savage_get_default_par(struct savagefb_par *par, struct savage_reg *
662 vga_out8(0x3c4, 0x18, par); 662 vga_out8(0x3c4, 0x18, par);
663 reg->SR18 = vga_in8(0x3c5, par); 663 reg->SR18 = vga_in8(0x3c5, par);
664 664
665 /* Save flat panel expansion regsters. */ 665 /* Save flat panel expansion registers. */
666 if (par->chip == S3_SAVAGE_MX) { 666 if (par->chip == S3_SAVAGE_MX) {
667 int i; 667 int i;
668 668
@@ -815,7 +815,7 @@ static void savage_set_default_par(struct savagefb_par *par,
815 vga_out8(0x3c4, 0x18, par); 815 vga_out8(0x3c4, 0x18, par);
816 vga_out8(0x3c5, reg->SR18, par); 816 vga_out8(0x3c5, reg->SR18, par);
817 817
818 /* Save flat panel expansion regsters. */ 818 /* Save flat panel expansion registers. */
819 if (par->chip == S3_SAVAGE_MX) { 819 if (par->chip == S3_SAVAGE_MX) {
820 int i; 820 int i;
821 821
@@ -1318,7 +1318,7 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r
1318 vga_out8(0x3c4, 0x15, par); 1318 vga_out8(0x3c4, 0x15, par);
1319 vga_out8(0x3c5, reg->SR15, par); 1319 vga_out8(0x3c5, reg->SR15, par);
1320 1320
1321 /* Restore flat panel expansion regsters. */ 1321 /* Restore flat panel expansion registers. */
1322 if (par->chip == S3_SAVAGE_MX) { 1322 if (par->chip == S3_SAVAGE_MX) {
1323 int i; 1323 int i;
1324 1324
diff --git a/drivers/video/sis/init.c b/drivers/video/sis/init.c
index 66de832361cc..f082ae55c0c9 100644
--- a/drivers/video/sis/init.c
+++ b/drivers/video/sis/init.c
@@ -2628,7 +2628,8 @@ SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
2628 else if(VCLK >= 135) data = 0x02; 2628 else if(VCLK >= 135) data = 0x02;
2629 2629
2630 if(SiS_Pr->ChipType == SIS_540) { 2630 if(SiS_Pr->ChipType == SIS_540) {
2631 if((VCLK == 203) || (VCLK < 234)) data = 0x02; 2631 /* Was == 203 or < 234 which made no sense */
2632 if (VCLK < 234) data = 0x02;
2632 } 2633 }
2633 2634
2634 if(SiS_Pr->ChipType < SIS_315H) { 2635 if(SiS_Pr->ChipType < SIS_315H) {
diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c
index f39e0690f484..5533a32c6ca1 100644
--- a/drivers/video/smscufx.c
+++ b/drivers/video/smscufx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * smscufx.c -- Framebuffer driver for SMSC UFX USB controller 2 * smscufx.c -- Framebuffer driver for SMSC UFX USB controller
3 * 3 *
4 * Copyright (C) 2011 Steve Glendinning <steve.glendinning@smsc.com> 4 * Copyright (C) 2011 Steve Glendinning <steve.glendinning@shawell.net>
5 * Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it> 5 * Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it>
6 * Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com> 6 * Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com>
7 * Copyright (C) 2009 Bernie Thompson <bernie@plugable.com> 7 * Copyright (C) 2009 Bernie Thompson <bernie@plugable.com>
@@ -1002,7 +1002,7 @@ static int ufx_ops_ioctl(struct fb_info *info, unsigned int cmd,
1002 /* TODO: Help propose a standard fb.h ioctl to report mmap damage */ 1002 /* TODO: Help propose a standard fb.h ioctl to report mmap damage */
1003 if (cmd == UFX_IOCTL_REPORT_DAMAGE) { 1003 if (cmd == UFX_IOCTL_REPORT_DAMAGE) {
1004 /* If we have a damage-aware client, turn fb_defio "off" 1004 /* If we have a damage-aware client, turn fb_defio "off"
1005 * To avoid perf imact of unecessary page fault handling. 1005 * To avoid perf imact of unnecessary page fault handling.
1006 * Done by resetting the delay for this fb_info to a very 1006 * Done by resetting the delay for this fb_info to a very
1007 * long period. Pages will become writable and stay that way. 1007 * long period. Pages will become writable and stay that way.
1008 * Reset to normal value when all clients have closed this fb. 1008 * Reset to normal value when all clients have closed this fb.
@@ -1466,7 +1466,7 @@ static int ufx_read_edid(struct ufx_data *dev, u8 *edid, int edid_len)
1466 /* all FF's in the first 16 bytes indicates nothing is connected */ 1466 /* all FF's in the first 16 bytes indicates nothing is connected */
1467 for (i = 0; i < 16; i++) { 1467 for (i = 0; i < 16; i++) {
1468 if (edid[i] != 0xFF) { 1468 if (edid[i] != 0xFF) {
1469 pr_debug("edid data read succesfully"); 1469 pr_debug("edid data read successfully");
1470 return EDID_LENGTH; 1470 return EDID_LENGTH;
1471 } 1471 }
1472 } 1472 }
@@ -1972,6 +1972,6 @@ MODULE_PARM_DESC(console, "Allow fbcon to be used on this display");
1972module_param(fb_defio, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); 1972module_param(fb_defio, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
1973MODULE_PARM_DESC(fb_defio, "Enable fb_defio mmap support"); 1973MODULE_PARM_DESC(fb_defio, "Enable fb_defio mmap support");
1974 1974
1975MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>"); 1975MODULE_AUTHOR("Steve Glendinning <steve.glendinning@shawell.net>");
1976MODULE_DESCRIPTION("SMSC UFX kernel framebuffer driver"); 1976MODULE_DESCRIPTION("SMSC UFX kernel framebuffer driver");
1977MODULE_LICENSE("GPL"); 1977MODULE_LICENSE("GPL");
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
index b9c2b948d34d..eb931b8626fa 100644
--- a/drivers/video/sunxvr500.c
+++ b/drivers/video/sunxvr500.c
@@ -12,7 +12,7 @@
12 12
13#include <asm/io.h> 13#include <asm/io.h>
14 14
15/* XXX This device has a 'dev-comm' property which aparently is 15/* XXX This device has a 'dev-comm' property which apparently is
16 * XXX a pointer into the openfirmware's address space which is 16 * XXX a pointer into the openfirmware's address space which is
17 * XXX a shared area the kernel driver can use to keep OBP 17 * XXX a shared area the kernel driver can use to keep OBP
18 * XXX informed about the current resolution setting. The idea 18 * XXX informed about the current resolution setting. The idea