[18/24] drm/omap: fix WBDELAYCOUNT with interlace

Message ID 1518428694-18018-19-git-send-email-tomi.valkeinen@ti.com
State New
Headers show
Series
  • drm/omap: misc patches
Related show

Commit Message

Tomi Valkeinen Feb. 12, 2018, 9:44 a.m.
Vertical blanking needs to be halved on interlace modes. WBDELAYCOUNT
was calculated without such halving, resulting in WBUNCOMPLETE errors.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 669ee9df224b..99bbc97d0de4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -2710,14 +2710,18 @@  int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
 		/* WBDELAYCOUNT */
 		REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 7, 0);
 	} else {
-		int wbdelay;
+		u32 wbdelay;
 
 		if (channel_in == DSS_WB_TV_MGR)
-			wbdelay = min(vm->vsync_len + vm->vback_porch,
-				(u32)255);
+			wbdelay = vm->vsync_len + vm->vback_porch;
 		else
-			wbdelay = min(vm->vfront_porch +
-				vm->vsync_len + vm->vback_porch, (u32)255);
+			wbdelay = vm->vfront_porch + vm->vsync_len +
+				vm->vback_porch;
+
+		if (vm->flags & DISPLAY_FLAGS_INTERLACED)
+			wbdelay /= 2;
+
+		wbdelay = min(wbdelay, 255u);
 
 		/* WBDELAYCOUNT */
 		REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0);