From: yxj Date: Tue, 29 Jan 2013 13:57:24 +0000 (+0800) Subject: rk2928 rk30xx rk3188 lcdc:load screen in lcdc open,fix rgb swap X-Git-Tag: firefly_0821_release~7700 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7d79b8d2fd789f814fb48333c961352d6c8e5940;p=firefly-linux-kernel-4.4.55.git rk2928 rk30xx rk3188 lcdc:load screen in lcdc open,fix rgb swap --- diff --git a/drivers/video/rockchip/lcdc/rk2928_lcdc.c b/drivers/video/rockchip/lcdc/rk2928_lcdc.c index c920611325b5..d43ce959d108 100644 --- a/drivers/video/rockchip/lcdc/rk2928_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk2928_lcdc.c @@ -526,6 +526,7 @@ static int win0_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, u32 ScaleYrgbY = 0x1000; u32 ScaleCbrX = 0x1000; u32 ScaleCbrY = 0x1000; + u8 fmt_cfg = 0; xact = par->xact; //active (origin) picture window width/height yact = par->yact; @@ -536,33 +537,49 @@ static int win0_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, ScaleYrgbX = CalScale(xact, par->xsize); //both RGB and yuv need this two factor ScaleYrgbY = CalScale(yact, par->ysize); + + DBG(1,"%s for lcdc%d>>format:%d>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d>>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", + __func__,lcdc_dev->id,par->format,xact,yact,par->xsize,par->ysize,xvir,yvir,xpos,ypos); switch (par->format) { + case XBGR888: + case ABGR888: + case ARGB888: + fmt_cfg = 0; + break; + case RGB888: + fmt_cfg = 1; + break; + case RGB565: + fmt_cfg = 2; + break; case YUV422:// yuv422 + fmt_cfg = 5; ScaleCbrX = CalScale((xact/2), par->xsize); ScaleCbrY = CalScale(yact, par->ysize); break; case YUV420: // yuv420 + fmt_cfg = 4; ScaleCbrX = CalScale(xact/2, par->xsize); ScaleCbrY = CalScale(yact/2, par->ysize); break; case YUV444:// yuv444 + fmt_cfg = 6; ScaleCbrX = CalScale(xact, par->xsize); ScaleCbrY = CalScale(yact, par->ysize); break; default: - break; + printk("%s:un supported format\n",__func__); + break; } - DBG(1,"%s for lcdc%d>>format:%d>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d>>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", - __func__,lcdc_dev->id,par->format,xact,yact,par->xsize,par->ysize,xvir,yvir,xpos,ypos); spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) { LcdWrReg(lcdc_dev, WIN0_SCL_FACTOR_YRGB, v_X_SCL_FACTOR(ScaleYrgbX) | v_Y_SCL_FACTOR(ScaleYrgbY)); LcdWrReg(lcdc_dev, WIN0_SCL_FACTOR_CBR,v_X_SCL_FACTOR(ScaleCbrX)| v_Y_SCL_FACTOR(ScaleCbrY)); - LcdMskReg(lcdc_dev, SYS_CFG, m_W0_FORMAT, v_W0_FORMAT(par->format)); //(inf->video_mode==0) + LcdMskReg(lcdc_dev, SYS_CFG, m_W0_FORMAT, v_W0_FORMAT(fmt_cfg)); //(inf->video_mode==0) LcdWrReg(lcdc_dev, WIN0_ACT_INFO,v_ACT_WIDTH(xact) | v_ACT_HEIGHT(yact)); LcdWrReg(lcdc_dev, WIN0_DSP_ST, v_DSP_STX(xpos) | v_DSP_STY(ypos)); LcdWrReg(lcdc_dev, WIN0_DSP_INFO, v_DSP_WIDTH(par->xsize)| v_DSP_HEIGHT(par->ysize)); @@ -570,23 +587,33 @@ static int win0_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, v_COLORKEY_EN(1) | v_KEYCOLOR(0)); switch(par->format) { - case ARGB888: + case XBGR888: LcdMskReg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_WIN0_ARGB888_VIRWIDTH(xvir)); - //LcdMskReg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W0_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + break; + case ARGB888: + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_WIN0_ARGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W0_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); + break; + case ABGR888: + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_WIN0_ARGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W0_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); break; case RGB888: //rgb888 - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_WIN0_RGB888_VIRWIDTH(xvir)); - //LcdMskReg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_WIN0_RGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); break; case RGB565: //rgb565 - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_WIN0_RGB565_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_WIN0_RGB565_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,DSP_CTRL,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); break; case YUV422: case YUV420: - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_WIN0_YUV_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN0_VIR,v_WIN0_YUV_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); break; default: - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN0_VIR,v_WIN0_RGB888_VIRWIDTH(xvir)); + printk("%s:un supported format\n",__func__); break; } @@ -606,6 +633,7 @@ static int win1_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, u32 ScaleYrgbY = 0x1000; u32 ScaleCbrX = 0x1000; u32 ScaleCbrY = 0x1000; + u8 fmt_cfg = 0; xact = par->xact; yact = par->yact; @@ -621,7 +649,6 @@ static int win1_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) { - LcdMskReg(lcdc_dev,SYS_CFG, m_W1_FORMAT, v_W1_FORMAT(par->format)); LcdWrReg(lcdc_dev, WIN1_DSP_ST,v_DSP_STX(xpos) | v_DSP_STY(ypos)); LcdWrReg(lcdc_dev, WIN1_DSP_INFO,v_DSP_WIDTH(par->xsize) | v_DSP_HEIGHT(par->ysize)); // enable win1 color key and set the color to black(rgb=0) @@ -629,24 +656,33 @@ static int win1_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, switch(par->format) - { - case ARGB888: - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); - //LcdMskReg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); - break; - case RGB888: //rgb888 - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_RGB888_VIRWIDTH(xvir)); - // LcdMskReg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); - break; - case RGB565: //rgb565 - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_RGB565_VIRWIDTH(xvir)); - break; - default: - LcdMskReg(lcdc_dev, WIN_VIR,m_WIN1_VIR,v_WIN1_RGB888_VIRWIDTH(xvir)); - break; + { + case XBGR888: + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + break; + case ABGR888: + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + break; + case ARGB888: + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN1_VIR,v_WIN1_ARGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); + break; + case RGB888: //rgb888 + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN1_VIR,v_WIN1_RGB888_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,DSP_CTRL,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); + break; + case RGB565: //rgb565 + LcdMskReg(lcdc_dev,WIN_VIR,m_WIN1_VIR,v_WIN1_RGB565_VIRWIDTH(xvir)); + LcdMskReg(lcdc_dev,SYS_CFG,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); + break; + default: + printk("%s:un supported format\n",__func__); + break; } - + LcdMskReg(lcdc_dev,SYS_CFG, m_W1_FORMAT, v_W1_FORMAT(fmt_cfg)); //LCDC_REG_CFG_DONE(); } spin_unlock(&lcdc_dev->reg_lock); @@ -656,6 +692,11 @@ static int win1_set_par(struct rk2928_lcdc_device *lcdc_dev,rk_screen *screen, static int rk2928_lcdc_open(struct rk_lcdc_device_driver *dev_drv,int layer_id,bool open) { struct rk2928_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk2928_lcdc_device,driver); + + if(open) + { + rk2928_load_screen(dev_drv,1); + } if(layer_id == 0) { win0_open(lcdc_dev,open); diff --git a/drivers/video/rockchip/lcdc/rk2928_lcdc.h b/drivers/video/rockchip/lcdc/rk2928_lcdc.h index 438da69bbf10..c32c64175fbc 100644 --- a/drivers/video/rockchip/lcdc/rk2928_lcdc.h +++ b/drivers/video/rockchip/lcdc/rk2928_lcdc.h @@ -70,6 +70,8 @@ typedef volatile struct tagLCDC_REG #define m_HWC_EN (1<<2) #define m_W0_FORMAT (7<<3) #define m_W1_FORMAT (7<<6) +#define m_W0_RGB_RB_SWAP (1<<10) +#define m_W1_RGB_RB_SWAP (1<<14) #define m_W0_AXI_OUTSTANDING_DISABLE (1<<16) #define m_W1_AXI_OUTSTANDING_DISABLE (1<<17) @@ -84,8 +86,10 @@ typedef volatile struct tagLCDC_REG #define v_HWC_EN(x) (((x)&1)<<2) #define v_W0_FORMAT(x) (((x)&7)<<3) #define v_W1_FORMAT(x) (((x)&7)<<6) -#define v_LCDC_STANDBY(x) (((x)&1)<<22) +#define v_W0_RGB_RB_SWAP(x) (((x)&1)<<10) +#define v_W1_RGB_RB_SWAP(x) (((x)&1)<<14) +#define v_LCDC_STANDBY(x) (((x)&1)<<22) #define v_LCDC_AXICLK_AUTO_ENABLE(x) (((x)&1)<<24) #define v_DSP_OUT_ZERO(x) (((x)&1)<<25) diff --git a/drivers/video/rockchip/lcdc/rk3066b_lcdc.c b/drivers/video/rockchip/lcdc/rk3066b_lcdc.c index e096db77089a..d30d29b286c8 100755 --- a/drivers/video/rockchip/lcdc/rk3066b_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3066b_lcdc.c @@ -434,11 +434,15 @@ static int win0_set_par(struct rk3066b_lcdc_device *lcdc_dev,rk_screen *screen, xpos = par->xpos+screen->left_margin + screen->hsync_len; ypos = par->ypos+screen->upper_margin + screen->vsync_len; + DBG(1,"%s for lcdc%d>>format:%d>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d>>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", + __func__,lcdc_dev->id,par->format,xact,yact,par->xsize,par->ysize,xvir,yvir,xpos,ypos); ScaleYrgbX = CalScale(xact, par->xsize); //both RGB and yuv need this two factor ScaleYrgbY = CalScale(yact, par->ysize); switch (par->format) { + case XBGR888: + case ABGR888: case ARGB888: fmt_cfg = 0; break; @@ -461,11 +465,10 @@ static int win0_set_par(struct rk3066b_lcdc_device *lcdc_dev,rk_screen *screen, ScaleCbrY = CalScale(yact, par->ysize); break; default: + printk("%s:un supported format\n",__func__); break; } - DBG(1,"%s for lcdc%d>>format:%d>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d>>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", - __func__,lcdc_dev->id,par->format,xact,yact,par->xsize,par->ysize,xvir,yvir,xpos,ypos); spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) @@ -510,6 +513,8 @@ static int win1_set_par(struct rk3066b_lcdc_device *lcdc_dev,rk_screen *screen, { switch (par->format) { + case XBGR888: + case ABGR888: case ARGB888: fmt_cfg = 0; break; @@ -517,6 +522,7 @@ static int win1_set_par(struct rk3066b_lcdc_device *lcdc_dev,rk_screen *screen, fmt_cfg = 1; break; default: + printk("%s:un supported format\n",__func__); break; } @@ -536,6 +542,11 @@ static int win1_set_par(struct rk3066b_lcdc_device *lcdc_dev,rk_screen *screen, static int rk3066b_lcdc_open(struct rk_lcdc_device_driver *dev_drv,int layer_id,bool open) { struct rk3066b_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk3066b_lcdc_device,driver); + + if(open) + { + rk3066b_load_screen(dev_drv,1); + } if(layer_id == 0) { win0_open(lcdc_dev,open); diff --git a/drivers/video/rockchip/lcdc/rk30_lcdc.c b/drivers/video/rockchip/lcdc/rk30_lcdc.c index f19f98792dff..e17609c57ead 100644 --- a/drivers/video/rockchip/lcdc/rk30_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk30_lcdc.c @@ -493,6 +493,7 @@ static int win0_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, u32 ScaleYrgbY = 0x1000; u32 ScaleCbrX = 0x1000; u32 ScaleCbrY = 0x1000; + u8 fmt_cfg = 0; xact = par->xact; //active (origin) picture window width/height yact = par->yact; @@ -501,36 +502,51 @@ static int win0_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, xpos = par->xpos+screen->left_margin + screen->hsync_len; ypos = par->ypos+screen->upper_margin + screen->vsync_len; + + DBG(1,"%s for lcdc%d>>format:%d>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d>>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", + __func__,lcdc_dev->id,par->format,xact,yact,par->xsize,par->ysize,xvir,yvir,xpos,ypos); ScaleYrgbX = CalScale(xact, par->xsize); //both RGB and yuv need this two factor ScaleYrgbY = CalScale(yact, par->ysize); switch (par->format) { + case ARGB888: + case XBGR888: + case ABGR888: + fmt_cfg = 0; + break; + case RGB888: + fmt_cfg = 1; + break; + case RGB565: + fmt_cfg = 2; + break; case YUV422:// yuv422 + fmt_cfg = 5; ScaleCbrX = CalScale((xact/2), par->xsize); ScaleCbrY = CalScale(yact, par->ysize); break; case YUV420: // yuv420 + fmt_cfg = 4; ScaleCbrX = CalScale(xact/2, par->xsize); ScaleCbrY = CalScale(yact/2, par->ysize); break; case YUV444:// yuv444 + fmt_cfg = 6; ScaleCbrX = CalScale(xact, par->xsize); ScaleCbrY = CalScale(yact, par->ysize); break; default: - break; + printk("%s un supported format\n",__func__); + break; } - DBG(1,"%s for lcdc%d>>format:%d>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d>>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", - __func__,lcdc_dev->id,par->format,xact,yact,par->xsize,par->ysize,xvir,yvir,xpos,ypos); - spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) { - lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_YRGB, v_X_SCL_FACTOR(ScaleYrgbX) | v_Y_SCL_FACTOR(ScaleYrgbY)); + lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_YRGB,v_X_SCL_FACTOR(ScaleYrgbX) | v_Y_SCL_FACTOR(ScaleYrgbY)); lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_CBR,v_X_SCL_FACTOR(ScaleCbrX)| v_Y_SCL_FACTOR(ScaleCbrY)); - lcdc_msk_reg(lcdc_dev, SYS_CTRL1, m_W0_FORMAT, v_W0_FORMAT(par->format)); //(inf->video_mode==0) + lcdc_msk_reg(lcdc_dev, SYS_CTRL1, m_W0_FORMAT, v_W0_FORMAT(fmt_cfg)); //(inf->video_mode==0) lcdc_writel(lcdc_dev, WIN0_ACT_INFO,v_ACT_WIDTH(xact) | v_ACT_HEIGHT(yact)); lcdc_writel(lcdc_dev, WIN0_DSP_ST, v_DSP_STX(xpos) | v_DSP_STY(ypos)); lcdc_writel(lcdc_dev, WIN0_DSP_INFO, v_DSP_WIDTH(par->xsize)| v_DSP_HEIGHT(par->ysize)); @@ -538,23 +554,33 @@ static int win0_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, v_COLORKEY_EN(1) | v_KEYCOLOR(0)); switch(par->format) { + case XBGR888: + lcdc_writel(lcdc_dev, WIN0_VIR,v_ARGB888_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); + break; case ARGB888: lcdc_writel(lcdc_dev, WIN0_VIR,v_ARGB888_VIRWIDTH(xvir)); - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); + break; + case ABGR888: + lcdc_writel(lcdc_dev, WIN0_VIR,v_ARGB888_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); break; case RGB888: //rgb888 lcdc_writel(lcdc_dev, WIN0_VIR,v_RGB888_VIRWIDTH(xvir)); - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); break; case RGB565: //rgb565 lcdc_writel(lcdc_dev, WIN0_VIR,v_RGB565_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); break; case YUV422: case YUV420: lcdc_writel(lcdc_dev, WIN0_VIR,v_YUV_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W0_RGB_RB_SWAP,v_W0_RGB_RB_SWAP(0)); break; default: - lcdc_writel(lcdc_dev, WIN0_VIR,v_RGB888_VIRWIDTH(xvir)); + printk("%s:un supported format\n",__func__); break; } @@ -574,6 +600,7 @@ static int win1_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, u32 ScaleYrgbY = 0x1000; u32 ScaleCbrX = 0x1000; u32 ScaleCbrY = 0x1000; + u8 fmt_cfg = 0; xact = par->xact; yact = par->yact; @@ -593,25 +620,40 @@ static int win1_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, { switch (par->format) { + case ARGB888: + case XBGR888: + case ABGR888: + fmt_cfg = 0; + break; + case RGB888: + fmt_cfg = 1; + break; + case RGB565: + fmt_cfg = 2; + break; case YUV422:// yuv422 + fmt_cfg = 5; ScaleCbrX = CalScale((xact/2), par->xsize); ScaleCbrY = CalScale(yact, par->ysize); break; case YUV420: // yuv420 + fmt_cfg = 4; ScaleCbrX = CalScale(xact/2, par->xsize); ScaleCbrY = CalScale(yact/2, par->ysize); break; case YUV444:// yuv444 + fmt_cfg = 6; ScaleCbrX = CalScale(xact, par->xsize); ScaleCbrY = CalScale(yact, par->ysize); break; default: + printk("%s:un supported format\n",__func__); break; } lcdc_writel(lcdc_dev, WIN1_SCL_FACTOR_YRGB, v_X_SCL_FACTOR(ScaleYrgbX) | v_Y_SCL_FACTOR(ScaleYrgbY)); lcdc_writel(lcdc_dev, WIN1_SCL_FACTOR_CBR, v_X_SCL_FACTOR(ScaleCbrX) | v_Y_SCL_FACTOR(ScaleCbrY)); - lcdc_msk_reg(lcdc_dev,SYS_CTRL1, m_W1_FORMAT, v_W1_FORMAT(par->format)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1, m_W1_FORMAT, v_W1_FORMAT(fmt_cfg)); lcdc_writel(lcdc_dev, WIN1_ACT_INFO,v_ACT_WIDTH(xact) | v_ACT_HEIGHT(yact)); lcdc_writel(lcdc_dev, WIN1_DSP_ST,v_DSP_STX(xpos) | v_DSP_STY(ypos)); lcdc_writel(lcdc_dev, WIN1_DSP_INFO,v_DSP_WIDTH(par->xsize) | v_DSP_HEIGHT(par->ysize)); @@ -619,23 +661,29 @@ static int win1_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, lcdc_msk_reg(lcdc_dev, WIN1_COLOR_KEY_CTRL, m_COLORKEY_EN | m_KEYCOLOR,v_COLORKEY_EN(1) | v_KEYCOLOR(0)); switch(par->format) { + case XBGR888: + lcdc_writel(lcdc_dev, WIN1_VIR,v_ARGB888_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + break; case ARGB888: lcdc_writel(lcdc_dev, WIN1_VIR,v_ARGB888_VIRWIDTH(xvir)); - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); break; case RGB888: //rgb888 lcdc_writel(lcdc_dev, WIN1_VIR,v_RGB888_VIRWIDTH(xvir)); - // lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); break; case RGB565: //rgb565 lcdc_writel(lcdc_dev, WIN1_VIR,v_RGB565_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); break; case YUV422: case YUV420: lcdc_writel(lcdc_dev, WIN1_VIR,v_YUV_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(0)); break; default: - lcdc_writel(lcdc_dev, WIN1_VIR,v_RGB888_VIRWIDTH(xvir)); + printk("%s:un supported formate\n",__func__); break; } @@ -653,6 +701,7 @@ static int win2_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, u32 ScaleYrgbY = 0x1000; u32 ScaleCbrX = 0x1000; u32 ScaleCbrY = 0x1000; + u8 fmt_cfg = 0; xact = par->xact; yact = par->yact; @@ -671,34 +720,43 @@ static int win2_set_par(struct rk30_lcdc_device *lcdc_dev,rk_screen *screen, if(likely(lcdc_dev->clk_on)) { - lcdc_msk_reg(lcdc_dev,SYS_CTRL1, m_W2_FORMAT, v_W2_FORMAT(par->format)); lcdc_writel(lcdc_dev, WIN2_DSP_ST,v_DSP_STX(xpos) | v_DSP_STY(ypos)); lcdc_writel(lcdc_dev, WIN2_DSP_INFO,v_DSP_WIDTH(par->xsize) | v_DSP_HEIGHT(par->ysize)); // enable win1 color key and set the color to black(rgb=0) lcdc_msk_reg(lcdc_dev, WIN2_COLOR_KEY_CTRL, m_COLORKEY_EN | m_KEYCOLOR,v_COLORKEY_EN(1) | v_KEYCOLOR(0)); switch(par->format) { + case XBGR888: + fmt_cfg = 0; + lcdc_writel(lcdc_dev, WIN2_VIR,v_ARGB888_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W2_RGB_RB_SWAP,v_W2_RGB_RB_SWAP(1)); + break; case ARGB888: + fmt_cfg = 0; lcdc_writel(lcdc_dev, WIN2_VIR,v_ARGB888_VIRWIDTH(xvir)); - //lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W2_RGB_RB_SWAP,v_W2_RGB_RB_SWAP(0)); + break; + case ABGR888: + fmt_cfg = 0; + lcdc_writel(lcdc_dev, WIN2_VIR,v_ARGB888_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W2_RGB_RB_SWAP,v_W2_RGB_RB_SWAP(1)); break; case RGB888: //rgb888 + fmt_cfg = 1; lcdc_writel(lcdc_dev, WIN2_VIR,v_RGB888_VIRWIDTH(xvir)); - // lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W1_RGB_RB_SWAP,v_W1_RGB_RB_SWAP(1)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W2_RGB_RB_SWAP,v_W2_RGB_RB_SWAP(0)); break; case RGB565: //rgb565 + fmt_cfg = 2; lcdc_writel(lcdc_dev, WIN2_VIR,v_RGB565_VIRWIDTH(xvir)); - break; - case YUV422: - case YUV420: - lcdc_writel(lcdc_dev, WIN2_VIR,v_YUV_VIRWIDTH(xvir)); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1,m_W2_RGB_RB_SWAP,v_W2_RGB_RB_SWAP(0)); break; default: - lcdc_writel(lcdc_dev, WIN2_VIR,v_RGB888_VIRWIDTH(xvir)); + printk("%s:un supported format\n",__func__); break; } - lcdc_writel(lcdc_dev, REG_CFG_DONE, 0x01); + lcdc_msk_reg(lcdc_dev,SYS_CTRL1, m_W2_FORMAT, v_W2_FORMAT(fmt_cfg)); } spin_unlock(&lcdc_dev->reg_lock); return 0; @@ -716,6 +774,7 @@ static int rk30_lcdc_open(struct rk_lcdc_device_driver *dev_drv,int layer_id,boo { rk30_lcdc_clk_enable(lcdc_dev); memcpy((u8*)lcdc_dev->regs, (u8*)lcdc_dev->regsbak, 0xc4); //resume reg + rk30_load_screen(dev_drv,1); spin_lock(&lcdc_dev->reg_lock); if(dev_drv->cur_screen->dsp_lut) //resume dsp lut { diff --git a/drivers/video/rockchip/lcdc/rk3188_lcdc.c b/drivers/video/rockchip/lcdc/rk3188_lcdc.c index 56b31297c3b7..1501125c7394 100644 --- a/drivers/video/rockchip/lcdc/rk3188_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3188_lcdc.c @@ -42,6 +42,8 @@ module_param(dbg_thresd, int, S_IRUGO|S_IWUSR); printk(KERN_INFO x);} while (0) //#define WAIT_FOR_SYNC 1 + +static int rk3188_load_screen(struct rk_lcdc_device_driver *dev_drv, bool initscreen); static int rk3188_lcdc_clk_enable(struct rk3188_lcdc_device *lcdc_dev) { @@ -188,6 +190,7 @@ static int rk3188_lcdc_open(struct rk_lcdc_device_driver *dev_drv,int layer_id,b { rk3188_lcdc_clk_enable(lcdc_dev); rk3188_lcdc_reg_resume(lcdc_dev); //resume reg + rk3188_load_screen(dev_drv,1); spin_lock(&lcdc_dev->reg_lock); if(dev_drv->cur_screen->dsp_lut) //resume dsp lut {