aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-09 09:45:43 -0400
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-12 17:40:43 -0400
commit37c5dcc21ddaa9f946c4d691996bb3076598b813 (patch)
tree419b910b8981d7961b6b658430f25e8cfeb33f63 /drivers
parent0a7f17aa3d6b693700af2e1cbf8cfdd28e18aebb (diff)
fbdev: sh_mobile_lcdc: Create functions to turn the display on/off
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index a805f96eb163..bd725a421921 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -224,7 +224,7 @@ static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
224} 224}
225 225
226/* ----------------------------------------------------------------------------- 226/* -----------------------------------------------------------------------------
227 * Sys panel and deferred I/O 227 * Display, panel and deferred I/O
228 */ 228 */
229 229
230static void lcdc_sys_write_index(void *handle, unsigned long data) 230static void lcdc_sys_write_index(void *handle, unsigned long data)
@@ -335,6 +335,27 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
335 schedule_delayed_work(&info->deferred_work, fbdefio->delay); 335 schedule_delayed_work(&info->deferred_work, fbdefio->delay);
336} 336}
337 337
338static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
339{
340 struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
341
342 /* HDMI must be enabled before LCDC configuration */
343 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
344 board_cfg->display_on(board_cfg->board_data, ch->info);
345 module_put(board_cfg->owner);
346 }
347}
348
349static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
350{
351 struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
352
353 if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
354 board_cfg->display_off(board_cfg->board_data);
355 module_put(board_cfg->owner);
356 }
357}
358
338/* ----------------------------------------------------------------------------- 359/* -----------------------------------------------------------------------------
339 * Format helpers 360 * Format helpers
340 */ 361 */
@@ -648,7 +669,6 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
648static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) 669static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
649{ 670{
650 struct sh_mobile_meram_info *mdev = priv->meram_dev; 671 struct sh_mobile_meram_info *mdev = priv->meram_dev;
651 struct sh_mobile_lcdc_board_cfg *board_cfg;
652 struct sh_mobile_lcdc_chan *ch; 672 struct sh_mobile_lcdc_chan *ch;
653 unsigned long tmp; 673 unsigned long tmp;
654 int ret; 674 int ret;
@@ -665,8 +685,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
665 lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0); 685 lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
666 686
667 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { 687 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
668 ch = &priv->ch[k]; 688 struct sh_mobile_lcdc_board_cfg *board_cfg;
669 689
690 ch = &priv->ch[k];
670 if (!ch->enabled) 691 if (!ch->enabled)
671 continue; 692 continue;
672 693
@@ -754,11 +775,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
754 fb_deferred_io_init(ch->info); 775 fb_deferred_io_init(ch->info);
755 } 776 }
756 777
757 board_cfg = &ch->cfg.board_cfg; 778 sh_mobile_lcdc_display_on(ch);
758 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
759 board_cfg->display_on(board_cfg->board_data, ch->info);
760 module_put(board_cfg->owner);
761 }
762 779
763 if (ch->bl) { 780 if (ch->bl) {
764 ch->bl->props.power = FB_BLANK_UNBLANK; 781 ch->bl->props.power = FB_BLANK_UNBLANK;
@@ -772,7 +789,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
772static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) 789static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
773{ 790{
774 struct sh_mobile_lcdc_chan *ch; 791 struct sh_mobile_lcdc_chan *ch;
775 struct sh_mobile_lcdc_board_cfg *board_cfg;
776 int k; 792 int k;
777 793
778 /* clean up deferred io and ask board code to disable panel */ 794 /* clean up deferred io and ask board code to disable panel */
@@ -799,11 +815,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
799 backlight_update_status(ch->bl); 815 backlight_update_status(ch->bl);
800 } 816 }
801 817
802 board_cfg = &ch->cfg.board_cfg; 818 sh_mobile_lcdc_display_off(ch);
803 if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
804 board_cfg->display_off(board_cfg->board_data);
805 module_put(board_cfg->owner);
806 }
807 819
808 /* disable the meram */ 820 /* disable the meram */
809 if (ch->meram_enabled) { 821 if (ch->meram_enabled) {
@@ -1417,7 +1429,6 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
1417 struct fb_event *event = data; 1429 struct fb_event *event = data;
1418 struct fb_info *info = event->info; 1430 struct fb_info *info = event->info;
1419 struct sh_mobile_lcdc_chan *ch = info->par; 1431 struct sh_mobile_lcdc_chan *ch = info->par;
1420 struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
1421 1432
1422 if (&ch->lcdc->notifier != nb) 1433 if (&ch->lcdc->notifier != nb)
1423 return NOTIFY_DONE; 1434 return NOTIFY_DONE;
@@ -1427,10 +1438,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
1427 1438
1428 switch(action) { 1439 switch(action) {
1429 case FB_EVENT_SUSPEND: 1440 case FB_EVENT_SUSPEND:
1430 if (board_cfg->display_off && try_module_get(board_cfg->owner)) { 1441 sh_mobile_lcdc_display_off(ch);
1431 board_cfg->display_off(board_cfg->board_data);
1432 module_put(board_cfg->owner);
1433 }
1434 sh_mobile_lcdc_stop(ch->lcdc); 1442 sh_mobile_lcdc_stop(ch->lcdc);
1435 break; 1443 break;
1436 case FB_EVENT_RESUME: 1444 case FB_EVENT_RESUME:
@@ -1438,12 +1446,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
1438 sh_mobile_fb_reconfig(info); 1446 sh_mobile_fb_reconfig(info);
1439 mutex_unlock(&ch->open_lock); 1447 mutex_unlock(&ch->open_lock);
1440 1448
1441 /* HDMI must be enabled before LCDC configuration */ 1449 sh_mobile_lcdc_display_on(ch);
1442 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
1443 board_cfg->display_on(board_cfg->board_data, info);
1444 module_put(board_cfg->owner);
1445 }
1446
1447 sh_mobile_lcdc_start(ch->lcdc); 1450 sh_mobile_lcdc_start(ch->lcdc);
1448 } 1451 }
1449 1452