MLK-17023 drm/imx: ldb: Align HSYNC and VSYNC polarities with PHY in DE mode
authorLiu Ying <victor.liu@nxp.com>
Wed, 29 Nov 2017 06:19:46 +0000 (14:19 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:49:44 +0000 (14:49 -0500)
When an external display device works in data enable(DE) mode,
it usually provides video mode(s) without HSYNC and VSYNC
polarities via display flags.  In this case, the controller(LDB)
and the LVDS PHY still need to align the two signal polarities
with each other respectively.  Otherwise, polarities generated
by default register values may cause mismatch polarities and
display artifacts.  With the DE mode JDI TX26D202VM0BWA panel,
we see vertical lines(very likely, only one) at the left boundary
are missing sometimes, which is caused by this mismatch.  This
patch replaces the default polarity status with explicit active
high in DE mode to fix the issue.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/drm/imx/imx-ldb.c

index cfb3f02..b61b322 100644 (file)
@@ -523,13 +523,13 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
        if (imx_ldb_ch == &ldb->channel[0] || dual) {
                if (mode->flags & DRM_MODE_FLAG_NVSYNC)
                        ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW;
-               else if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+               else
                        ldb->ldb_ctrl &= ~LDB_DI0_VS_POL_ACT_LOW;
        }
        if (imx_ldb_ch == &ldb->channel[1] || dual) {
                if (mode->flags & DRM_MODE_FLAG_NVSYNC)
                        ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW;
-               else if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+               else
                        ldb->ldb_ctrl &= ~LDB_DI1_VS_POL_ACT_LOW;
        }
 
@@ -541,7 +541,7 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
                                        ldb->channel[0].phy, false);
                                mixel_phy_lvds_set_vsync_pol(
                                        ldb->channel[1].phy, false);
-                       } else if (mode->flags & DRM_MODE_FLAG_PVSYNC) {
+                       } else {
                                mixel_phy_lvds_set_vsync_pol(
                                        ldb->channel[0].phy, true);
                                mixel_phy_lvds_set_vsync_pol(
@@ -553,7 +553,7 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
                                        ldb->channel[0].phy, false);
                                mixel_phy_lvds_set_hsync_pol(
                                        ldb->channel[1].phy, false);
-                       } else if (mode->flags & DRM_MODE_FLAG_PHSYNC) {
+                       } else {
                                mixel_phy_lvds_set_hsync_pol(
                                        ldb->channel[0].phy, true);
                                mixel_phy_lvds_set_hsync_pol(
@@ -564,14 +564,14 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
                        if (mode->flags & DRM_MODE_FLAG_NVSYNC)
                                mixel_phy_combo_lvds_set_vsync_pol(
                                        ldb->channel[0].phy, false);
-                       else if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+                       else
                                mixel_phy_combo_lvds_set_vsync_pol(
                                        ldb->channel[0].phy, true);
                        /* HSYNC */
                        if (mode->flags & DRM_MODE_FLAG_NHSYNC)
                                mixel_phy_combo_lvds_set_hsync_pol(
                                        ldb->channel[0].phy, false);
-                       else if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+                       else
                                mixel_phy_combo_lvds_set_hsync_pol(
                                        ldb->channel[0].phy, true);
                }
@@ -581,14 +581,14 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
                        if (mode->flags & DRM_MODE_FLAG_NVSYNC)
                                mixel_phy_lvds_set_vsync_pol(imx_ldb_ch->phy,
                                                                false);
-                       else if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+                       else
                                mixel_phy_lvds_set_vsync_pol(imx_ldb_ch->phy,
                                                                true);
                        /* HSYNC */
                        if (mode->flags & DRM_MODE_FLAG_NHSYNC)
                                mixel_phy_lvds_set_hsync_pol(imx_ldb_ch->phy,
                                                                false);
-                       else if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+                       else
                                mixel_phy_lvds_set_hsync_pol(imx_ldb_ch->phy,
                                                                true);
                } else if (ldb->use_mixel_combo_phy) {
@@ -597,7 +597,7 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
                                mixel_phy_combo_lvds_set_vsync_pol(
                                                                imx_ldb_ch->phy,
                                                                false);
-                       else if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+                       else
                                mixel_phy_combo_lvds_set_vsync_pol(
                                                                imx_ldb_ch->phy,
                                                                true);
@@ -606,7 +606,7 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
                                mixel_phy_combo_lvds_set_hsync_pol(
                                                                imx_ldb_ch->phy,
                                                                false);
-                       else if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+                       else
                                mixel_phy_combo_lvds_set_hsync_pol(
                                                                imx_ldb_ch->phy,
                                                                true);