mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] drm/bridge: cdns-dsi: A few fixes
@ 2026-09-07 11:13 Tomi Valkeinen
  2026-09-07 11:13 ` [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print Tomi Valkeinen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2026-09-07 11:13 UTC (permalink / raw)
  To: 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, Devarsh Thakkar, Tomi Valkeinen

Cadence DSI bridge fixes for missing stop-state and bus flags.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
Changes in v2:
- Add Fixes: tags
- Link to v1: https://lore.kernel.org/r/20260327-cdns-dsi-fixes-v1-0-088edd40e97f@ideasonboard.com

---
Tomi Valkeinen (3):
      drm/bridge: cdns-dsi: Add clk debug print
      drm/bridge: cdns-dsi: Fix stop-state at enable time
      drm/bridge: cdns-dsi: Fix mode and bus flags

 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260327-cdns-dsi-fixes-4e1b506e415d

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


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

* [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print
  2026-09-07 11:13 [PATCH v2 0/3] drm/bridge: cdns-dsi: A few fixes Tomi Valkeinen
@ 2026-09-07 11:13 ` Tomi Valkeinen
  2026-11-25 12:16   ` Thakkar, Devarsh
  2026-09-07 11:13 ` [PATCH v2 2/3] drm/bridge: cdns-dsi: Fix stop-state at enable time Tomi Valkeinen
  2026-09-07 11:13 ` [PATCH v2 3/3] drm/bridge: cdns-dsi: Fix mode and bus flags Tomi Valkeinen
  2 siblings, 1 reply; 5+ messages in thread
From: Tomi Valkeinen @ 2026-09-07 11:13 UTC (permalink / raw)
  To: 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, Devarsh Thakkar, Tomi Valkeinen

I keep adding this debug print while debugging panel problems. So let's
add it properly.

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

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index c3e466ded84a..4b7a3bf58255 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -718,6 +718,9 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
 	u32 tmp, reg_wakeup, div, status;
 	int nlanes;
 
+	dev_dbg(dsi->base.dev, "bitclk %lu, byteclk %lu\n",
+		phy_cfg->hs_clk_rate, phy_cfg->hs_clk_rate / 8);
+
 	/*
 	 * The cdns-dsi controller needs to be enabled before it's DPI source
 	 * has begun streaming. If this is not followed, there is a brief window

-- 
2.43.0


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

* [PATCH v2 2/3] drm/bridge: cdns-dsi: Fix stop-state at enable time
  2026-09-07 11:13 [PATCH v2 0/3] drm/bridge: cdns-dsi: A few fixes Tomi Valkeinen
  2026-09-07 11:13 ` [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print Tomi Valkeinen
@ 2026-09-07 11:13 ` Tomi Valkeinen
  2026-09-07 11:13 ` [PATCH v2 3/3] drm/bridge: cdns-dsi: Fix mode and bus flags Tomi Valkeinen
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2026-09-07 11:13 UTC (permalink / raw)
  To: 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, Devarsh Thakkar, Tomi Valkeinen

When using continuous clock, the cdns dsi doesn't keep the clock lanes in
LP-11 long enough to signal a stop state, although the data lanes are
kept high long enough. The data lanes most likely stay in LP-11 until
there is data to send, so the LP-11 duration is not defined.

While some DSI peripherals seem to work fine without correct stop-state
on the clock lane, at least Xilinx D-PHY RX fails to initialize if it
does not observe correct stop-state.

Add explicit stop-state handling to the driver. This is not described in
the documentation, but observing the clk and data lanes with an
oscilloscope, the solution in this patch seems to work:

Set the FORCE_STOP flags for clock and data lanes before starting the
D-PHY power up and init sequence, and drop the FORCE_STOP flags after
the init has been done, and 100 us has passed.

Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 4b7a3bf58255..b9c87f13177a 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -635,9 +635,16 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 {
 	struct cdns_dsi_output *output = &dsi->output;
 	u32 status;
+	u32 val;
 
 	if (dsi->phy_initialized)
 		return;
+
+	/* Set force stop state on all lanes */
+	val = readl(dsi->regs + MCTL_MAIN_EN);
+	val |= DATA_FORCE_STOP | CLK_FORCE_STOP;
+	writel(val, dsi->regs + MCTL_MAIN_EN);
+
 	/*
 	 * Power all internal DPHY blocks down and maintain their reset line
 	 * asserted before changing the DPHY config.
@@ -661,6 +668,13 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 	writel(DPHY_CMN_PSO | DPHY_ALL_D_PDN | DPHY_C_PDN | DPHY_CMN_PDN |
 	       DPHY_D_RSTB(output->dev->lanes) | DPHY_C_RSTB,
 	       dsi->regs + MCTL_DPHY_CFG0);
+
+	/* Keep stop state for at least 100 us */
+	usleep_range(100, 200);
+
+	val &= ~(DATA_FORCE_STOP | CLK_FORCE_STOP);
+	writel(val, dsi->regs + MCTL_MAIN_EN);
+
 	dsi->phy_initialized = true;
 }
 

-- 
2.43.0


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

* [PATCH v2 3/3] drm/bridge: cdns-dsi: Fix mode and bus flags
  2026-09-07 11:13 [PATCH v2 0/3] drm/bridge: cdns-dsi: A few fixes Tomi Valkeinen
  2026-09-07 11:13 ` [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print Tomi Valkeinen
  2026-09-07 11:13 ` [PATCH v2 2/3] drm/bridge: cdns-dsi: Fix stop-state at enable time Tomi Valkeinen
@ 2026-09-07 11:13 ` Tomi Valkeinen
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2026-09-07 11:13 UTC (permalink / raw)
  To: 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, Devarsh Thakkar, Tomi Valkeinen

The driver adjusts the flags in adjusted_mode to force the source to
send negative syncs. However, cdns-dsi also requires DE high, which is
not handled at all.

Add the correct DE high, along with explicit drive flags, via
bridge_state->input_bus_cfg.flags.

Also make the mode flags more robust: instead of passing the flags
forward with corrected h/v syncs, just set the full flags variable, as
there's no reason to pass any flags from the connector side to the
source.

Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index b9c87f13177a..ebaa060025a9 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -967,9 +967,11 @@ static int cdns_dsi_bridge_atomic_check(struct drm_bridge *bridge,
 	struct videomode vm;
 	long pclk;
 
-	/* cdns-dsi requires negative syncs */
-	adjusted_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
-	adjusted_mode->flags |= DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC;
+	/* cdns-dsi requires negative syncs, and DE high */
+	adjusted_mode->flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC;
+	bridge_state->input_bus_cfg.flags = DRM_BUS_FLAG_DE_HIGH |
+					    DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
+					    DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
 
 	/*
 	 * The DPHY PLL has quite a coarsely grained clock rate options. See

-- 
2.43.0


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

* Re: [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print
  2026-09-07 11:13 ` [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print Tomi Valkeinen
@ 2026-11-25 12:16   ` Thakkar, Devarsh
  0 siblings, 0 replies; 5+ messages in thread
From: Thakkar, Devarsh @ 2026-11-25 12:16 UTC (permalink / raw)
  To: Tomi Valkeinen, 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

On 07/09/26 16:43, Tomi Valkeinen wrote:
> I keep adding this debug print while debugging panel problems. So let's
> add it properly.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Devarsh Thakkar <devarsht@ti.com>

Regards
Devarsh

> ---
>  drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index c3e466ded84a..4b7a3bf58255 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -718,6 +718,9 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>  	u32 tmp, reg_wakeup, div, status;
>  	int nlanes;
>  
> +	dev_dbg(dsi->base.dev, "bitclk %lu, byteclk %lu\n",
> +		phy_cfg->hs_clk_rate, phy_cfg->hs_clk_rate / 8);
> +
>  	/*
>  	 * The cdns-dsi controller needs to be enabled before it's DPI source
>  	 * has begun streaming. If this is not followed, there is a brief window
> 


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

end of thread, other threads:[~2026-11-25 12:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07 11:13 [PATCH v2 0/3] drm/bridge: cdns-dsi: A few fixes Tomi Valkeinen
2026-09-07 11:13 ` [PATCH v2 1/3] drm/bridge: cdns-dsi: Add clk debug print Tomi Valkeinen
2026-11-25 12:16   ` Thakkar, Devarsh
2026-09-07 11:13 ` [PATCH v2 2/3] drm/bridge: cdns-dsi: Fix stop-state at enable time Tomi Valkeinen
2026-09-07 11:13 ` [PATCH v2 3/3] drm/bridge: cdns-dsi: Fix mode and bus flags Tomi Valkeinen

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

all inboxes | Powered by JetHome®