diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/atmel_lcdfb.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index 92640d46770a..10d038029d67 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/of_device.h> | 24 | #include <linux/of_device.h> |
25 | #include <linux/of_gpio.h> | 25 | #include <linux/of_gpio.h> |
26 | #include <video/of_display_timing.h> | 26 | #include <video/of_display_timing.h> |
27 | #include <linux/regulator/consumer.h> | ||
27 | #include <video/videomode.h> | 28 | #include <video/videomode.h> |
28 | 29 | ||
29 | #include <mach/cpu.h> | 30 | #include <mach/cpu.h> |
@@ -60,6 +61,7 @@ struct atmel_lcdfb_info { | |||
60 | struct atmel_lcdfb_pdata pdata; | 61 | struct atmel_lcdfb_pdata pdata; |
61 | 62 | ||
62 | struct atmel_lcdfb_config *config; | 63 | struct atmel_lcdfb_config *config; |
64 | struct regulator *reg_lcd; | ||
63 | }; | 65 | }; |
64 | 66 | ||
65 | struct atmel_lcdfb_power_ctrl_gpio { | 67 | struct atmel_lcdfb_power_ctrl_gpio { |
@@ -302,10 +304,24 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo) | |||
302 | 304 | ||
303 | static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on) | 305 | static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on) |
304 | { | 306 | { |
307 | int ret; | ||
305 | struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; | 308 | struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; |
306 | 309 | ||
307 | if (pdata->atmel_lcdfb_power_control) | 310 | if (pdata->atmel_lcdfb_power_control) |
308 | pdata->atmel_lcdfb_power_control(pdata, on); | 311 | pdata->atmel_lcdfb_power_control(pdata, on); |
312 | else if (sinfo->reg_lcd) { | ||
313 | if (on) { | ||
314 | ret = regulator_enable(sinfo->reg_lcd); | ||
315 | if (ret) | ||
316 | dev_err(&sinfo->pdev->dev, | ||
317 | "lcd regulator enable failed: %d\n", ret); | ||
318 | } else { | ||
319 | ret = regulator_disable(sinfo->reg_lcd); | ||
320 | if (ret) | ||
321 | dev_err(&sinfo->pdev->dev, | ||
322 | "lcd regulator disable failed: %d\n", ret); | ||
323 | } | ||
324 | } | ||
309 | } | 325 | } |
310 | 326 | ||
311 | static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { | 327 | static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { |
@@ -1193,6 +1209,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
1193 | if (!sinfo->config) | 1209 | if (!sinfo->config) |
1194 | goto free_info; | 1210 | goto free_info; |
1195 | 1211 | ||
1212 | sinfo->reg_lcd = devm_regulator_get(&pdev->dev, "lcd"); | ||
1213 | if (IS_ERR(sinfo->reg_lcd)) | ||
1214 | sinfo->reg_lcd = NULL; | ||
1215 | |||
1196 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; | 1216 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; |
1197 | info->pseudo_palette = sinfo->pseudo_palette; | 1217 | info->pseudo_palette = sinfo->pseudo_palette; |
1198 | info->fbops = &atmel_lcdfb_ops; | 1218 | info->fbops = &atmel_lcdfb_ops; |