The HW reset defaults has DPIENABLE bit as set. In the current driver we
configure and enable various things while DPIENABLE is set. This results
in a temporary DPI output with wrong timings, which may cause artifacts
on the panel.

Fix this by clearing DPIEANBLE as the first thing when we start to
enable the display. DPIENABLE is set later with the rest of the LCDCTRL
configuration, and at that time we have done all the other
configurations.

Also, for symmetry and possibly improving the DPI output at disable
time, explicitly disable DPIENABLE when disabling the bridge.

Signed-off-by: Tomi Valkeinen <[email protected]>
---
 drivers/gpu/drm/bridge/tc358762.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/bridge/tc358762.c 
b/drivers/gpu/drm/bridge/tc358762.c
index a9c30acf1b14..7840ab3454f6 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -135,6 +135,12 @@ static int tc358762_init(struct tc358762 *ctx)
 {
        u32 lcdctrl;
 
+       /*
+        * DPIENABLE has reset default of 1. Make sure we don't output on
+        * DPI until we have finished the coniguration.
+        */
+       tc358762_write(ctx, LCDCTRL, 0);
+
        tc358762_write(ctx, SYSCTRL,
                       FIELD_PREP(SYSCTRL_DPIDATA_IO_MASK, 
SYSCTRL_DPIDATA_IO_4MA) |
                       FIELD_PREP(SYSCTRL_DPISTB_IO_MASK, 
SYSCTRL_DPISTB_IO_4MA) |
@@ -186,6 +192,9 @@ static void tc358762_post_disable(struct drm_bridge *bridge,
 
        ctx->pre_enabled = false;
 
+       /* Turn off the DPI output */
+       tc358762_write(ctx, LCDCTRL, 0);
+
        if (ctx->reset_gpio)
                gpiod_set_value_cansleep(ctx->reset_gpio, 0);
 

-- 
2.43.0

Reply via email to