vpp: sr: correct the sr core0 enable switch operation [1/1]
authorBrian Zhu <brian.zhu@amlogic.com>
Thu, 28 Feb 2019 19:16:45 +0000 (03:16 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 5 Mar 2019 01:41:48 +0000 (17:41 -0800)
PD#SWPL-5113

Problem:
SR core0 enable switch register is latched as default. It
will cause the screen flicker when operating this bit in vsync.
Because the frame size will be out of sync with back-end module.

Solution:
1. For g12a, no latch ctrl. So did not disable sr core2 enable bit.
2. For g12b/tl1, disable the latch function.

Verify:
Verified on U212/w400/x301

Change-Id: I54027b71ef8a6066004b3bd32ed1633b4bfa351c
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
drivers/amlogic/media/video_sink/video.c
drivers/amlogic/media/video_sink/vpp.c

index f90bcc9..d7916b8 100644 (file)
@@ -12122,13 +12122,13 @@ static int __init video_early_init(void)
                        DOLBY_PATH_CTRL, 0xf, 0, 6);
                /* disable latch for sr core0/1 scaler */
                WRITE_VCBUS_REG_BITS(
-                       SRSHARP0_SHARP_SYNC_CTRL, 1, 8, 1);
+                       SRSHARP0_SHARP_SYNC_CTRL, 1, 0, 1);
                WRITE_VCBUS_REG_BITS(
                        SRSHARP1_SHARP_SYNC_CTRL, 1, 8, 1);
        }
        if (is_meson_g12b_cpu())
                WRITE_VCBUS_REG_BITS(
-                       SRSHARP0_SHARP_SYNC_CTRL, 1, 8, 1);
+                       SRSHARP0_SHARP_SYNC_CTRL, 1, 0, 1);
        return 0;
 }
 
index a4ef9d3..33a014f 100644 (file)
@@ -1614,11 +1614,16 @@ int vpp_set_super_scaler_regs(
        int tmp_data = 0;
        int tmp_data2 = 0;
        unsigned int data_path_chose;
+       int sr_core0_max_width = SUPER_CORE0_WIDTH_MAX;
+
+       /* just work around for g12a not to disable sr core2 bit2 */
+       if (is_meson_g12a_cpu() && (reg_srscl0_vert_ratio == 0))
+               sr_core0_max_width = SUPER_CORE0_WIDTH_MAX << 1;
 
        /* top config */
        tmp_data = VSYNC_RD_MPEG_REG(VPP_SRSHARP0_CTRL);
        if (sr0_sr1_refresh) {
-               if (reg_srscl0_hsize > SUPER_CORE0_WIDTH_MAX) {
+               if (reg_srscl0_hsize > sr_core0_max_width) {
                        if (((tmp_data >> 1) & 0x1) != 0)
                                VSYNC_WR_MPEG_REG_BITS(VPP_SRSHARP0_CTRL,
                                        0, 1, 1);
@@ -1650,7 +1655,7 @@ int vpp_set_super_scaler_regs(
                                SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,
                                reg_srscl0_hori_ratio&0x1, 4, 1);
 
-               if (reg_srscl0_hsize > SUPER_CORE0_WIDTH_MAX) {
+               if (reg_srscl0_hsize > sr_core0_max_width) {
                        if (((tmp_data >> 2) & 0x1) != 0)
                                VSYNC_WR_MPEG_REG_BITS(
                                        SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,