public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes
@ 2026-05-13 13:10 Tomi Valkeinen
  2026-05-13 13:10 ` [PATCH v3 01/13] drm/bridge: tc358762: Clean up register defines Tomi Valkeinen
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

While trying to get Raspberry Pi display v1.1 working on Beagleboard
platforms, I noticed various small issues with the tc358762 driver.

The series also contains a patch to fix the timings in the
powertip,ph800480t013-idf02 panel. The combination of tc358762 +
ph800480t013 is used in the Raspberry Pi display module, so it makes
sense to fix them together.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
Changes in v3:
- Add missing #include <linux/bitfield.h>
- New patch: "drm/panel-simple: Fix powertip,ph800480t013-idf02 timings"
- Link to v2: https://lore.kernel.org/r/20260327-tc358762-fixes-v2-0-3589d3c45f4a@ideasonboard.com

Changes in v2:
- Always enable VTG. There should be no downside, and it fixes unstable
  hsync
- Add four new patches at the end
- Extend the patch desc in "Drop SPICMR write" a bit
- Link to v1: https://lore.kernel.org/r/20260326-tc358762-fixes-v1-0-65f479227af5@ideasonboard.com

---
Tomi Valkeinen (13):
      drm/bridge: tc358762: Clean up register defines
      drm/bridge: tc358762: Improve SYSCTRL register defines
      drm/bridge: tc358762: Improve LCDCTRL defines
      drm/bridge: tc358762: Configure SYSCTRL first
      drm/bridge: tc358762: Drop SPICMR write
      drm/bridge: tc358762: Improve DPI enable handling
      drm/bridge: tc358762: Update comment about the number of lanes
      drm/bridge: tc358762: Support VTG
      drm/bridge: tc358762: Fix sync polarities
      drm/bridge: tc358762: Move tc358762_init() into tc358762_enable()
      drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set
      drm/bridge: tc358762: Set DE_POL and DCLK_POL properly
      drm/panel-simple: Fix powertip,ph800480t013-idf02 timings

 drivers/gpu/drm/bridge/tc358762.c    | 203 +++++++++++++++++++++++------------
 drivers/gpu/drm/panel/panel-simple.c |  14 +--
 2 files changed, 144 insertions(+), 73 deletions(-)
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260326-tc358762-fixes-6f666500da9e

Best regards,
-- 
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v3 01/13] drm/bridge: tc358762: Clean up register defines
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 02/13] drm/bridge: tc358762: Improve SYSCTRL " Tomi Valkeinen
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

Move the defines around and rename for clarity and consistency. No
functional change.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 98df3e667d4a..833fd9913c75 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -29,17 +29,22 @@
 
 /* PPI layer registers */
 #define PPI_STARTPPI		0x0104 /* START control bit */
+#define PPI_STARTPPI_STARTPPI	BIT(0)
+
 #define PPI_LPTXTIMECNT		0x0114 /* LPTX timing signal */
 #define PPI_D0S_ATMR		0x0144
 #define PPI_D1S_ATMR		0x0148
 #define PPI_D0S_CLRSIPOCOUNT	0x0164 /* Assertion timer for Lane 0 */
 #define PPI_D1S_CLRSIPOCOUNT	0x0168 /* Assertion timer for Lane 1 */
-#define PPI_START_FUNCTION	1
 
 /* DSI layer registers */
 #define DSI_STARTDSI		0x0204 /* START control bit of DSI-TX */
+#define DSI_STARTDSI_STARTDSI	BIT(0)
+
 #define DSI_LANEENABLE		0x0210 /* Enables each lane */
-#define DSI_RX_START		1
+#define DSI_LANEENABLE_CLEN	BIT(0)
+#define DSI_LANEENABLE_L0EN	BIT(1)
+#define DSI_LANEENABLE_L1EN	BIT(2)
 
 /* LCDC/DPI Host Registers, based on guesswork that this matches TC358764 */
 #define LCDCTRL			0x0420 /* Video Path Control */
@@ -60,14 +65,8 @@
 /* System Controller Registers */
 #define SYSCTRL			0x0464
 
-/* System registers */
 #define LPX_PERIOD		3
 
-/* Lane enable PPI and DSI register bits */
-#define LANEENABLE_CLEN		BIT(0)
-#define LANEENABLE_L0EN		BIT(1)
-#define LANEENABLE_L1EN		BIT(2)
-
 struct tc358762 {
 	struct device *dev;
 	struct drm_bridge bridge;
@@ -118,7 +117,7 @@ static int tc358762_init(struct tc358762 *ctx)
 	u32 lcdctrl;
 
 	tc358762_write(ctx, DSI_LANEENABLE,
-		       LANEENABLE_L0EN | LANEENABLE_CLEN);
+		       DSI_LANEENABLE_L0EN | DSI_LANEENABLE_CLEN);
 	tc358762_write(ctx, PPI_D0S_CLRSIPOCOUNT, 5);
 	tc358762_write(ctx, PPI_D1S_CLRSIPOCOUNT, 5);
 	tc358762_write(ctx, PPI_D0S_ATMR, 0);
@@ -141,8 +140,8 @@ static int tc358762_init(struct tc358762 *ctx)
 	tc358762_write(ctx, SYSCTRL, 0x040f);
 	msleep(100);
 
-	tc358762_write(ctx, PPI_STARTPPI, PPI_START_FUNCTION);
-	tc358762_write(ctx, DSI_STARTDSI, DSI_RX_START);
+	tc358762_write(ctx, PPI_STARTPPI, PPI_STARTPPI_STARTPPI);
+	tc358762_write(ctx, DSI_STARTDSI, DSI_STARTDSI_STARTDSI);
 
 	msleep(100);
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 02/13] drm/bridge: tc358762: Improve SYSCTRL register defines
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
  2026-05-13 13:10 ` [PATCH v3 01/13] drm/bridge: tc358762: Clean up register defines Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 03/13] drm/bridge: tc358762: Improve LCDCTRL defines Tomi Valkeinen
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

Define SYSCTRL fields. No functional changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 833fd9913c75..c8b9984ff301 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -10,6 +10,7 @@
  *  Eric Anholt <eric@anholt.net>
  */
 
+#include <linux/bitfield.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/mod_devicetable.h>
@@ -64,6 +65,19 @@
 
 /* System Controller Registers */
 #define SYSCTRL			0x0464
+#define SYSCTRL_DPIDATA_IO_MASK GENMASK_U32(1, 0)
+#define SYSCTRL_DPIDATA_IO_1MA	0
+#define SYSCTRL_DPIDATA_IO_2MA	1
+#define SYSCTRL_DPIDATA_IO_3MA	2
+#define SYSCTRL_DPIDATA_IO_4MA	3
+#define SYSCTRL_DPISTB_IO_MASK	GENMASK_U32(3, 2)
+#define SYSCTRL_DPISTB_IO_1MA	0
+#define SYSCTRL_DPISTB_IO_2MA	1
+#define SYSCTRL_DPISTB_IO_3MA	2
+#define SYSCTRL_DPISTB_IO_4MA	3
+#define SYSCTRL_PCLKDIV_MASK	GENMASK_U32(11, 8)
+#define SYSCTRL_PCLKDIV_DIV_2	2
+#define SYSCTRL_PCLKDIV_DIV_3	4
 
 #define LPX_PERIOD		3
 
@@ -137,7 +151,11 @@ static int tc358762_init(struct tc358762 *ctx)
 
 	tc358762_write(ctx, LCDCTRL, lcdctrl);
 
-	tc358762_write(ctx, SYSCTRL, 0x040f);
+	tc358762_write(ctx, SYSCTRL,
+		       FIELD_PREP(SYSCTRL_DPIDATA_IO_MASK, SYSCTRL_DPIDATA_IO_4MA) |
+		       FIELD_PREP(SYSCTRL_DPISTB_IO_MASK, SYSCTRL_DPISTB_IO_4MA) |
+		       FIELD_PREP(SYSCTRL_PCLKDIV_MASK, SYSCTRL_PCLKDIV_DIV_3));
+
 	msleep(100);
 
 	tc358762_write(ctx, PPI_STARTPPI, PPI_STARTPPI_STARTPPI);

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 03/13] drm/bridge: tc358762: Improve LCDCTRL defines
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
  2026-05-13 13:10 ` [PATCH v3 01/13] drm/bridge: tc358762: Clean up register defines Tomi Valkeinen
  2026-05-13 13:10 ` [PATCH v3 02/13] drm/bridge: tc358762: Improve SYSCTRL " Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 04/13] drm/bridge: tc358762: Configure SYSCTRL first Tomi Valkeinen
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

LCDCTRL fields are quite wrong in the driver. Fix the field defines.

A few notes about the wrong fields:

LCDCTRL_VSDELAY(1) actually sets LCDCTRL_DCLK_POL
LCDCTRL_UNK6 | LCDCTRL_VTGEN actually set LCDCTRL_PXLFORM_RGB888
LCDCTRL_RGB888 actually sets LCDCTRL_DPI_EN

The total still resulted in a working display even if the defines were
quite wrong.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index c8b9984ff301..669052074974 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -47,17 +47,22 @@
 #define DSI_LANEENABLE_L0EN	BIT(1)
 #define DSI_LANEENABLE_L1EN	BIT(2)
 
-/* LCDC/DPI Host Registers, based on guesswork that this matches TC358764 */
+/* LCDC/DPI Registers */
 #define LCDCTRL			0x0420 /* Video Path Control */
 #define LCDCTRL_MSF		BIT(0) /* Magic square in RGB666 */
-#define LCDCTRL_VTGEN		BIT(4)/* Use chip clock for timing */
-#define LCDCTRL_UNK6		BIT(6) /* Unknown */
-#define LCDCTRL_EVTMODE		BIT(5) /* Event mode */
-#define LCDCTRL_RGB888		BIT(8) /* RGB888 mode */
-#define LCDCTRL_HSPOL		BIT(17) /* Polarity of HSYNC signal */
-#define LCDCTRL_DEPOL		BIT(18) /* Polarity of DE signal */
-#define LCDCTRL_VSPOL		BIT(19) /* Polarity of VSYNC signal */
-#define LCDCTRL_VSDELAY(v)	(((v) & 0xfff) << 20) /* VSYNC delay */
+#define LCDCTRL_VTGEN		BIT(1) /* Use chip clock for timing */
+#define LCDCTRL_PXLFORM		GENMASK_U32(6, 4)
+#define LCDCTRL_PXLFORM_RGB666		0	/* x:R:G:B 6:8:8:8 */
+#define LCDCTRL_PXLFORM_RGB666_24	1	/* x:R:x:G:x:B 2:6:2:6:2:6 */
+#define LCDCTRL_PXLFORM_RGB565		2	/* x:R:G:B 8:5:6:5 */
+#define LCDCTRL_PXLFORM_RGB565_1	3	/* x:R:x:G:x:B 3:5:2:6:3:5 */
+#define LCDCTRL_PXLFORM_RGB565_2	4	/* x:R:x:G:x:B:x 2:5:3:6:2:5:1 */
+#define LCDCTRL_PXLFORM_RGB888		5	/* R:G:B 8:8:8 */
+#define LCDCTRL_DPI_EN		BIT(8)
+#define LCDCTRL_HSYNC_POL	BIT(17) /* Polarity of HSYNC signal */
+#define LCDCTRL_DE_POL		BIT(18) /* Polarity of DE signal */
+#define LCDCTRL_VSYNC_POL	BIT(19) /* Polarity of VSYNC signal */
+#define LCDCTRL_DCLK_POL	BIT(20) /* Polarity of pixel clock */
 
 /* SPI Master Registers */
 #define SPICMR			0x0450
@@ -140,14 +145,16 @@ static int tc358762_init(struct tc358762 *ctx)
 
 	tc358762_write(ctx, SPICMR, 0x00);
 
-	lcdctrl = LCDCTRL_VSDELAY(1) | LCDCTRL_RGB888 |
-		  LCDCTRL_UNK6 | LCDCTRL_VTGEN;
+	lcdctrl = FIELD_PREP(LCDCTRL_PXLFORM, LCDCTRL_PXLFORM_RGB888) |
+		  LCDCTRL_DPI_EN;
+
+	lcdctrl |= LCDCTRL_DCLK_POL;
 
 	if (ctx->mode.flags & DRM_MODE_FLAG_NHSYNC)
-		lcdctrl |= LCDCTRL_HSPOL;
+		lcdctrl |= LCDCTRL_HSYNC_POL;
 
 	if (ctx->mode.flags & DRM_MODE_FLAG_NVSYNC)
-		lcdctrl |= LCDCTRL_VSPOL;
+		lcdctrl |= LCDCTRL_VSYNC_POL;
 
 	tc358762_write(ctx, LCDCTRL, lcdctrl);
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 04/13] drm/bridge: tc358762: Configure SYSCTRL first
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (2 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 03/13] drm/bridge: tc358762: Improve LCDCTRL defines Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 05/13] drm/bridge: tc358762: Drop SPICMR write Tomi Valkeinen
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

SYSCTRL affects the DPI output and the clock tree, but we configure it
late, when the DPI output is already enabled and clocks are running.

Move the SYSCTRL configuration to the beginning, before anything is
enabled.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 669052074974..d119e399f7a2 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -135,6 +135,13 @@ static int tc358762_init(struct tc358762 *ctx)
 {
 	u32 lcdctrl;
 
+	tc358762_write(ctx, SYSCTRL,
+		       FIELD_PREP(SYSCTRL_DPIDATA_IO_MASK, SYSCTRL_DPIDATA_IO_4MA) |
+		       FIELD_PREP(SYSCTRL_DPISTB_IO_MASK, SYSCTRL_DPISTB_IO_4MA) |
+		       FIELD_PREP(SYSCTRL_PCLKDIV_MASK, SYSCTRL_PCLKDIV_DIV_3));
+
+	msleep(100);
+
 	tc358762_write(ctx, DSI_LANEENABLE,
 		       DSI_LANEENABLE_L0EN | DSI_LANEENABLE_CLEN);
 	tc358762_write(ctx, PPI_D0S_CLRSIPOCOUNT, 5);
@@ -158,13 +165,6 @@ static int tc358762_init(struct tc358762 *ctx)
 
 	tc358762_write(ctx, LCDCTRL, lcdctrl);
 
-	tc358762_write(ctx, SYSCTRL,
-		       FIELD_PREP(SYSCTRL_DPIDATA_IO_MASK, SYSCTRL_DPIDATA_IO_4MA) |
-		       FIELD_PREP(SYSCTRL_DPISTB_IO_MASK, SYSCTRL_DPISTB_IO_4MA) |
-		       FIELD_PREP(SYSCTRL_PCLKDIV_MASK, SYSCTRL_PCLKDIV_DIV_3));
-
-	msleep(100);
-
 	tc358762_write(ctx, PPI_STARTPPI, PPI_STARTPPI_STARTPPI);
 	tc358762_write(ctx, DSI_STARTDSI, DSI_STARTDSI_STARTDSI);
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 05/13] drm/bridge: tc358762: Drop SPICMR write
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (3 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 04/13] drm/bridge: tc358762: Configure SYSCTRL first Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 06/13] drm/bridge: tc358762: Improve DPI enable handling Tomi Valkeinen
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

Drop write to SPICMR. It's unclear why the write is there, as SPI is not
supported in the driver, and it's mostly just writing zeroes to already
zero fields (reset defaults). None of the zero bits written disable
anything wrt. SPI.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index d119e399f7a2..a9c30acf1b14 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -150,8 +150,6 @@ static int tc358762_init(struct tc358762 *ctx)
 	tc358762_write(ctx, PPI_D1S_ATMR, 0);
 	tc358762_write(ctx, PPI_LPTXTIMECNT, LPX_PERIOD);
 
-	tc358762_write(ctx, SPICMR, 0x00);
-
 	lcdctrl = FIELD_PREP(LCDCTRL_PXLFORM, LCDCTRL_PXLFORM_RGB888) |
 		  LCDCTRL_DPI_EN;
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 06/13] drm/bridge: tc358762: Improve DPI enable handling
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (4 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 05/13] drm/bridge: tc358762: Drop SPICMR write Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 07/13] drm/bridge: tc358762: Update comment about the number of lanes Tomi Valkeinen
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

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 <tomi.valkeinen@ideasonboard.com>
---
 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


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 07/13] drm/bridge: tc358762: Update comment about the number of lanes
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (5 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 06/13] drm/bridge: tc358762: Improve DPI enable handling Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 08/13] drm/bridge: tc358762: Support VTG Tomi Valkeinen
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

Update comment about the number of lanes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 7840ab3454f6..c5734c4df440 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -306,7 +306,14 @@ static int tc358762_probe(struct mipi_dsi_device *dsi)
 	ctx->dev = dev;
 	ctx->pre_enabled = false;
 
-	/* TODO: Find out how to get dual-lane mode working */
+	/*
+	 * When using DSI clk for pixel clock (only mode supported in the driver),
+	 * the pclk is derived directly from the DSI byteclk via simple divider,
+	 * which is either 2 or 3.
+	 * The required divider can be calculated with bitspp / 8 / nlanes. Thus,
+	 * for RGB888, only nlanes = 1 works as nlanes = 2 would require divider
+	 * of 1.5.
+	 */
 	dsi->lanes = 1;
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 08/13] drm/bridge: tc358762: Support VTG
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (6 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 07/13] drm/bridge: tc358762: Update comment about the number of lanes Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 09/13] drm/bridge: tc358762: Fix sync polarities Tomi Valkeinen
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

TC358762 can generate the DPI output's timings in two ways, either Video
Timings Generator (VTG) on or off:
- VTG off: Duplicate the timings coming from the DSI. This requires DSI
  pulse mode.
- VTG on: Sync frame on DSI VSync Start, but the exact output timings
  are defined in TC358762 registers. This can be used with DSI
  event/burst mode.

We are currently using VTG off in the driver.

I observe that the hsync signal, on my HW setup, is not 100% stable with
VTG off, and it seems to lengthen by a single clock every now and then.
However, it then stabilizes later. To me the DSI input looks solid, but
that is more challenging to measure exactly. So I have not found the
root cause for this.

Turning VTG on removes that instability. As I dont' see any downsides
with enabling VTG (and it would allow extending the driver to use
event/burst mode in the future), let's always enable the VTG.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index c5734c4df440..2d9491e8e582 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -19,6 +19,7 @@
 #include <linux/regulator/consumer.h>
 
 #include <video/mipi_display.h>
+#include <video/videomode.h>
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
@@ -64,6 +65,12 @@
 #define LCDCTRL_VSYNC_POL	BIT(19) /* Polarity of VSYNC signal */
 #define LCDCTRL_DCLK_POL	BIT(20) /* Polarity of pixel clock */
 
+#define LCDC_HSR_HBPR		0x0424
+#define LCDC_HDISPR_HFPR	0x0428
+#define LCDC_VSR_VBPR		0x042C
+#define LCDC_VDISPR_VFPR	0x0430
+#define LCDC_VFUEN		0x0434
+
 /* SPI Master Registers */
 #define SPICMR			0x0450
 #define SPITCR			0x0454
@@ -95,6 +102,7 @@ struct tc358762 {
 	struct drm_display_mode mode;
 	bool pre_enabled;
 	int error;
+	bool use_vtg;
 };
 
 static int tc358762_clear_error(struct tc358762 *ctx)
@@ -156,9 +164,31 @@ static int tc358762_init(struct tc358762 *ctx)
 	tc358762_write(ctx, PPI_D1S_ATMR, 0);
 	tc358762_write(ctx, PPI_LPTXTIMECNT, LPX_PERIOD);
 
+	if (ctx->use_vtg) {
+		struct videomode vm = { 0 };
+
+		drm_display_mode_to_videomode(&ctx->mode, &vm);
+
+		tc358762_write(ctx, LCDC_HSR_HBPR,
+			       vm.hsync_len | (vm.hback_porch << 16));
+		tc358762_write(ctx, LCDC_HDISPR_HFPR,
+			       vm.hactive | (vm.hfront_porch << 16));
+
+		tc358762_write(ctx, LCDC_VSR_VBPR,
+			       vm.vsync_len | (vm.vback_porch << 16));
+		tc358762_write(ctx, LCDC_VDISPR_VFPR,
+			       vm.vactive | (vm.vfront_porch << 16));
+
+		/* Upload VTG timings */
+		tc358762_write(ctx, LCDC_VFUEN, BIT(0));
+	}
+
 	lcdctrl = FIELD_PREP(LCDCTRL_PXLFORM, LCDCTRL_PXLFORM_RGB888) |
 		  LCDCTRL_DPI_EN;
 
+	if (ctx->use_vtg)
+		lcdctrl |= LCDCTRL_VTGEN;
+
 	lcdctrl |= LCDCTRL_DCLK_POL;
 
 	if (ctx->mode.flags & DRM_MODE_FLAG_NHSYNC)
@@ -306,6 +336,9 @@ static int tc358762_probe(struct mipi_dsi_device *dsi)
 	ctx->dev = dev;
 	ctx->pre_enabled = false;
 
+	/* Always use VTG */
+	ctx->use_vtg = true;
+
 	/*
 	 * When using DSI clk for pixel clock (only mode supported in the driver),
 	 * the pclk is derived directly from the DSI byteclk via simple divider,

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 09/13] drm/bridge: tc358762: Fix sync polarities
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (7 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 08/13] drm/bridge: tc358762: Support VTG Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 10/13] drm/bridge: tc358762: Move tc358762_init() into tc358762_enable() Tomi Valkeinen
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

Setting LCDCTRL_HSYNC_POL and LCDCTRL_VSYNC_POL will make the respective
sync signal active high. The driver does this in inverse. Fix it.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 2d9491e8e582..5d6092e1d190 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -191,10 +191,10 @@ static int tc358762_init(struct tc358762 *ctx)
 
 	lcdctrl |= LCDCTRL_DCLK_POL;
 
-	if (ctx->mode.flags & DRM_MODE_FLAG_NHSYNC)
+	if (ctx->mode.flags & DRM_MODE_FLAG_PHSYNC)
 		lcdctrl |= LCDCTRL_HSYNC_POL;
 
-	if (ctx->mode.flags & DRM_MODE_FLAG_NVSYNC)
+	if (ctx->mode.flags & DRM_MODE_FLAG_PVSYNC)
 		lcdctrl |= LCDCTRL_VSYNC_POL;
 
 	tc358762_write(ctx, LCDCTRL, lcdctrl);

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 10/13] drm/bridge: tc358762: Move tc358762_init() into tc358762_enable()
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (8 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 09/13] drm/bridge: tc358762: Fix sync polarities Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 11/13] drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set Tomi Valkeinen
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

The only thing tc358762_enable() does is call tc358762_init(). Inline
the tc358762_init() into tc358762_enable(), for simplicity and to make
it easier to improve the tc358762_enable() in the following commits. No
functional change.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 104 ++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 5d6092e1d190..89c02b2e6832 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -139,9 +139,56 @@ static inline struct tc358762 *bridge_to_tc358762(struct drm_bridge *bridge)
 	return container_of(bridge, struct tc358762, bridge);
 }
 
-static int tc358762_init(struct tc358762 *ctx)
+static void tc358762_post_disable(struct drm_bridge *bridge,
+				  struct drm_atomic_state *state)
+{
+	struct tc358762 *ctx = bridge_to_tc358762(bridge);
+	int ret;
+
+	/*
+	 * The post_disable hook might be called multiple times.
+	 * We want to avoid regulator imbalance below.
+	 */
+	if (!ctx->pre_enabled)
+		return;
+
+	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);
+
+	ret = regulator_disable(ctx->regulator);
+	if (ret < 0)
+		dev_err(ctx->dev, "error disabling regulators (%d)\n", ret);
+}
+
+static void tc358762_pre_enable(struct drm_bridge *bridge,
+				struct drm_atomic_state *state)
 {
+	struct tc358762 *ctx = bridge_to_tc358762(bridge);
+	int ret;
+
+	ret = regulator_enable(ctx->regulator);
+	if (ret < 0)
+		dev_err(ctx->dev, "error enabling regulators (%d)\n", ret);
+
+	if (ctx->reset_gpio) {
+		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		usleep_range(5000, 10000);
+	}
+
+	ctx->pre_enabled = true;
+}
+
+static void tc358762_enable(struct drm_bridge *bridge,
+			    struct drm_atomic_state *state)
+{
+	struct tc358762 *ctx = bridge_to_tc358762(bridge);
 	u32 lcdctrl;
+	int ret;
 
 	/*
 	 * DPIENABLE has reset default of 1. Make sure we don't output on
@@ -204,60 +251,7 @@ static int tc358762_init(struct tc358762 *ctx)
 
 	msleep(100);
 
-	return tc358762_clear_error(ctx);
-}
-
-static void tc358762_post_disable(struct drm_bridge *bridge,
-				  struct drm_atomic_state *state)
-{
-	struct tc358762 *ctx = bridge_to_tc358762(bridge);
-	int ret;
-
-	/*
-	 * The post_disable hook might be called multiple times.
-	 * We want to avoid regulator imbalance below.
-	 */
-	if (!ctx->pre_enabled)
-		return;
-
-	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);
-
-	ret = regulator_disable(ctx->regulator);
-	if (ret < 0)
-		dev_err(ctx->dev, "error disabling regulators (%d)\n", ret);
-}
-
-static void tc358762_pre_enable(struct drm_bridge *bridge,
-				struct drm_atomic_state *state)
-{
-	struct tc358762 *ctx = bridge_to_tc358762(bridge);
-	int ret;
-
-	ret = regulator_enable(ctx->regulator);
-	if (ret < 0)
-		dev_err(ctx->dev, "error enabling regulators (%d)\n", ret);
-
-	if (ctx->reset_gpio) {
-		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
-		usleep_range(5000, 10000);
-	}
-
-	ctx->pre_enabled = true;
-}
-
-static void tc358762_enable(struct drm_bridge *bridge,
-			    struct drm_atomic_state *state)
-{
-	struct tc358762 *ctx = bridge_to_tc358762(bridge);
-	int ret;
-
-	ret = tc358762_init(ctx);
+	ret = tc358762_clear_error(ctx);
 	if (ret < 0)
 		dev_err(ctx->dev, "error initializing bridge (%d)\n", ret);
 }

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 11/13] drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (9 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 10/13] drm/bridge: tc358762: Move tc358762_init() into tc358762_enable() Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 12/13] drm/bridge: tc358762: Set DE_POL and DCLK_POL properly Tomi Valkeinen
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

drm_bridge_funcs.mode_set is deprecated. Drop it and get the
drm_display_mode from the atomic state.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 89c02b2e6832..47ae706de4cb 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -99,7 +99,6 @@ struct tc358762 {
 	struct regulator *regulator;
 	struct drm_bridge *panel_bridge;
 	struct gpio_desc *reset_gpio;
-	struct drm_display_mode mode;
 	bool pre_enabled;
 	int error;
 	bool use_vtg;
@@ -187,9 +186,18 @@ static void tc358762_enable(struct drm_bridge *bridge,
 			    struct drm_atomic_state *state)
 {
 	struct tc358762 *ctx = bridge_to_tc358762(bridge);
+	struct drm_connector_state *conn_state;
+	struct drm_crtc_state *crtc_state;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
 	u32 lcdctrl;
 	int ret;
 
+	connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+	conn_state = drm_atomic_get_new_connector_state(state, connector);
+	crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+	mode = &crtc_state->mode;
+
 	/*
 	 * DPIENABLE has reset default of 1. Make sure we don't output on
 	 * DPI until we have finished the coniguration.
@@ -214,7 +222,7 @@ static void tc358762_enable(struct drm_bridge *bridge,
 	if (ctx->use_vtg) {
 		struct videomode vm = { 0 };
 
-		drm_display_mode_to_videomode(&ctx->mode, &vm);
+		drm_display_mode_to_videomode(mode, &vm);
 
 		tc358762_write(ctx, LCDC_HSR_HBPR,
 			       vm.hsync_len | (vm.hback_porch << 16));
@@ -238,10 +246,10 @@ static void tc358762_enable(struct drm_bridge *bridge,
 
 	lcdctrl |= LCDCTRL_DCLK_POL;
 
-	if (ctx->mode.flags & DRM_MODE_FLAG_PHSYNC)
+	if (mode->flags & DRM_MODE_FLAG_PHSYNC)
 		lcdctrl |= LCDCTRL_HSYNC_POL;
 
-	if (ctx->mode.flags & DRM_MODE_FLAG_PVSYNC)
+	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
 		lcdctrl |= LCDCTRL_VSYNC_POL;
 
 	tc358762_write(ctx, LCDCTRL, lcdctrl);
@@ -266,15 +274,6 @@ static int tc358762_attach(struct drm_bridge *bridge,
 				 bridge, flags);
 }
 
-static void tc358762_bridge_mode_set(struct drm_bridge *bridge,
-				     const struct drm_display_mode *mode,
-				     const struct drm_display_mode *adj)
-{
-	struct tc358762 *ctx = bridge_to_tc358762(bridge);
-
-	drm_mode_copy(&ctx->mode, mode);
-}
-
 static const struct drm_bridge_funcs tc358762_bridge_funcs = {
 	.atomic_post_disable = tc358762_post_disable,
 	.atomic_pre_enable = tc358762_pre_enable,
@@ -283,7 +282,6 @@ static const struct drm_bridge_funcs tc358762_bridge_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
 	.atomic_reset = drm_atomic_helper_bridge_reset,
 	.attach = tc358762_attach,
-	.mode_set = tc358762_bridge_mode_set,
 };
 
 static int tc358762_parse_dt(struct tc358762 *ctx)

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 12/13] drm/bridge: tc358762: Set DE_POL and DCLK_POL properly
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (10 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 11/13] drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-13 13:10 ` [PATCH v3 13/13] drm/panel-simple: Fix powertip,ph800480t013-idf02 timings Tomi Valkeinen
  2026-05-16  2:04 ` Claude review: drm/bridge: tc358762: Various small fixes Claude Code Review Bot
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

The driver hardcodes LCDCTRL_DCLK_POL and ~DE_POL, ignoring what the
panel actuall wants. Fix this by looking at the
bridge_state->output_bus_cfg.flags, and set the polarities correctly.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 47ae706de4cb..92e7e2ade942 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -187,12 +187,15 @@ static void tc358762_enable(struct drm_bridge *bridge,
 {
 	struct tc358762 *ctx = bridge_to_tc358762(bridge);
 	struct drm_connector_state *conn_state;
+	struct drm_bridge_state *bridge_state;
 	struct drm_crtc_state *crtc_state;
 	struct drm_connector *connector;
 	struct drm_display_mode *mode;
 	u32 lcdctrl;
 	int ret;
 
+	bridge_state = drm_atomic_get_new_bridge_state(state, bridge);
+
 	connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
 	conn_state = drm_atomic_get_new_connector_state(state, connector);
 	crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
@@ -244,7 +247,9 @@ static void tc358762_enable(struct drm_bridge *bridge,
 	if (ctx->use_vtg)
 		lcdctrl |= LCDCTRL_VTGEN;
 
-	lcdctrl |= LCDCTRL_DCLK_POL;
+	/* Note: DCLK_POL affects pixdata, de and syncs */
+	if (bridge_state->output_bus_cfg.flags & DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE)
+		lcdctrl |= LCDCTRL_DCLK_POL;
 
 	if (mode->flags & DRM_MODE_FLAG_PHSYNC)
 		lcdctrl |= LCDCTRL_HSYNC_POL;
@@ -252,6 +257,9 @@ static void tc358762_enable(struct drm_bridge *bridge,
 	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
 		lcdctrl |= LCDCTRL_VSYNC_POL;
 
+	if (bridge_state->output_bus_cfg.flags & DRM_BUS_FLAG_DE_LOW)
+		lcdctrl |= LCDCTRL_DE_POL;
+
 	tc358762_write(ctx, LCDCTRL, lcdctrl);
 
 	tc358762_write(ctx, PPI_STARTPPI, PPI_STARTPPI_STARTPPI);

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v3 13/13] drm/panel-simple: Fix powertip,ph800480t013-idf02 timings
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (11 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 12/13] drm/bridge: tc358762: Set DE_POL and DCLK_POL properly Tomi Valkeinen
@ 2026-05-13 13:10 ` Tomi Valkeinen
  2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
  2026-05-16  2:04 ` Claude review: drm/bridge: tc358762: Various small fixes Claude Code Review Bot
  13 siblings, 1 reply; 28+ messages in thread
From: Tomi Valkeinen @ 2026-05-13 13:10 UTC (permalink / raw)
  To: Marek Vasut, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: dri-devel, linux-kernel, Dave Stevenson, Tomi Valkeinen

The powertip,ph800480t013-idf02 panel was added to panel-simple, and
with the tc358762 driver, enabled the use of RaspberryPi 7" DSI display.

I have been testing the RaspberryPi 7" DSI display module with TI's
BeagleY-AI, and I can't get a good image with the current panel timings.

It's been quite difficult to figure out exactly what are the issues.
Possibly RPi DSI TX and TI DSI TX have their own quirks which affect
this also. However, now that the tc358762 driver has been fixed wrt. the
signal timings it sends, this patch makes the panel work fine on
BeagleY-AI.

Fix the timings according to the datasheet:

- hsw + hbp must equal to 46. This was correct in the timings, but the
  hsw was very tight, and at least Cadence DSI has trouble with such
  short hsync. Increase hsw to the middle of the hsw range from the
  datasheet, and decrease hbp accordingly.
- vsw + vbp must equal to 23. This was 24, resulting in slight shift in
  the image.
- The upstream timings seemed to aim for 50 fps, but this is a normal 60
  fps panel, so adjust the timings to get 60 fps. As there's no strict
  rule what numbers to pick here, I used the "typical" values from panel
  datasheet for pclk, hfp and vfp. However, vfp of 23 instead of the
  datasheet's 22 give us a closer match to 60 fps, so I used that.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/panel/panel-simple.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 91ab280869ba..16aeafd2b02e 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -4041,15 +4041,15 @@ static const struct panel_desc powertip_ph128800t006_zhc01 = {
 };
 
 static const struct drm_display_mode powertip_ph800480t013_idf02_mode = {
-	.clock = 24750,
+	.clock = 33333,
 	.hdisplay = 800,
-	.hsync_start = 800 + 54,
-	.hsync_end = 800 + 54 + 2,
-	.htotal = 800 + 54 + 2 + 44,
+	.hsync_start = 800 + 210,
+	.hsync_end = 800 + 210 + 20,
+	.htotal = 800 + 210 + 20 + 26,
 	.vdisplay = 480,
-	.vsync_start = 480 + 49,
-	.vsync_end = 480 + 49 + 2,
-	.vtotal = 480 + 49 + 2 + 22,
+	.vsync_start = 480 + 23,
+	.vsync_end = 480 + 23 + 2,
+	.vtotal = 480 + 23 + 2 + 21,
 	.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
 };
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Various small fixes
  2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
                   ` (12 preceding siblings ...)
  2026-05-13 13:10 ` [PATCH v3 13/13] drm/panel-simple: Fix powertip,ph800480t013-idf02 timings Tomi Valkeinen
@ 2026-05-16  2:04 ` Claude Code Review Bot
  13 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/bridge: tc358762: Various small fixes
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Patches: 14
Reviewed: 2026-05-16T12:04:20.988257

---

This is a well-structured 13-patch series from Tomi Valkeinen fixing the TC358762 DSI-to-DPI bridge driver. The series progresses logically: first cleaning up register defines (patches 1-3), then reordering initialization (patch 4), removing dead code (patch 5), fixing DPI enable sequencing (patch 6), documenting constraints (patch 7), adding VTG support (patch 8), fixing polarity bugs (patches 9, 12), refactoring (patches 10-11), and finally fixing the companion panel timings (patch 13).

The register define corrections in patch 3 are the key insight — the old defines were wrong but happened to produce the correct bit pattern by coincidence (`LCDCTRL_VSDELAY(1) | LCDCTRL_RGB888 | LCDCTRL_UNK6 | LCDCTRL_VTGEN` = `FIELD_PREP(LCDCTRL_PXLFORM, RGB888) | LCDCTRL_DPI_EN | LCDCTRL_DCLK_POL` = 0x100150). I verified both the SYSCTRL (0x040f) and LCDCTRL (0x100150) values are preserved exactly through the define cleanup, so the "no functional change" claim is correct.

The series is well-ordered for bisectability and each patch is reasonably self-contained. One issue worth flagging is the missing NULL checks in patch 11.

**Recommendation: Looks good overall. One minor issue (missing NULL check) worth addressing.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Clean up register defines
  2026-05-13 13:10 ` [PATCH v3 01/13] drm/bridge: tc358762: Clean up register defines Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Straightforward rename of magic constants to proper `BIT()` and register-prefixed defines. `PPI_START_FUNCTION` → `PPI_STARTPPI_STARTPPI`, `DSI_RX_START` → `DSI_STARTDSI_STARTDSI`, and `LANEENABLE_*` → `DSI_LANEENABLE_*`.

The naming `PPI_STARTPPI_STARTPPI` and `DSI_STARTDSI_STARTDSI` is a bit stuttery but follows the convention of `REGISTER_FIELD`, which is standard for register-prefixed defines when the field name matches the register name (common in Toshiba datasheets).

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Improve SYSCTRL register defines
  2026-05-13 13:10 ` [PATCH v3 02/13] drm/bridge: tc358762: Improve SYSCTRL " Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Adds `#include <linux/bitfield.h>` and defines SYSCTRL fields using `GENMASK_U32` and `FIELD_PREP`. Replaces the magic `0x040f` with readable field-prep expressions. I verified that `FIELD_PREP(GENMASK(1,0), 3) | FIELD_PREP(GENMASK(3,2), 3) | FIELD_PREP(GENMASK(11,8), 4)` = 0x040F, matching the old value exactly.

One minor note: `SYSCTRL_PCLKDIV_DIV_3` is defined as `4` (not `3`). This is correct — it's a register field value, not a divider value. But it could be slightly confusing without a comment. The cover letter and patch 7's comment later explain the divider relationship (bitspp / 8 / nlanes), which helps.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Improve LCDCTRL defines
  2026-05-13 13:10 ` [PATCH v3 03/13] drm/bridge: tc358762: Improve LCDCTRL defines Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

This is the most important cleanup patch. The old LCDCTRL defines were significantly wrong:

- Old `LCDCTRL_VTGEN BIT(4)` → New `LCDCTRL_VTGEN BIT(1)` (the old "VTGEN" was actually part of the pixel format field)
- Old `LCDCTRL_UNK6 BIT(6)` → part of `LCDCTRL_PXLFORM GENMASK(6,4)` 
- Old `LCDCTRL_RGB888 BIT(8)` → New `LCDCTRL_DPI_EN BIT(8)`
- Old `LCDCTRL_VSDELAY(v) (v<<20)` → New `LCDCTRL_DCLK_POL BIT(20)`

The commit message clearly explains the mapping. I verified: old value `LCDCTRL_VSDELAY(1)|LCDCTRL_RGB888|LCDCTRL_UNK6|LCDCTRL_VTGEN` = `BIT(20)|BIT(8)|BIT(6)|BIT(4)` = 0x100150, new value `FIELD_PREP(GENMASK(6,4),5)|LCDCTRL_DPI_EN|LCDCTRL_DCLK_POL` = `0x50|0x100|0x100000` = 0x100150. Matches perfectly.

Also correctly removes the "based on guesswork" comment, suggesting Tomi has verified these against actual documentation. The polarity defines are renamed from `HSPOL`/`DEPOL`/`VSPOL` to `HSYNC_POL`/`DE_POL`/`VSYNC_POL` for clarity.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Configure SYSCTRL first
  2026-05-13 13:10 ` [PATCH v3 04/13] drm/bridge: tc358762: Configure SYSCTRL first Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Moves the SYSCTRL write (which configures DPI I/O drive strength and pixel clock divider) to the beginning of `tc358762_init()`, before enabling DSI lanes and DPI output. This is sensible — the clock tree and I/O should be configured before enabling downstream blocks.

The `msleep(100)` moves with it, which makes sense as it likely gives the PLL/clock divider time to stabilize.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Drop SPICMR write
  2026-05-13 13:10 ` [PATCH v3 05/13] drm/bridge: tc358762: Drop SPICMR write Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Removes `tc358762_write(ctx, SPICMR, 0x00)`. The commit message explains this writes zeros to already-zero (reset default) SPI control register fields, and SPI is not used by this driver. Reasonable cleanup.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Improve DPI enable handling
  2026-05-13 13:10 ` [PATCH v3 06/13] drm/bridge: tc358762: Improve DPI enable handling Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Adds `tc358762_write(ctx, LCDCTRL, 0)` at the start of init to clear DPIENABLE (which defaults to 1 on reset), preventing temporary DPI output with wrong timings during configuration. Also adds a matching `tc358762_write(ctx, LCDCTRL, 0)` in `post_disable` to explicitly disable DPI output.

Minor nit: the comment says "coniguration" — typo for "configuration":
```c
	 * DPI until we have finished the coniguration.
```
This is cosmetic but worth fixing.

Otherwise, the approach is correct. **Reviewed-by worthy** with the typo fix.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Update comment about the number of lanes
  2026-05-13 13:10 ` [PATCH v3 07/13] drm/bridge: tc358762: Update comment about the number of lanes Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Replaces the `TODO: Find out how to get dual-lane mode working` with a clear explanation of *why* only 1 lane works: with DSI clock as pixel clock source, the divider is `bitspp / 8 / nlanes`. For RGB888, nlanes=1 gives divider=3, nlanes=2 would need divider=1.5 which isn't possible.

This is a good explanation that saves future developers from going down a rabbit hole. The comment references `SYSCTRL_PCLKDIV_DIV_2` and `SYSCTRL_PCLKDIV_DIV_3` defined in patch 2, making the connection clear.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Support VTG
  2026-05-13 13:10 ` [PATCH v3 08/13] drm/bridge: tc358762: Support VTG Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Adds Video Timing Generator support. When VTG is enabled, the TC358762 generates DPI output timings from its internal registers rather than duplicating DSI input timings. This fixes observed hsync instability.

The implementation:
- Adds VTG register defines (`LCDC_HSR_HBPR`, `LCDC_HDISPR_HFPR`, etc.)
- Converts `drm_display_mode` to `videomode` and programs the timing registers
- Sets `LCDCTRL_VTGEN` and triggers `LCDC_VFUEN` to upload timings
- Adds `use_vtg` flag, hardcoded to `true` in probe

The `use_vtg` field and conditional could be simplified to always-on code since it's hardcoded to `true`, but keeping it as a flag makes the code self-documenting and leaves room for future configurability. This is reasonable.

One observation: `struct videomode vm = { 0 }` — the preferred kernel style is `= { }` or `= {}`, but `= { 0 }` works fine and is common enough.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Fix sync polarities
  2026-05-13 13:10 ` [PATCH v3 09/13] drm/bridge: tc358762: Fix sync polarities Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Fixes the polarity logic: `LCDCTRL_HSYNC_POL` makes hsync active-high, so it should be set for `DRM_MODE_FLAG_PHSYNC` (positive hsync), not `DRM_MODE_FLAG_NHSYNC`. Same for vsync. The old code had this inverted.

This is a real bug fix. Note that for the Raspberry Pi display which uses `DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC`, neither flag gets set — which matches the old behavior where `NHSYNC → set HSPOL` but the old HSPOL was actually at the wrong bit position (it was `LCDCTRL_VSDELAY(1)` = BIT(20) = DCLK_POL). So the old code had two bugs that partially cancelled out.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Move tc358762_init() into tc358762_enable()
  2026-05-13 13:10 ` [PATCH v3 10/13] drm/bridge: tc358762: Move tc358762_init() into tc358762_enable() Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Inlines `tc358762_init()` into `tc358762_enable()`, also moving `post_disable` and `pre_enable` above `enable` to avoid forward declarations. Pure refactor, no functional change.

The function ordering in the source changes but the `drm_bridge_funcs` struct wiring remains the same. This prepares for patch 11 which needs to access atomic state in the enable path.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set
  2026-05-13 13:10 ` [PATCH v3 11/13] drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Replaces the deprecated `.mode_set` callback (which stored the mode into `ctx->mode`) with fetching the mode from atomic state in `tc358762_enable()`. Uses `drm_atomic_get_new_connector_for_encoder()` → `drm_atomic_get_new_connector_state()` → `drm_atomic_get_new_crtc_state()` → `crtc_state->mode`.

**Issue: Missing NULL checks.** The return values of `drm_atomic_get_new_connector_for_encoder()`, `drm_atomic_get_new_connector_state()`, and `drm_atomic_get_new_crtc_state()` can all be NULL. While in practice they shouldn't be NULL when called from `atomic_enable` (the CRTC/connector must be active), other bridge drivers (e.g., `dw-dp.c`, `adv7511_drv.c`, `analogix_dp_core.c`) do NULL-check the connector return. The sibling driver `tc358768.c` doesn't check either, but that doesn't make it right.

```c
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
conn_state = drm_atomic_get_new_connector_state(state, connector);
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
mode = &crtc_state->mode;
```

A NULL `connector` here would cause a NULL-pointer dereference on the next line. Recommend at minimum a `WARN_ON(!connector)` guard with early return, consistent with the pattern in `adv7511_drv.c`.

Also uses `crtc_state->mode` rather than `crtc_state->adjusted_mode`. This is consistent with the original `.mode_set` which was passed the unadjusted mode, so it preserves behavior. But for a bridge that needs actual hardware timings, `adjusted_mode` is often more appropriate. Worth considering whether `adjusted_mode` would be better, though for this simple bridge the difference is likely negligible.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/bridge: tc358762: Set DE_POL and DCLK_POL properly
  2026-05-13 13:10 ` [PATCH v3 12/13] drm/bridge: tc358762: Set DE_POL and DCLK_POL properly Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Instead of hardcoding `LCDCTRL_DCLK_POL`, reads `bridge_state->output_bus_cfg.flags` to determine pixel clock edge and DE polarity. This makes the driver responsive to panel DT bus-flags.

For the existing `powertip_ph800480t013_idf02` panel which has:
```c
.bus_flags = DRM_BUS_FLAG_DE_HIGH |
             DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
             DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE,
```

`DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE` means the panel samples on negedge, so the bridge should *drive* on posedge (`DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE`). The `output_bus_cfg.flags` should reflect the panel's requirements after negotiation. With `DRM_BUS_FLAG_DE_HIGH`, `DE_POL` won't be set (active-high DE is the default when the bit is clear), which is correct.

Minor typo in the commit message: "actuall" should be "actually":
```
ignoring what the panel actuall wants
```

Otherwise correct. **Reviewed-by worthy** with the typo fix.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Claude review: drm/panel-simple: Fix powertip,ph800480t013-idf02 timings
  2026-05-13 13:10 ` [PATCH v3 13/13] drm/panel-simple: Fix powertip,ph800480t013-idf02 timings Tomi Valkeinen
@ 2026-05-16  2:04   ` Claude Code Review Bot
  0 siblings, 0 replies; 28+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:04 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Fixes the panel timings to match the datasheet:
- **hsw**: 2→20 (middle of datasheet range), hbp: 44→26 (hsw+hbp=46 preserved ✓)
- **vsw+vbp**: was 2+22=24, now 2+21=23 (matches datasheet ✓)
- **Clock**: 24750→33333 kHz (old gave ~49.7fps, new gives ~60fps ✓)
- **hfp**: 54→210, **vfp**: 49→23 (using datasheet typical values)

I verified: new htotal=1056, vtotal=526, fps=33333000/(1056×526)≈60.0. The math checks out.

The commit message is thorough in explaining the reasoning for each change. The `vfp=23` instead of datasheet's 22 for closer 60fps match is a reasonable practical choice, well-documented.

No issues. **Reviewed-by worthy.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2026-05-16  2:04 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 13:10 [PATCH v3 00/13] drm/bridge: tc358762: Various small fixes Tomi Valkeinen
2026-05-13 13:10 ` [PATCH v3 01/13] drm/bridge: tc358762: Clean up register defines Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 02/13] drm/bridge: tc358762: Improve SYSCTRL " Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 03/13] drm/bridge: tc358762: Improve LCDCTRL defines Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 04/13] drm/bridge: tc358762: Configure SYSCTRL first Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 05/13] drm/bridge: tc358762: Drop SPICMR write Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 06/13] drm/bridge: tc358762: Improve DPI enable handling Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 07/13] drm/bridge: tc358762: Update comment about the number of lanes Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 08/13] drm/bridge: tc358762: Support VTG Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 09/13] drm/bridge: tc358762: Fix sync polarities Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 10/13] drm/bridge: tc358762: Move tc358762_init() into tc358762_enable() Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 11/13] drm/bridge: tc358762: Drop drm_bridge_funcs.mode_set Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 12/13] drm/bridge: tc358762: Set DE_POL and DCLK_POL properly Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-13 13:10 ` [PATCH v3 13/13] drm/panel-simple: Fix powertip,ph800480t013-idf02 timings Tomi Valkeinen
2026-05-16  2:04   ` Claude review: " Claude Code Review Bot
2026-05-16  2:04 ` Claude review: drm/bridge: tc358762: Various small fixes Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox