Skip to contentSkip to conversation

drm/bridge: tc358767: Fix use of unadjusted mode in the driver

PATCH Applied Marek Vasut 3 participants 4 messages Oct 26, 2024 – Nov 18, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge: tc358767: Fix use of unadjusted mode in the driver

The driver configures mostly Pixel PLL from the clock cached in local copy of the mode. Make sure the driver uses adjusted mode which contains the updated Pixel PLL settings negotiated in tc_dpi_atomic_check()/tc_edp_atomic_check().

---
Cc: Andrzej Hajda <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/bridge/tc358767.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358767.c +1 -1
index 7968183510e63..0d523322fdd8e 100644
@@ -1764,7 +1764,7 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge,
 {
 	struct tc_data *tc = bridge_to_tc(bridge);
 
-	drm_mode_copy(&tc->mode, mode);
+	drm_mode_copy(&tc->mode, adj);
 }
 
 static const struct drm_edid *tc_edid_read(struct drm_bridge *bridge,
Signature · 1 line
2.45.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Marek Vasut

The driver configures mostly Pixel PLL from the clock cached in local copy of the mode. Make sure the driver uses adjusted mode which contains the updated Pixel PLL settings negotiated in tc_dpi_atomic_check()/tc_edp_atomic_check().

Applied, thanks!

[1/1] drm/bridge: tc358767: Fix use of unadjusted mode in the driver

      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/b59d1d9d9ab2

Rob

#2 lore raw
In reply to Marek Vasut

Hi Marek,

Am Samstag, 26. Oktober 2024, 06:10:42 CET schrieb Marek Vasut:

Quoted 29 lines

The driver configures mostly Pixel PLL from the clock cached in local copy of the mode. Make sure the driver uses adjusted mode which contains the updated Pixel PLL settings negotiated in tc_dpi_atomic_check()/tc_edp_atomic_check().

---
Cc: Andrzej Hajda <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/bridge/tc358767.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358767.c +0 -0
index 7968183510e63..0d523322fdd8e 100644

drivers/gpu/drm/bridge/tc358767.c static void tc_bridge_mode_set(struct drm_bridge *bridge, · line 1770

Quoted 8 lines
drivers/gpu/drm/bridge/tc358767.c +1 -1
@@ -1764,7 +1764,7 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge,
 {
 	struct tc_data *tc = bridge_to_tc(bridge);
 
-	drm_mode_copy(&tc->mode, mode);
+	drm_mode_copy(&tc->mode, adj);
 }
 
 static const struct drm_edid *tc_edid_read(struct drm_bridge *bridge,

This unfortunately breaks my DSI->DP setup on TQMa8MPxL/MBa8MPxL.

When I revert it, DP works again. I'm currently running on next-20241114 with patches regarding DSI initialization.

before:
tc358767 1-000f: PLL: requested 148500000 pixelclock, ref 26000000 tc358767 1-000f: PLL: got 147333333, delta -1166667 tc358767 1-000f: PLL: 26000000 / 1 / 1 * 17 / 3 tc358767 1-000f: set mode 1920x1080
tc358767 1-000f: H margin 148,88 sync 44
tc358767 1-000f: V margin 36,4 sync 5
tc358767 1-000f: total: 2200x1125

after:
tc358767 1-000f: PLL: requested 147333000 pixelclock, ref 26000000 tc358767 1-000f: PLL: got 146250000, delta -1083000 tc358767 1-000f: PLL: 26000000 / 1 / 4 * 45 / 2 tc358767 1-000f: set mode 1920x1080
tc358767 1-000f: H margin 148,88 sync 44
tc358767 1-000f: V margin 36,4 sync 5
tc358767 1-000f: total: 2200x1125

The reason this breaks is that the adjusted clock frequency is slightly off to the previously calculated one: 147333333 <-> 147333000
This is because mode clock is only specyfied in KHz. With this incorrect input the new result is even lower than requested, thus failing to setup correctly.

As I don't see a quick fix, I propose a revert meanwhile. Any comments?

Best regards,
Alexander

Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
#3 lore raw
Quoted 1 line · Alexander Stein

Hi Marek,

Hi,

Quoted 62 lines

Am Samstag, 26. Oktober 2024, 06:10:42 CET schrieb Marek Vasut:

Quoted 29 lines

The driver configures mostly Pixel PLL from the clock cached in local copy of the mode. Make sure the driver uses adjusted mode which contains the updated Pixel PLL settings negotiated in tc_dpi_atomic_check()/tc_edp_atomic_check().

---
Cc: Andrzej Hajda <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]

---
  drivers/gpu/drm/bridge/tc358767.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358767.c +0 -0
index 7968183510e63..0d523322fdd8e 100644

drivers/gpu/drm/bridge/tc358767.c static void tc_bridge_mode_set(struct drm_bridge *bridge, · line 1770

Quoted 8 lines
drivers/gpu/drm/bridge/tc358767.c +1 -1
@@ -1764,7 +1764,7 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge,
  {
  	struct tc_data *tc = bridge_to_tc(bridge);
 
-	drm_mode_copy(&tc->mode, mode);
+	drm_mode_copy(&tc->mode, adj);
  }
 
  static const struct drm_edid *tc_edid_read(struct drm_bridge *bridge,

This unfortunately breaks my DSI->DP setup on TQMa8MPxL/MBa8MPxL.

When I revert it, DP works again. I'm currently running on next-20241114 with patches regarding DSI initialization.

before:
tc358767 1-000f: PLL: requested 148500000 pixelclock, ref 26000000 tc358767 1-000f: PLL: got 147333333, delta -1166667 tc358767 1-000f: PLL: 26000000 / 1 / 1 * 17 / 3 tc358767 1-000f: set mode 1920x1080
tc358767 1-000f: H margin 148,88 sync 44
tc358767 1-000f: V margin 36,4 sync 5
tc358767 1-000f: total: 2200x1125

after:
tc358767 1-000f: PLL: requested 147333000 pixelclock, ref 26000000 tc358767 1-000f: PLL: got 146250000, delta -1083000 tc358767 1-000f: PLL: 26000000 / 1 / 4 * 45 / 2 tc358767 1-000f: set mode 1920x1080
tc358767 1-000f: H margin 148,88 sync 44
tc358767 1-000f: V margin 36,4 sync 5
tc358767 1-000f: total: 2200x1125

Quoted 7 lines

The reason this breaks is that the adjusted clock frequency is slightly off to the previously calculated one: 147333333 <-> 147333000
This is because mode clock is only specyfied in KHz. With this incorrect input the new result is even lower than requested, thus failing to setup correctly.

As I don't see a quick fix, I propose a revert meanwhile. Any comments?

Sigh, the TC358767 is really a gift that keeps on giving.

Either revert it for now, or give me a week or three until I get back to digging in the TC358767. Whichever you prefer. Sorry for the slowness.