aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/s3c2410fb.c
diff options
context:
space:
mode:
authorBen Dooks <ben-fbdev@fluff.org>2008-05-23 16:04:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-24 12:56:12 -0400
commit673b4600e3b3cc6689025e6a6fc6909b6e53dd5e (patch)
treeafba1323b00cbe79dff7532b33912fd41fb30dd9 /drivers/video/s3c2410fb.c
parentcdc83ae2453ddb19060e05e6afd22b1254128c42 (diff)
S3C2410: ensure that FB_BLANK_POWERDOWN shuts down the controller
When a blank level of FB_BLANK_POWERDOWN is used, we should shut down the controller so that it no longer tries to produce any panel signals or data, and shuts down the DMA which is not needed. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Cc: Arnaud Patard <arnaud.patard@rtp-net.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/s3c2410fb.c')
-rw-r--r--drivers/video/s3c2410fb.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 13b38cbbe4cf..2219ae56a0e6 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -580,6 +580,27 @@ static int s3c2410fb_setcolreg(unsigned regno,
580 return 0; 580 return 0;
581} 581}
582 582
583/* s3c2410fb_lcd_enable
584 *
585 * shutdown the lcd controller
586 */
587static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable)
588{
589 unsigned long flags;
590
591 local_irq_save(flags);
592
593 if (enable)
594 fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID;
595 else
596 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
597
598 writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
599
600 local_irq_restore(flags);
601}
602
603
583/* 604/*
584 * s3c2410fb_blank 605 * s3c2410fb_blank
585 * @blank_mode: the blank mode we want. 606 * @blank_mode: the blank mode we want.
@@ -589,9 +610,6 @@ static int s3c2410fb_setcolreg(unsigned regno,
589 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a 610 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a
590 * video mode which doesn't support it. Implements VESA suspend 611 * video mode which doesn't support it. Implements VESA suspend
591 * and powerdown modes on hardware that supports disabling hsync/vsync: 612 * and powerdown modes on hardware that supports disabling hsync/vsync:
592 * blank_mode == 2: suspend vsync
593 * blank_mode == 3: suspend hsync
594 * blank_mode == 4: powerdown
595 * 613 *
596 * Returns negative errno on error, or zero on success. 614 * Returns negative errno on error, or zero on success.
597 * 615 *
@@ -605,6 +623,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info)
605 623
606 tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; 624 tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL;
607 625
626 if (blank_mode == FB_BLANK_POWERDOWN) {
627 s3c2410fb_lcd_enable(fbi, 0);
628 } else {
629 s3c2410fb_lcd_enable(fbi, 1);
630 }
631
608 if (blank_mode == FB_BLANK_UNBLANK) 632 if (blank_mode == FB_BLANK_UNBLANK)
609 writel(0x0, tpal_reg); 633 writel(0x0, tpal_reg);
610 else { 634 else {
@@ -983,21 +1007,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev)
983 return s3c24xxfb_probe(pdev, DRV_S3C2412); 1007 return s3c24xxfb_probe(pdev, DRV_S3C2412);
984} 1008}
985 1009
986/* s3c2410fb_stop_lcd
987 *
988 * shutdown the lcd controller
989 */
990static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi)
991{
992 unsigned long flags;
993
994 local_irq_save(flags);
995
996 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
997 writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
998
999 local_irq_restore(flags);
1000}
1001 1010
1002/* 1011/*
1003 * Cleanup 1012 * Cleanup
@@ -1010,7 +1019,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
1010 1019
1011 unregister_framebuffer(fbinfo); 1020 unregister_framebuffer(fbinfo);
1012 1021
1013 s3c2410fb_stop_lcd(info); 1022 s3c2410fb_lcd_enable(info, 0);
1014 msleep(1); 1023 msleep(1);
1015 1024
1016 s3c2410fb_unmap_video_memory(fbinfo); 1025 s3c2410fb_unmap_video_memory(fbinfo);
@@ -1043,7 +1052,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
1043 struct fb_info *fbinfo = platform_get_drvdata(dev); 1052 struct fb_info *fbinfo = platform_get_drvdata(dev);
1044 struct s3c2410fb_info *info = fbinfo->par; 1053 struct s3c2410fb_info *info = fbinfo->par;
1045 1054
1046 s3c2410fb_stop_lcd(info); 1055 s3c2410fb_lcd_enable(info, 0);
1047 1056
1048 /* sleep before disabling the clock, we need to ensure 1057 /* sleep before disabling the clock, we need to ensure
1049 * the LCD DMA engine is not going to get back on the bus 1058 * the LCD DMA engine is not going to get back on the bus