@@ -134,6 +134,7 @@ struct imxfb_info {
struct clk *clk_ipg;
struct clk *clk_ahb;
struct clk *clk_per;
+ int enabled;
/*
* These are the addresses we mapped
@@ -513,47 +514,53 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi)
static void imxfb_enable_controller(struct imxfb_info *fbi)
{
- pr_debug("Enabling LCD controller\n");
+ if (!fbi->enabled) {
+ pr_debug("Enabling LCD controller\n");
- writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
+ writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
- /* panning offset 0 (0 pixel offset) */
- writel(0x00000000, fbi->regs + LCDC_POS);
+ /* panning offset 0 (0 pixel offset) */
+ writel(0x00000000, fbi->regs + LCDC_POS);
- /* disable hardware cursor */
- writel(readl(fbi->regs + LCDC_CPOS) & ~(CPOS_CC0 | CPOS_CC1),
- fbi->regs + LCDC_CPOS);
+ /* disable hardware cursor */
+ writel(readl(fbi->regs + LCDC_CPOS) & ~(CPOS_CC0 | CPOS_CC1),
+ fbi->regs + LCDC_CPOS);
- /*
- * RMCR_LCDC_EN_MX1 is present on i.MX1 only, but doesn't hurt
- * on other SoCs
- */
- writel(RMCR_LCDC_EN_MX1, fbi->regs + LCDC_RMCR);
+ /*
+ * RMCR_LCDC_EN_MX1 is present on i.MX1 only, but doesn't hurt
+ * on other SoCs
+ */
+ writel(RMCR_LCDC_EN_MX1, fbi->regs + LCDC_RMCR);
- clk_prepare_enable(fbi->clk_ipg);
- clk_prepare_enable(fbi->clk_ahb);
- clk_prepare_enable(fbi->clk_per);
+ clk_prepare_enable(fbi->clk_ipg);
+ clk_prepare_enable(fbi->clk_ahb);
+ clk_prepare_enable(fbi->clk_per);
+ fbi->enabled = 1;
- if (fbi->backlight_power)
- fbi->backlight_power(1);
- if (fbi->lcd_power)
- fbi->lcd_power(1);
+ if (fbi->backlight_power)
+ fbi->backlight_power(1);
+ if (fbi->lcd_power)
+ fbi->lcd_power(1);
+ }
}
static void imxfb_disable_controller(struct imxfb_info *fbi)
{
- pr_debug("Disabling LCD controller\n");
+ if (fbi->enabled) {
+ pr_debug("Disabling LCD controller\n");
- if (fbi->backlight_power)
- fbi->backlight_power(0);
- if (fbi->lcd_power)
- fbi->lcd_power(0);
+ if (fbi->backlight_power)
+ fbi->backlight_power(0);
+ if (fbi->lcd_power)
+ fbi->lcd_power(0);
- clk_disable_unprepare(fbi->clk_per);
- clk_disable_unprepare(fbi->clk_ipg);
- clk_disable_unprepare(fbi->clk_ahb);
+ clk_disable_unprepare(fbi->clk_per);
+ clk_disable_unprepare(fbi->clk_ipg);
+ clk_disable_unprepare(fbi->clk_ahb);
+ fbi->enabled = 0;
- writel(0, fbi->regs + LCDC_RMCR);
+ writel(0, fbi->regs + LCDC_RMCR);
+ }
}
static int imxfb_blank(int blank, struct fb_info *info)