video: lcdc: judge interlace mode from vmode bit mask
authorMark Yao <mark.yao@rock-chips.com>
Tue, 3 Nov 2015 02:21:26 +0000 (10:21 +0800)
committerMark Yao <mark.yao@rock-chips.com>
Fri, 6 Nov 2015 00:36:27 +0000 (08:36 +0800)
Vmode is a flag with bit mask, we can't judge interlace mode
from equal compare, need mask its bit.

Change-Id: I0cc53503198f98dc58369f4c9e6dd78b47095968
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
drivers/video/rockchip/lcdc/rk3036_lcdc.c
drivers/video/rockchip/lcdc/rk312x_lcdc.c
drivers/video/rockchip/lcdc/rk3228_lcdc.c
drivers/video/rockchip/lcdc/rk3368_lcdc.c

index 38747dad9d996dde0cd87a4417ca96ecc37097be..c01520c4161906990f7cab595b9a874c198a814a 100755 (executable)
@@ -626,7 +626,7 @@ static int rk3036_load_screen(struct rk_lcdc_driver *dev_drv, bool initscreen)
                    v_HASP(screen->mode.hsync_len + left_margin);
                lcdc_writel(lcdc_dev, DSP_HACT_ST_END, val);
 
-               if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+               if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                        /*First Field Timing*/
                        lcdc_writel(lcdc_dev, DSP_VTOTAL_VS_END,
                                    v_VSYNC(screen->mode.vsync_len) |
@@ -821,7 +821,7 @@ static int rk3036_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
 
        win->area[0].dsp_stx = win->post_cfg.xpos + screen->mode.left_margin +
                                screen->mode.hsync_len;
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                win->post_cfg.ysize /= 2;
                win->area[0].dsp_sty = win->post_cfg.ypos/2 +
                                        screen->mode.upper_margin +
index e5e5d5b97f6e045464c6c512dbd1c666e6909516..c1db0e58be4963116553e1fb117fdc3c2d731622 100755 (executable)
@@ -1382,7 +1382,7 @@ static int rk312x_load_screen(struct rk_lcdc_driver *dev_drv, bool initscreen)
                      v_HASP(screen->mode.hsync_len + left_margin);
                lcdc_writel(lcdc_dev, DSP_HACT_ST_END, val);
 
-               if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+               if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                        /* First Field Timing */
                        lcdc_writel(lcdc_dev, DSP_VTOTAL_VS_END,
                                    v_VSYNC(screen->mode.vsync_len) |
@@ -1578,7 +1578,7 @@ static int rk312x_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
                         win->area[0].ysize = win->area[0].yact;
                     }
        }
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                win->area[0].ysize /= 2;
                win->area[0].dsp_sty = win->area[0].ypos / 2 +
                                       screen->mode.upper_margin +
index 0426946a2d58c198bed9e52a2c97447e496be619..3216f69147f04c945e657a6542d728b201f7929f 100644 (file)
@@ -674,7 +674,7 @@ static int vop_post_cfg(struct rk_lcdc_driver *dev_drv)
                post_v_fac = 0x1000;
        }
 
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                post_dsp_vact_st = screen->post_dsp_sty / 2 +
                                        screen->mode.vsync_len +
                                        screen->mode.upper_margin;
@@ -1020,7 +1020,7 @@ static int vop_win_0_1_reg_update(struct rk_lcdc_driver *dev_drv, int win_id)
                        vop_msk_reg(vop_dev, WIN0_SRC_ALPHA_CTRL + off, val);
                }
 
-               if (dev_drv->cur_screen->mode.vmode == FB_VMODE_INTERLACED) {
+               if (dev_drv->cur_screen->mode.vmode & FB_VMODE_INTERLACED) {
                        if (win->area[0].yact == 2 * win->area[0].ysize)
                                val = V_WIN0_YRGB_DEFLICK(0) |
                                        V_WIN0_CBR_DEFLICK(0);
@@ -1184,7 +1184,7 @@ static int vop_config_timing(struct rk_lcdc_driver *dev_drv)
            V_DSP_HACT_ST(hsync_len + left_margin);
        vop_msk_reg(vop_dev, DSP_HACT_ST_END, val);
 
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                /* First Field Timing */
                val = V_DSP_VS_END(vsync_len) |
                    V_DSP_VTOTAL(2 * (vsync_len + upper_margin +
@@ -1674,7 +1674,7 @@ static int vop_cal_scl_fac(struct rk_lcdc_win *win, struct rk_screen *screen)
        u8 yuv_fmt = 0;
 
        srcW = win->area[0].xact;
-       if ((screen->mode.vmode == FB_VMODE_INTERLACED) &&
+       if ((screen->mode.vmode & FB_VMODE_INTERLACED) &&
            (win->area[0].yact == 2 * win->area[0].ysize)) {
                srcH = win->area[0].yact / 2;
                yrgb_vsd_bil_gt2 = 1;
@@ -1852,7 +1852,7 @@ static int vop_cal_scl_fac(struct rk_lcdc_win *win, struct rk_screen *screen)
 
        if (win->mirror_en == 1)
                win->yrgb_vsd_mode = SCALE_DOWN_BIL;
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                /* interlace mode must bill */
                win->yrgb_vsd_mode = SCALE_DOWN_BIL;
                win->cbr_vsd_mode = SCALE_DOWN_BIL;
@@ -2106,7 +2106,7 @@ static int dsp_y_pos(int mirror_en, struct rk_screen *screen,
 
        if (screen->y_mirror && mirror_en)
                pr_err("not support both win and global mirror\n");
-       if (screen->mode.vmode == FB_VMODE_NONINTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_NONINTERLACED) {
                if ((!mirror_en) && (!screen->y_mirror))
                        pos = area->ypos + screen->mode.upper_margin +
                                screen->mode.vsync_len;
@@ -2114,7 +2114,7 @@ static int dsp_y_pos(int mirror_en, struct rk_screen *screen,
                        pos = screen->mode.yres - area->ypos -
                                area->ysize + screen->mode.upper_margin +
                                screen->mode.vsync_len;
-       } else if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       } else if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                pos = area->ypos / 2 + screen->mode.upper_margin +
                        screen->mode.vsync_len;
                area->ysize /= 2;
index 979234d31f04701c89cf47a5a351cbf03a29bde3..292121bd497bee12f19212610cd31d1b6f393021 100755 (executable)
@@ -578,7 +578,7 @@ static int rk3368_lcdc_post_cfg(struct rk_lcdc_driver *dev_drv)
                post_v_fac = 0x1000;
        }
 
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                post_dsp_vact_st = screen->post_dsp_sty / 2 +
                                        screen->mode.vsync_len +
                                        screen->mode.upper_margin;
@@ -968,7 +968,7 @@ static int rk3368_init_fbdc_config(struct rk_lcdc_driver *dev_drv, int win_id)
        u8 mb_w_size, mb_h_size;
        struct rk_screen *screen = dev_drv->cur_screen;
 
-       if (screen->mode.flag == FB_VMODE_INTERLACED) {
+       if (screen->mode.flag & FB_VMODE_INTERLACED) {
                dev_err(lcdc_dev->dev, "unsupport fbdc+interlace!\n");
                return 0;
        }
@@ -1258,7 +1258,7 @@ static int rk3368_win_0_1_reg_update(struct rk_lcdc_driver *dev_drv, int win_id)
                                     mask, val);
                }
 
-               if (dev_drv->cur_screen->mode.vmode == FB_VMODE_INTERLACED) {
+               if (dev_drv->cur_screen->mode.vmode & FB_VMODE_INTERLACED) {
                        mask = m_WIN0_YRGB_DEFLICK | m_WIN0_CBR_DEFLICK;
                        if (win->area[0].yact == 2 * win->area[0].ysize)
                                val = v_WIN0_YRGB_DEFLICK(0) |
@@ -1620,7 +1620,7 @@ static int rk3368_config_timing(struct rk_lcdc_driver *dev_drv)
            v_DSP_HACT_ST(hsync_len + left_margin);
        lcdc_msk_reg(lcdc_dev, DSP_HACT_ST_END, mask, val);
 
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                /* First Field Timing */
                mask = m_DSP_VS_PW | m_DSP_VTOTAL;
                val = v_DSP_VS_PW(vsync_len) |
@@ -2435,7 +2435,7 @@ static int rk3368_lcdc_cal_scl_fac(struct rk_lcdc_win *win,
        u8 yuv_fmt = 0;
 
        srcW = win->area[0].xact;
-       if ((screen->mode.vmode == FB_VMODE_INTERLACED) &&
+       if ((screen->mode.vmode & FB_VMODE_INTERLACED) &&
            (win->area[0].yact == 2 * win->area[0].ysize)) {
                srcH = win->area[0].yact / 2;
                yrgb_vsd_bil_gt2 = 1;
@@ -2621,7 +2621,7 @@ static int rk3368_lcdc_cal_scl_fac(struct rk_lcdc_win *win,
        if (win->mirror_en == 1)
                win->yrgb_vsd_mode = SCALE_DOWN_BIL;
 
-       if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                /*interlace mode must bill */
                win->yrgb_vsd_mode = SCALE_DOWN_BIL;
                win->cbr_vsd_mode = SCALE_DOWN_BIL;
@@ -2878,7 +2878,7 @@ static int dsp_y_pos(int mirror_en, struct rk_screen *screen,
 
        if (screen->y_mirror && mirror_en)
                pr_err("not support both win and global mirror\n");
-       if (screen->mode.vmode == FB_VMODE_NONINTERLACED) {
+       if (screen->mode.vmode & FB_VMODE_NONINTERLACED) {
                if ((!mirror_en) && (!screen->y_mirror))
                        pos = area->ypos + screen->mode.upper_margin +
                                screen->mode.vsync_len;
@@ -2886,7 +2886,7 @@ static int dsp_y_pos(int mirror_en, struct rk_screen *screen,
                        pos = screen->mode.yres - area->ypos -
                                area->ysize + screen->mode.upper_margin +
                                screen->mode.vsync_len;
-       } else if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+       } else if (screen->mode.vmode & FB_VMODE_INTERLACED) {
                pos = area->ypos / 2 + screen->mode.upper_margin +
                        screen->mode.vsync_len;
                area->ysize /= 2;
@@ -3084,7 +3084,7 @@ static int win_2_3_set_par(struct lcdc_device *lcdc_dev,
                                                  &win->area[i]);
                        if (((win->area[i].xact != win->area[i].xsize) ||
                             (win->area[i].yact != win->area[i].ysize)) &&
-                            (screen->mode.vmode == FB_VMODE_NONINTERLACED)) {
+                            (screen->mode.vmode & FB_VMODE_NONINTERLACED)) {
                                pr_err("win[%d]->area[%d],not support scale\n",
                                       win->id, i);
                                pr_err("xact=%d,yact=%d,xsize=%d,ysize=%d\n",
@@ -4049,7 +4049,7 @@ static int rk3368_lcdc_config_done(struct rk_lcdc_driver *dev_drv)
        struct rk_lcdc_win *win = NULL;
        u32 line_scane_num, dsp_vs_st_f1;
 
-       if (lcdc_dev->driver.cur_screen->mode.vmode == FB_VMODE_INTERLACED) {
+       if (lcdc_dev->driver.cur_screen->mode.vmode & FB_VMODE_INTERLACED) {
                dsp_vs_st_f1 = lcdc_readl(lcdc_dev, DSP_VS_ST_END_F1) >> 16;
                for (i = 0; i < 1000; i++) {
                        line_scane_num =
@@ -4776,7 +4776,7 @@ static irqreturn_t rk3368_lcdc_isr(int irq, void *dev_id)
 #endif
                lcdc_dev->driver.vsync_info.timestamp = timestamp;
                wake_up_interruptible_all(&lcdc_dev->driver.vsync_info.wait);
-               if ((screen->mode.vmode == FB_VMODE_NONINTERLACED) ||
+               if ((screen->mode.vmode & FB_VMODE_NONINTERLACED) ||
                    (line_scane_num >= dsp_vs_st_f1)) {
                        lcdc_dev->driver.vsync_info.timestamp = timestamp;
                        wake_up_interruptible_all(