From 3d60483b1895e7460e550dde9a4521426afdc1ef Mon Sep 17 00:00:00 2001 From: Huang Jiachai Date: Mon, 17 Oct 2016 11:44:30 +0800 Subject: [PATCH] video: rockchip: vop: 3399: fix win2/win3 csc mode error Change-Id: I34275fda827446dbdebbe3a13e18ceaacd6bba2c Signed-off-by: Huang Jiachai --- drivers/video/rockchip/lcdc/rk322x_lcdc.c | 16 ++++++++++++---- drivers/video/rockchip/lcdc/rk322x_lcdc.h | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/video/rockchip/lcdc/rk322x_lcdc.c b/drivers/video/rockchip/lcdc/rk322x_lcdc.c index a3ba69d8103b..4d73fc114144 100644 --- a/drivers/video/rockchip/lcdc/rk322x_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk322x_lcdc.c @@ -695,7 +695,7 @@ static int rk3399_vop_win_csc_cfg(struct rk_lcdc_driver *dev_drv) int output_color = dev_drv->output_color; int i; - for (i = 0; i < dev_drv->lcdc_win_num && i <= 4; i++) { + for (i = 0; i < dev_drv->lcdc_win_num && i < 4; i++) { struct rk_lcdc_win *win = dev_drv->win[i]; int shift = i * 8; u64 val = V_WIN0_YUV2YUV_EN(0) | V_WIN0_YUV2YUV_R2Y_EN(0) | @@ -728,7 +728,11 @@ static int rk3399_vop_win_csc_cfg(struct rk_lcdc_driver *dev_drv) if (!(IS_YUV(win->area[0].fmt_cfg) || win->area[0].yuyv_fmt)) { val |= V_WIN0_YUV2YUV_R2Y_EN(1); - LOAD_CSC(vop_dev, R2Y, csc_r2y_bt709_full_10, i); + if ((win->id == 0) || (win->id == 1)) + LOAD_CSC(vop_dev, R2Y, csc_r2y_bt709_full_10, i); + else + val |= V_WIN0_YUV2YUV_R2Y_MODE(VOP_R2Y_CSC_BT709); + } else if (win->colorspace == CSC_BT2020) { val |= V_WIN0_YUV2YUV_EN(1) | V_WIN0_YUV2YUV_Y2R_EN(1) | @@ -742,8 +746,12 @@ static int rk3399_vop_win_csc_cfg(struct rk_lcdc_driver *dev_drv) win->area[0].yuyv_fmt)) { val |= V_WIN0_YUV2YUV_R2Y_EN(1) | V_WIN0_YUV2YUV_EN(1); - LOAD_CSC(vop_dev, R2R, csc_r2r_bt709to2020, i); - LOAD_CSC(vop_dev, R2Y, csc_r2y_bt2020, i); + if ((win->id == 0) || (win->id == 1)) { + LOAD_CSC(vop_dev, R2R, csc_r2r_bt709to2020, i); + LOAD_CSC(vop_dev, R2Y, csc_r2y_bt2020, i); + } else { + val |= V_WIN0_YUV2YUV_R2Y_MODE(VOP_R2Y_CSC_BT2020); + } } else if (win->colorspace == CSC_BT601 || win->colorspace == CSC_BT709) { val |= V_WIN0_YUV2YUV_Y2R_EN(1) | diff --git a/drivers/video/rockchip/lcdc/rk322x_lcdc.h b/drivers/video/rockchip/lcdc/rk322x_lcdc.h index 09d900a47c56..d7466e904d03 100644 --- a/drivers/video/rockchip/lcdc/rk322x_lcdc.h +++ b/drivers/video/rockchip/lcdc/rk322x_lcdc.h @@ -1621,7 +1621,9 @@ enum factor_mode { enum _vop_r2y_csc_mode { VOP_R2Y_CSC_BT601 = 0, - VOP_R2Y_CSC_BT709 + VOP_R2Y_CSC_BT709, + VOP_R2Y_CSC_BT601_F, + VOP_R2Y_CSC_BT2020 }; enum _vop_y2r_csc_mode { -- 2.34.1