From d6456697fa63719b245bf1cfe35b77e6ac7fe63c Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 19 Nov 2008 17:11:00 +0000 Subject: glamo_fb: Implement screen blanking This patch implements fb_blank() for the glamo-fb driver, which switches off the pixel clock (DCLK) for power saving. We currently delay the actual pixel clock switch until we enter FB_BLANK_POWERDOWN, since the backlight fade is slow and we don't want the user to see artefacts on the screen while the backlight is fading out. So since the X server first sends FB_BLANK_{V,H}SYNC_SUSPEND, we start the backlight fade here, and only once we get FB_BLANK_POWERDOWN the pixel clock is disabled. There are no measurements yet, but the power savings should be double, since there is no longer any generation of the high-frequency LCM signals, and there are no video-related SDRAM accesses anymore. Signed-off-by: Harald Welte --- drivers/mfd/glamo/glamo-fb.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'drivers/mfd/glamo/glamo-fb.c') diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c index 0bc6a1be63f..1ae933e9a3e 100644 --- a/drivers/mfd/glamo/glamo-fb.c +++ b/drivers/mfd/glamo/glamo-fb.c @@ -422,7 +422,34 @@ static int glamofb_set_par(struct fb_info *info) static int glamofb_blank(int blank_mode, struct fb_info *info) { - /* FIXME */ + struct glamofb_handle *gfb = info->par; + struct glamo_core *gcore = gfb->mach_info->glamo; + + dev_dbg(gfb->dev, "glamofb_blank(%u)\n", blank_mode); + + switch (blank_mode) { + case FB_BLANK_VSYNC_SUSPEND: + case FB_BLANK_HSYNC_SUSPEND: + /* FIXME: add pdata hook/flag to indicate whether + * we should already switch off pixel clock here */ + break; + case FB_BLANK_POWERDOWN: + /* disable the pixel clock */ + glamo_engine_clkreg_set(gcore, GLAMO_ENGINE_LCD, + GLAMO_CLOCK_LCD_EN_DCLK, 0); + break; + case FB_BLANK_UNBLANK: + case FB_BLANK_NORMAL: + /* enable the pixel clock */ + glamo_engine_clkreg_set(gcore, GLAMO_ENGINE_LCD, + GLAMO_CLOCK_LCD_EN_DCLK, + GLAMO_CLOCK_LCD_EN_DCLK); + break; + } + + /* FIXME: once we have proper clock management in glamo-core, + * we can determine if other units need MCLK1 or the PLL, and + * disable it if not used. */ return 0; } -- cgit v1.2.3