MLK-13714 video: mxsfb: fix the overlay wrong offset issue
authorFancy Fang <chen.fang@nxp.com>
Tue, 3 Jan 2017 09:26:42 +0000 (17:26 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:58:17 +0000 (14:58 -0500)
The overlay function should be enabled when the lcdif is disabled
to make them synchronous. Otherwise, there will be offset for the
overlay surface when display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
drivers/video/fbdev/mxsfb.c

index 2a286a1..1419566 100644 (file)
@@ -1557,11 +1557,23 @@ static void overlayfb_enable(struct mxsfb_layer *ofb)
        uint32_t as_ctrl = 0x0;
        struct mxsfb_info *fbi = ofb->fbi;
 
+       lock_fb_info(fbi->fb_info);
+       if (fbi->cur_blank == FB_BLANK_UNBLANK) {
+               mxsfb_disable_controller(fbi->fb_info);
+               writel(CTRL1_FIFO_CLEAR, fbi->base + LCDC_CTRL1 + REG_SET);
+       }
+
        /* enable AS */
        as_ctrl = readl(fbi->base + LCDC_AS_CTRL);
        as_ctrl |= 0x1;
 
        writel(as_ctrl, fbi->base + LCDC_AS_CTRL);
+
+       if (fbi->cur_blank == FB_BLANK_UNBLANK) {
+               writel(CTRL1_FIFO_CLEAR, fbi->base + LCDC_CTRL1 + REG_CLR);
+               mxsfb_enable_controller(fbi->fb_info);
+       }
+       unlock_fb_info(fbi->fb_info);
 }
 
 static void overlayfb_disable(struct mxsfb_layer *ofb)
@@ -1569,10 +1581,8 @@ static void overlayfb_disable(struct mxsfb_layer *ofb)
        uint32_t as_ctrl = 0x0;
        struct mxsfb_info *fbi = ofb->fbi;
 
-       as_ctrl = readl(fbi->base + LCDC_AS_CTRL);
-       as_ctrl &= 0xfffffffe;
-
        writel(as_ctrl, fbi->base + LCDC_AS_CTRL);
+       writel(0x0, fbi->base + LCDC_AS_NEXT_BUF);
 }
 
 static void overlayfb_setup(struct mxsfb_layer *ofb)