diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2010-02-08 23:36:18 +0000 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2010-02-08 23:36:18 +0000 |
commit | 7c8f9f56301c4d6a6e3bcfc89e407dc5289f5b42 (patch) | |
tree | 261745eac1dc4083fad02efd0f88fd189fc9f91f | |
parent | 6f3db147b68d6cb6557f6857b90bf6c67afbcf1f (diff) | |
download | mtk-20170518-7c8f9f56301c4d6a6e3bcfc89e407dc5289f5b42.zip mtk-20170518-7c8f9f56301c4d6a6e3bcfc89e407dc5289f5b42.tar.gz mtk-20170518-7c8f9f56301c4d6a6e3bcfc89e407dc5289f5b42.tar.bz2 |
jz4740_fb: Do not disable lcd clock during blanking. Only during suspend.
SVN-Revision: 19561
-rw-r--r-- | target/linux/xburst/files-2.6.32/drivers/video/jz4740_fb.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/target/linux/xburst/files-2.6.32/drivers/video/jz4740_fb.c b/target/linux/xburst/files-2.6.32/drivers/video/jz4740_fb.c index 7aac458..ec4fe6d 100644 --- a/target/linux/xburst/files-2.6.32/drivers/video/jz4740_fb.c +++ b/target/linux/xburst/files-2.6.32/drivers/video/jz4740_fb.c @@ -167,12 +167,11 @@ int jzfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, static int jzfb_get_controller_bpp(struct jzfb *jzfb) { switch(jzfb->pdata->bpp) { - case 18: - case 24: - return 32; - break; - default: - return jzfb->pdata->bpp; + case 18: + case 24: + return 32; + default: + return jzfb->pdata->bpp; } } @@ -305,7 +304,7 @@ static int jzfb_set_par(struct fb_info *info) static int jzfb_blank(int blank_mode, struct fb_info *info) { struct jzfb* jzfb = info->par; - uint32_t ctrl = readl(jzfb->base + JZ_REG_LCD_CTRL); + uint32_t ctrl; switch (blank_mode) { case FB_BLANK_UNBLANK: @@ -313,13 +312,13 @@ static int jzfb_blank(int blank_mode, struct fb_info *info) return 0; jz_gpio_bulk_resume(jz_lcd_pins, ARRAY_SIZE(jz_lcd_pins)); - clk_enable(jzfb->ldclk); clk_enable(jzfb->lpclk); writel(0, jzfb->base + JZ_REG_LCD_STATE); writel(jzfb->framedesc->next, jzfb->base + JZ_REG_LCD_DA0); + ctrl = readl(jzfb->base + JZ_REG_LCD_CTRL); ctrl |= JZ_LCD_CTRL_ENABLE; ctrl &= ~JZ_LCD_CTRL_DISABLE; writel(ctrl, jzfb->base + JZ_REG_LCD_CTRL); @@ -330,6 +329,7 @@ static int jzfb_blank(int blank_mode, struct fb_info *info) if (!jzfb->is_enabled) return 0; + ctrl = readl(jzfb->base + JZ_REG_LCD_CTRL); ctrl |= JZ_LCD_CTRL_DISABLE; writel(ctrl, jzfb->base + JZ_REG_LCD_CTRL); do { @@ -337,7 +337,6 @@ static int jzfb_blank(int blank_mode, struct fb_info *info) } while (!(ctrl & JZ_LCD_STATE_DISABLED)); clk_disable(jzfb->lpclk); - clk_disable(jzfb->ldclk); jz_gpio_bulk_suspend(jz_lcd_pins, ARRAY_SIZE(jz_lcd_pins)); jzfb->is_enabled = 0; break; @@ -511,6 +510,8 @@ static int __devinit jzfb_probe(struct platform_device *pdev) fb_alloc_cmap(&fb->cmap, 256, 0); + clk_enable(jzfb->ldclk); + jzfb_set_par(fb); writel(jzfb->framedesc->next, jzfb->base + JZ_REG_LCD_DA0); @@ -547,12 +548,44 @@ static int __devexit jzfb_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM + +static int jzfb_suspend(struct device *dev) +{ + struct jzfb *jzfb = dev_get_drvdata(dev); + clk_disable(jzfb->ldclk); + + return 0; +} + +static int jzfb_resume(struct device *dev) +{ + struct jzfb *jzfb = dev_get_drvdata(dev); + clk_enable(jzfb->ldclk); + + return 0; +} + +static const struct dev_pm_ops jzfb_pm_ops = { + .suspend = jzfb_suspend, + .resume = jzfb_resume, + .poweroff = jzfb_suspend, + .restore = jzfb_resume, +}; + +#define JZFB_PM_OPS (&jzfb_pm_ops) + +#else +#define JZFB_PM_OPS NULL +#endif + static struct platform_driver jzfb_driver = { .probe = jzfb_probe, .remove = __devexit_p(jzfb_remove), .driver = { .name = "jz4740-fb", + .pm = JZFB_PM_OPS, }, }; |