rk3368 lcdc: fix dsp info config error in interlace mode
authorhjc <hjc@rock-chips.com>
Tue, 30 Dec 2014 03:26:01 +0000 (11:26 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 31 Dec 2014 10:20:47 +0000 (18:20 +0800)
Signed-off-by: hjc <hjc@rock-chips.com>
drivers/video/rockchip/lcdc/rk3368_lcdc.c

index 6dfb657fc4aba10265fb11f9f9dfd60ba36bf9f9..bc2ac72e56ea337a1e55f3226c1292c80bcbab14 100644 (file)
@@ -154,7 +154,8 @@ static int rk3368_lcdc_clk_disable(struct lcdc_device *lcdc_dev)
        return 0;
 }
 
-static int rk3368_lcdc_disable_irq(struct lcdc_device *lcdc_dev)
+static int __maybe_unused
+       rk3368_lcdc_disable_irq(struct lcdc_device *lcdc_dev)
 {
        u32 mask, val;
 
@@ -498,16 +499,20 @@ static int rk3368_lcdc_post_cfg(struct rk_lcdc_driver *dev_drv)
        }
 
        if (screen->mode.vmode == FB_VMODE_INTERLACED) {
-               post_dsp_vact_st = screen->post_dsp_sty +
-                   screen->mode.vsync_len + screen->mode.upper_margin;
-               post_dsp_vact_end = post_dsp_vact_st + screen->post_ysize;
+               post_dsp_vact_st = screen->post_dsp_sty / 2 +
+                                       screen->mode.vsync_len +
+                                       screen->mode.upper_margin;
+               post_dsp_vact_end = post_dsp_vact_st +
+                                       screen->post_ysize / 2;
 
                post_dsp_vact_st_f1 = screen->mode.vsync_len +
                                      screen->mode.upper_margin +
                                      y_res/2 +
                                      screen->mode.lower_margin +
                                      screen->mode.vsync_len +
-                                     screen->mode.upper_margin + 1;
+                                     screen->mode.upper_margin +
+                                     screen->post_dsp_sty / 2 +
+                                     1;
                post_dsp_vact_end_f1 = post_dsp_vact_st_f1 +
                                        screen->post_ysize/2;
        } else {
@@ -2563,14 +2568,19 @@ 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 ((!mirror_en) && (!screen->y_mirror))
-               pos = area->ypos + screen->mode.upper_margin +
-                       screen->mode.vsync_len;
-       else
-               pos = screen->mode.yres - area->ypos -
-                       area->ysize + screen->mode.upper_margin +
+       if (screen->mode.vmode == FB_VMODE_NONINTERLACED) {
+               if ((!mirror_en) && (!screen->y_mirror))
+                       pos = area->ypos + screen->mode.upper_margin +
+                               screen->mode.vsync_len;
+               else
+                       pos = screen->mode.yres - area->ypos -
+                               area->ysize + screen->mode.upper_margin +
+                               screen->mode.vsync_len;
+       } else if (screen->mode.vmode == FB_VMODE_INTERLACED) {
+               pos = area->ypos / 2 + screen->mode.upper_margin +
                        screen->mode.vsync_len;
+               area->ysize /= 2;
+       }
 
        return pos;
 }