aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAlexandre Courbot <gnurou@gmail.com>2011-02-23 03:36:30 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-03-29 03:04:39 -0400
commit8857b9aa7e64a70852545ee01fa638481cb08a76 (patch)
treefdf011896d06c9e5523206549f833db3343fb9a7 /drivers/video
parentbacbe55b63d434b7a33f01a03628b6302c75417b (diff)
fbdev: sh_mobile_lcdcfb: add blanking support
Add a blanking callback to the LCDC driver in order to support both FBIOBLANK and TIOCLINUX blanking ioctls. LCDC clocks are also released if the requested blanking level is superior to FB_BLANK_NORMAL, to allow runtime PM to disable the clocks if possible. Signed-off-by: Alexandre Courbot <gnurou@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c44
-rw-r--r--drivers/video/sh_mobile_lcdcfb.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e040e46d7d9..65c4ee3628c 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -977,6 +977,49 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
977 return 0; 977 return 0;
978} 978}
979 979
980/*
981 * Screen blanking. Behavior is as follows:
982 * FB_BLANK_UNBLANK: screen unblanked, clocks enabled
983 * FB_BLANK_NORMAL: screen blanked, clocks enabled
984 * FB_BLANK_VSYNC,
985 * FB_BLANK_HSYNC,
986 * FB_BLANK_POWEROFF: screen blanked, clocks disabled
987 */
988static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
989{
990 struct sh_mobile_lcdc_chan *ch = info->par;
991 struct sh_mobile_lcdc_priv *p = ch->lcdc;
992
993 /* blank the screen? */
994 if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) {
995 struct fb_fillrect rect = {
996 .width = info->var.xres,
997 .height = info->var.yres,
998 };
999 sh_mobile_lcdc_fillrect(info, &rect);
1000 }
1001 /* turn clocks on? */
1002 if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) {
1003 sh_mobile_lcdc_clk_on(p);
1004 }
1005 /* turn clocks off? */
1006 if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) {
1007 /* make sure the screen is updated with the black fill before
1008 * switching the clocks off. one vsync is not enough since
1009 * blanking may occur in the middle of a refresh. deferred io
1010 * mode will reenable the clocks and update the screen in time,
1011 * so it does not need this. */
1012 if (!info->fbdefio) {
1013 sh_mobile_wait_for_vsync(info);
1014 sh_mobile_wait_for_vsync(info);
1015 }
1016 sh_mobile_lcdc_clk_off(p);
1017 }
1018
1019 ch->blank_status = blank;
1020 return 0;
1021}
1022
980static struct fb_ops sh_mobile_lcdc_ops = { 1023static struct fb_ops sh_mobile_lcdc_ops = {
981 .owner = THIS_MODULE, 1024 .owner = THIS_MODULE,
982 .fb_setcolreg = sh_mobile_lcdc_setcolreg, 1025 .fb_setcolreg = sh_mobile_lcdc_setcolreg,
@@ -985,6 +1028,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
985 .fb_fillrect = sh_mobile_lcdc_fillrect, 1028 .fb_fillrect = sh_mobile_lcdc_fillrect,
986 .fb_copyarea = sh_mobile_lcdc_copyarea, 1029 .fb_copyarea = sh_mobile_lcdc_copyarea,
987 .fb_imageblit = sh_mobile_lcdc_imageblit, 1030 .fb_imageblit = sh_mobile_lcdc_imageblit,
1031 .fb_blank = sh_mobile_lcdc_blank,
988 .fb_pan_display = sh_mobile_fb_pan_display, 1032 .fb_pan_display = sh_mobile_fb_pan_display,
989 .fb_ioctl = sh_mobile_ioctl, 1033 .fb_ioctl = sh_mobile_ioctl,
990 .fb_open = sh_mobile_open, 1034 .fb_open = sh_mobile_open,
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index 03a22dcbcc5..fad353a7e44 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -37,6 +37,7 @@ struct sh_mobile_lcdc_chan {
37 struct completion vsync_completion; 37 struct completion vsync_completion;
38 struct fb_var_screeninfo display_var; 38 struct fb_var_screeninfo display_var;
39 int use_count; 39 int use_count;
40 int blank_status;
40 struct mutex open_lock; /* protects the use counter */ 41 struct mutex open_lock; /* protects the use counter */
41}; 42};
42 43