diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2013-04-11 05:54:04 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-09-27 02:26:19 -0400 |
commit | 42110e91de7f66f6276afdec8040aedbb8c5a6fd (patch) | |
tree | c526b0fda02b293752c65da19b42b8431de14f0c | |
parent | 8af2c2869fd129bce0d0dfd86c6364c1096f9eff (diff) |
video: atmel_lcdfb: introduce atmel_lcdfb_power_control
to simplify the check on the presence of the callback
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 0d7214df1237..3c7609c1c6fe 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -288,6 +288,13 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo) | |||
288 | init_backlight(sinfo); | 288 | init_backlight(sinfo); |
289 | } | 289 | } |
290 | 290 | ||
291 | static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on) | ||
292 | { | ||
293 | struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; | ||
294 | |||
295 | if (pdata->atmel_lcdfb_power_control) | ||
296 | pdata->atmel_lcdfb_power_control(on); | ||
297 | } | ||
291 | 298 | ||
292 | static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { | 299 | static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { |
293 | .type = FB_TYPE_PACKED_PIXELS, | 300 | .type = FB_TYPE_PACKED_PIXELS, |
@@ -1122,8 +1129,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
1122 | fb_add_videomode(&fbmode, &info->modelist); | 1129 | fb_add_videomode(&fbmode, &info->modelist); |
1123 | 1130 | ||
1124 | /* Power up the LCDC screen */ | 1131 | /* Power up the LCDC screen */ |
1125 | if (pdata->atmel_lcdfb_power_control) | 1132 | atmel_lcdfb_power_control(sinfo, 1); |
1126 | pdata->atmel_lcdfb_power_control(1); | ||
1127 | 1133 | ||
1128 | dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n", | 1134 | dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n", |
1129 | info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base); | 1135 | info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base); |
@@ -1175,8 +1181,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
1175 | 1181 | ||
1176 | cancel_work_sync(&sinfo->task); | 1182 | cancel_work_sync(&sinfo->task); |
1177 | exit_backlight(sinfo); | 1183 | exit_backlight(sinfo); |
1178 | if (pdata->atmel_lcdfb_power_control) | 1184 | atmel_lcdfb_power_control(sinfo, 0); |
1179 | pdata->atmel_lcdfb_power_control(0); | ||
1180 | unregister_framebuffer(info); | 1185 | unregister_framebuffer(info); |
1181 | atmel_lcdfb_stop_clock(sinfo); | 1186 | atmel_lcdfb_stop_clock(sinfo); |
1182 | clk_put(sinfo->lcdc_clk); | 1187 | clk_put(sinfo->lcdc_clk); |
@@ -1203,7 +1208,6 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1203 | { | 1208 | { |
1204 | struct fb_info *info = platform_get_drvdata(pdev); | 1209 | struct fb_info *info = platform_get_drvdata(pdev); |
1205 | struct atmel_lcdfb_info *sinfo = info->par; | 1210 | struct atmel_lcdfb_info *sinfo = info->par; |
1206 | struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; | ||
1207 | 1211 | ||
1208 | /* | 1212 | /* |
1209 | * We don't want to handle interrupts while the clock is | 1213 | * We don't want to handle interrupts while the clock is |
@@ -1213,9 +1217,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1213 | 1217 | ||
1214 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR); | 1218 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR); |
1215 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); | 1219 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); |
1216 | if (pdata->atmel_lcdfb_power_control) | 1220 | atmel_lcdfb_power_control(sinfo, 0); |
1217 | pdata->atmel_lcdfb_power_control(0); | ||
1218 | |||
1219 | atmel_lcdfb_stop(sinfo); | 1221 | atmel_lcdfb_stop(sinfo); |
1220 | atmel_lcdfb_stop_clock(sinfo); | 1222 | atmel_lcdfb_stop_clock(sinfo); |
1221 | 1223 | ||
@@ -1226,12 +1228,10 @@ static int atmel_lcdfb_resume(struct platform_device *pdev) | |||
1226 | { | 1228 | { |
1227 | struct fb_info *info = platform_get_drvdata(pdev); | 1229 | struct fb_info *info = platform_get_drvdata(pdev); |
1228 | struct atmel_lcdfb_info *sinfo = info->par; | 1230 | struct atmel_lcdfb_info *sinfo = info->par; |
1229 | struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; | ||
1230 | 1231 | ||
1231 | atmel_lcdfb_start_clock(sinfo); | 1232 | atmel_lcdfb_start_clock(sinfo); |
1232 | atmel_lcdfb_start(sinfo); | 1233 | atmel_lcdfb_start(sinfo); |
1233 | if (pdata->atmel_lcdfb_power_control) | 1234 | atmel_lcdfb_power_control(sinfo, 1); |
1234 | pdata->atmel_lcdfb_power_control(1); | ||
1235 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); | 1235 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); |
1236 | 1236 | ||
1237 | /* Enable FIFO & DMA errors */ | 1237 | /* Enable FIFO & DMA errors */ |