Skip to contentSkip to conversation

Fixes for TC358775 DSI to LVDS bridge

PATCH Applied Jiri Vanek 3 participants 6 messages Jun 15, 2022 – Jun 20, 2022

Subsystems (3)
lore
Share & tools
lore

Jiri Vanek

author
#0 lore raw

cover Fixes for TC358775 DSI to LVDS bridge

This patchset fixes two bugs in the driver for TC358775 DSI to LVDS bridge.

Jiri Vanek (2):
drm/bridge/tc358775: Return before displaying inappropriate error
message
drm/bridge/tc358775: Fix DSI clock division for vsync delay
calculation

 drivers/gpu/drm/bridge/tc358775.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.2
author
#1 lore raw

PATCH 1/2 drm/bridge/tc358775: Return before displaying inappropriate error message

Function for reading from i2c device register displays error message even if reading ends correctly. Add return to avoid falling through into the fail label.

---
 drivers/gpu/drm/bridge/tc358775.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/tc358775.c +1 -0
index 62a7ef352daa..cd2721ab02a9 100644
@@ -339,6 +339,7 @@ static void d2l_read(struct i2c_client *i2c, u16 addr, u32 *val)
 		goto fail;
 
 	pr_debug("d2l: I2C : addr:%04x value:%08x\n", addr, *val);
+	return;
 
 fail:
 	dev_err(&i2c->dev, "Error %d reading from subaddress 0x%x\n",
Signature · 1 line
2.30.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm/bridge/tc358775: Return before displaying inappropriate error message

Quoted 27 lines · Jiri Vanek

Function for reading from i2c device register displays error message even if reading ends correctly. Add return to avoid falling through into the fail label.

---
 drivers/gpu/drm/bridge/tc358775.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/tc358775.c +1 -0
index 62a7ef352daa..cd2721ab02a9 100644
@@ -339,6 +339,7 @@ static void d2l_read(struct i2c_client *i2c, u16 addr,
 u32 *val)
                goto fail;
 
        pr_debug("d2l: I2C : addr:%04x value:%08x\n", addr, *val);
+       return;
 
 fail:
        dev_err(&i2c->dev, "Error %d reading from subaddress 0x%x\n",

--
2.30.2

Signature · 2 lines
regards,
vinaysimha
author
#3 lore raw

PATCH 2/2 drm/bridge/tc358775: Fix DSI clock division for vsync delay calculation

In reply to Jiri Vanek

Use the same PCLK divide option (divide DSI clock to generate pixel clock) which is set to LVDS Configuration Register (LVCFG) also for a VSync delay calculation. Without this change an auxiliary variable could underflow during the calculation for some dual-link LVDS panels and then calculated VSync delay is wrong. This leads to a shifted picture on a panel.

---
 drivers/gpu/drm/bridge/tc358775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358775.c +1 -1
index cd2721ab02a9..fecb8558b49a 100644
@@ -430,7 +430,7 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
 		val = TC358775_VPCTRL_MSF(1);
 
 	dsiclk = mode->crtc_clock * 3 * tc->bpc / tc->num_dsi_lanes / 1000;
-	clkdiv = dsiclk / DIVIDE_BY_3 * tc->lvds_link;
+	clkdiv = dsiclk / (tc->lvds_link == DUAL_LINK ? DIVIDE_BY_6 : DIVIDE_BY_3);
 	byteclk = dsiclk / 4;
 	t1 = hactive * (tc->bpc * 3 / 8) / tc->num_dsi_lanes;
 	t2 = ((100000 / clkdiv)) * (hactive + hback_porch + hsync_len + hfront_porch) / 1000;
Signature · 1 line
2.30.2
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/bridge/tc358775: Fix DSI clock division for vsync delay calculation

Quoted 32 lines · Jiri Vanek

Use the same PCLK divide option (divide DSI clock to generate pixel clock) which is set to LVDS Configuration Register (LVCFG) also for a VSync delay calculation. Without this change an auxiliary variable could underflow during the calculation for some dual-link LVDS panels and then calculated VSync delay is wrong. This leads to a shifted picture on a panel.

---
 drivers/gpu/drm/bridge/tc358775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358775.c +1 -1
index cd2721ab02a9..fecb8558b49a 100644
@@ -430,7 +430,7 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
                val = TC358775_VPCTRL_MSF(1);
 
        dsiclk = mode->crtc_clock * 3 * tc->bpc / tc->num_dsi_lanes / 1000;
-       clkdiv = dsiclk / DIVIDE_BY_3 * tc->lvds_link;
+       clkdiv = dsiclk / (tc->lvds_link == DUAL_LINK ? DIVIDE_BY_6 :
 DIVIDE_BY_3);
        byteclk = dsiclk / 4;
        t1 = hactive * (tc->bpc * 3 / 8) / tc->num_dsi_lanes;
        t2 = ((100000 / clkdiv)) * (hactive + hback_porch + hsync_len +

hfront_porch) / 1000;
--
2.30.2

Signature · 2 lines
regards,
vinaysimha
Applied
#5 lore raw
In reply to Jiri Vanek
Quoted 12 lines · Jiri Vanek

This patchset fixes two bugs in the driver for TC358775 DSI to LVDS bridge.

Jiri Vanek (2):
drm/bridge/tc358775: Return before displaying inappropriate error
message
drm/bridge/tc358775: Fix DSI clock division for vsync delay
calculation

 drivers/gpu/drm/bridge/tc358775.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to drm-misc-next.