* [PATCH v5 1/4] drm/bridge: nwl-dsi: Cleanup endpoint mux control selection
2026-10-27 10:33 [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
@ 2026-10-27 10:33 ` Esben Haabendal
2026-10-27 10:33 ` [PATCH v5 2/4] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Esben Haabendal @ 2026-10-27 10:33 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Guido Günther, Fabio Estevam, Robert Chiras, Sam Ravnborg,
imx
Cc: Esben Haabendal, Frank.Li, dri-devel, linux-kernel, stable
Using the endpoint define values makes it more clear that the argument to
mux_control_try_select() must be valid state integers, and not something
that looks like a boolean.
The endpoint value is kept, as it will be used in a following patch that
changes behavior slightly based on which endpoint is selected.
Cc: stable@vger.kernel.org
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 09992529f3d8..80e26a947ae6 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -110,6 +110,8 @@ struct nwl_dsi {
int error;
struct nwl_dsi_transfer *xfer;
+
+ unsigned int endpoint;
};
static const struct regmap_config nwl_dsi_regmap_config = {
@@ -1088,13 +1090,12 @@ static int nwl_dsi_parse_dt(struct nwl_dsi *dsi)
static int nwl_dsi_select_input(struct nwl_dsi *dsi)
{
struct device_node *remote;
- u32 use_dcss = 1;
int ret;
remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
NWL_DSI_ENDPOINT_LCDIF);
if (remote) {
- use_dcss = 0;
+ dsi->endpoint = NWL_DSI_ENDPOINT_LCDIF;
} else {
remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
NWL_DSI_ENDPOINT_DCSS);
@@ -1103,11 +1104,12 @@ static int nwl_dsi_select_input(struct nwl_dsi *dsi)
"No valid input endpoint found\n");
return -EINVAL;
}
+ dsi->endpoint = NWL_DSI_ENDPOINT_DCSS;
}
DRM_DEV_INFO(dsi->dev, "Using %s as input source\n",
- (use_dcss) ? "DCSS" : "LCDIF");
- ret = mux_control_try_select(dsi->mux, use_dcss);
+ (dsi->endpoint == NWL_DSI_ENDPOINT_DCSS) ? "DCSS" : "LCDIF");
+ ret = mux_control_try_select(dsi->mux, dsi->endpoint);
if (ret < 0)
DRM_DEV_ERROR(dsi->dev, "Failed to select input: %d\n", ret);
--
2.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v5 2/4] drm/bridge: nwl-dsi: Limit LCDIF specific sync override
2026-10-27 10:33 [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
2026-10-27 10:33 ` [PATCH v5 1/4] drm/bridge: nwl-dsi: Cleanup endpoint mux control selection Esben Haabendal
@ 2026-10-27 10:33 ` Esben Haabendal
2026-10-27 10:33 ` [PATCH v5 3/4] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior Esben Haabendal
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Esben Haabendal @ 2026-10-27 10:33 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Guido Günther, Fabio Estevam, Robert Chiras, Sam Ravnborg,
imx
Cc: Esben Haabendal, Frank.Li, dri-devel, linux-kernel, stable
When using DCSS with NWL, overriding the mode flags to enforce active high
sync is preventing the use of active low with downstream bridges, such as
ti-sn65dsi83, which will not see such mode flags set by the panel.
Fixes: 44cfc6233447 ("drm/bridge: Add NWL MIPI DSI host controller support")
Cc: stable@vger.kernel.org
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 80e26a947ae6..1aab46e1a168 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -823,10 +823,13 @@ static int nwl_dsi_bridge_atomic_check(struct drm_bridge *bridge,
struct drm_connector_state *conn_state)
{
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
+ struct nwl_dsi *dsi = bridge_to_dsi(bridge);
/* At least LCDIF + NWL needs active high sync */
- adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
- adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+ if (dsi->endpoint == NWL_DSI_ENDPOINT_LCDIF) {
+ adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
+ adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+ }
/*
* Do a full modeset if crtc_state->active is changed to be true.
--
2.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v5 3/4] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior
2026-10-27 10:33 [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
2026-10-27 10:33 ` [PATCH v5 1/4] drm/bridge: nwl-dsi: Cleanup endpoint mux control selection Esben Haabendal
2026-10-27 10:33 ` [PATCH v5 2/4] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
@ 2026-10-27 10:33 ` Esben Haabendal
2026-10-27 10:33 ` [PATCH v5 4/4] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing Esben Haabendal
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Esben Haabendal @ 2026-10-27 10:33 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Guido Günther, Fabio Estevam, Robert Chiras, Sam Ravnborg,
imx
Cc: Esben Haabendal, Frank.Li, dri-devel, linux-kernel, stable,
Laurentiu Palcu
From: Robert Chiras <robert.chiras@nxp.com>
In order to respect the DSI protocol, make sure that auto-insert EOTP is
enabled according to the NO_EOT_PACKET flag instead of the
CLOCK_NON_CONTINUOUS flag.
Fixes: 44cfc6233447 ("drm/bridge: Add NWL MIPI DSI host controller support")
Cc: stable@vger.kernel.org
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Esben Haabendal <esben@geanix.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 1aab46e1a168..f3f4334136c0 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -222,13 +222,15 @@ static int nwl_dsi_config_host(struct nwl_dsi *dsi)
DRM_DEV_DEBUG_DRIVER(dsi->dev, "DSI Lanes %d\n", dsi->lanes);
nwl_dsi_write(dsi, NWL_DSI_CFG_NUM_LANES, dsi->lanes - 1);
- if (dsi->dsi_mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) {
+ if (dsi->dsi_mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)
nwl_dsi_write(dsi, NWL_DSI_CFG_NONCONTINUOUS_CLK, 0x01);
- nwl_dsi_write(dsi, NWL_DSI_CFG_AUTOINSERT_EOTP, 0x01);
- } else {
+ else
nwl_dsi_write(dsi, NWL_DSI_CFG_NONCONTINUOUS_CLK, 0x00);
+
+ if (dsi->dsi_mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)
nwl_dsi_write(dsi, NWL_DSI_CFG_AUTOINSERT_EOTP, 0x00);
- }
+ else
+ nwl_dsi_write(dsi, NWL_DSI_CFG_AUTOINSERT_EOTP, 0x01);
/* values in byte clock cycles */
cycles = ui2bc(cfg->clk_pre);
--
2.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v5 4/4] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing
2026-10-27 10:33 [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
` (2 preceding siblings ...)
2026-10-27 10:33 ` [PATCH v5 3/4] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior Esben Haabendal
@ 2026-10-27 10:33 ` Esben Haabendal
2026-11-03 11:22 ` (subset) [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Luca Ceresoli
2026-11-03 11:31 ` Luca Ceresoli
5 siblings, 0 replies; 7+ messages in thread
From: Esben Haabendal @ 2026-10-27 10:33 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Guido Günther, Fabio Estevam, Robert Chiras, Sam Ravnborg,
imx
Cc: Esben Haabendal, Frank.Li, dri-devel, linux-kernel,
Oliver F. Brown, Sebastian Krzyszkowiak, Liu Ying
The NWL MIPI Host controller registers specifies the horizontal front
porch, sync pulse, and back porch in DSI packet payload size in bytes (ie.
not in pixel clocks).
The calculation for this is (mostly) described in section 13.6.3.5.1.2 of
the i.MX 8M Dual/8M QuadLite/8M Quad Applications Processors Reference
Manual (rev. 3.1). The formula shown there does not take packet header size
into account though.
The formula implemented here converts the hfp, hsa, and hbp to DSI packet
bytes and then subtracts the number of packet header bytes.
It is worth noting that these values only needs to match approximately,
according to the reference manual.
Based on commit in NXP vendor tree
commit f2a61699749d ("LF-7981-4: drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing")
Fixes: 44cfc6233447 ("drm/bridge: Add NWL MIPI DSI host controller support")
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Oliver F. Brown <oliver.brown@oss.nxp.com>
Tested-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Acked-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 60 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 57 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index f3f4334136c0..870a308589cd 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -13,6 +13,7 @@
#include <linux/math64.h>
#include <linux/mfd/syscon.h>
#include <linux/media-bus-format.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/mux/consumer.h>
#include <linux/of.h>
@@ -264,6 +265,9 @@ static int nwl_dsi_config_dpi(struct nwl_dsi *dsi)
bool burst_mode;
int hfront_porch, hback_porch, vfront_porch, vback_porch;
int hsync_len, vsync_len;
+ int hfp, hbp, hsa;
+ u64 hs_clk_rate, pclk_rate;
+ int h_blank, pkt_hdr_len, pkt_len;
hfront_porch = dsi->mode.hsync_start - dsi->mode.hdisplay;
hsync_len = dsi->mode.hsync_end - dsi->mode.hsync_start;
@@ -317,9 +321,59 @@ static int nwl_dsi_config_dpi(struct nwl_dsi *dsi)
dsi->mode.hdisplay);
}
- nwl_dsi_write(dsi, NWL_DSI_HFP, hfront_porch);
- nwl_dsi_write(dsi, NWL_DSI_HBP, hback_porch);
- nwl_dsi_write(dsi, NWL_DSI_HSA, hsync_len);
+ hs_clk_rate = dsi->phy_cfg.mipi_dphy.hs_clk_rate;
+ pclk_rate = (u64)dsi->mode.clock * 1000;
+ DRM_DEV_DEBUG_DRIVER(dsi->dev, "hs_clk_rate: %llu Hz\n", hs_clk_rate);
+
+ /*
+ * Calculate the bytes needed, according to the RM formula:
+ * Time of DPI event = time to transmit x number of bytes on the DSI interface
+ * dpi_event_size * dpi_pclk_period = dsi_bytes * 8 * hs_bit_period / num_lanes
+ * ===>
+ * dsi_bytes = dpi_event_size * dpi_pclk_period * num_lanes / (8 * hs_bit_period)
+ * ===> (substituting period = 1 / rate)
+ * dsi_bytes = dpi_event_size * num_lanes * hs_clk_rate / (8 * dpi_pclk_rate)
+ */
+ hfp = DIV64_U64_ROUND_UP((u64)hfront_porch * dsi->lanes * hs_clk_rate, 8 * pclk_rate);
+ hbp = DIV64_U64_ROUND_UP((u64)hback_porch * dsi->lanes * hs_clk_rate, 8 * pclk_rate);
+ hsa = DIV64_U64_ROUND_UP((u64)hsync_len * dsi->lanes * hs_clk_rate, 8 * pclk_rate);
+
+ /* Make sure horizontal blanking values are even numbers */
+ hfp = roundup(hfp, 2);
+ hbp = roundup(hbp, 2);
+ hsa = roundup(hsa, 2);
+
+ /*
+ * We need to subtract the packet header length: 32
+ * In order to make sure we don't get negative values,
+ * subtract a proportional value to the total length of the
+ * horizontal blanking duration.
+ */
+ h_blank = hfp + hbp + hsa;
+
+ if (h_blank) {
+ pkt_len = min(hfp, roundup(((hfp * 100 / h_blank) * 32) / 100, 2));
+ pkt_hdr_len = pkt_len;
+ hfp -= pkt_len;
+
+ pkt_len = min(hbp, roundup(((hbp * 100 / h_blank) * 32) / 100, 2));
+ pkt_hdr_len += pkt_len;
+ hbp -= pkt_len;
+
+ pkt_len = min(hsa, 32 - pkt_hdr_len);
+ pkt_hdr_len += pkt_len;
+ hsa -= pkt_len;
+ if (pkt_hdr_len != 32)
+ dev_warn(dsi->dev,
+ "Unable to subtract packet header length fully: %d left\n",
+ 32 - pkt_hdr_len);
+ }
+
+ DRM_DEV_DEBUG_DRIVER(dsi->dev, "Register values: hfp=%d hbp=%d hsa=%d\n", hfp, hbp, hsa);
+
+ nwl_dsi_write(dsi, NWL_DSI_HFP, hfp);
+ nwl_dsi_write(dsi, NWL_DSI_HBP, hbp);
+ nwl_dsi_write(dsi, NWL_DSI_HSA, hsa);
nwl_dsi_write(dsi, NWL_DSI_ENABLE_MULT_PKTS, 0x0);
nwl_dsi_write(dsi, NWL_DSI_BLLP_MODE, 0x1);
--
2.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: (subset) [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes
2026-10-27 10:33 [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
` (3 preceding siblings ...)
2026-10-27 10:33 ` [PATCH v5 4/4] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing Esben Haabendal
@ 2026-11-03 11:22 ` Luca Ceresoli
2026-11-03 11:31 ` Luca Ceresoli
5 siblings, 0 replies; 7+ messages in thread
From: Luca Ceresoli @ 2026-11-03 11:22 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,
Guido Günther, Fabio Estevam, Robert Chiras, Sam Ravnborg,
imx, Esben Haabendal
Cc: Frank.Li, dri-devel, linux-kernel, stable, Laurentiu Palcu,
Oliver F. Brown, Sebastian Krzyszkowiak, Liu Ying
On Tue, 27 Oct 2026 11:33:48 +0100, Esben Haabendal wrote:
> This series brings a few patches fixing horizontal sync timing, EOTP packet
> behavior and hsync/vsync polarity selection when using DCSS endpoint, as
> well as a small fix to properly handle if/when nwl_dsi_mode_set() fails.
>
> The 3rd commit ("Correct auto-insert EOTP behavior") is taken directly from
> NXP vendor tree, so I have kept Author unchanged, although I have modified
> the commit message. Let me know if I should change Author for that.
>
> [...]
Applied, thanks!
[1/4] drm/bridge: nwl-dsi: Cleanup endpoint mux control selection
commit: 8dad0ebd822f54102aadc6ca4f0f8777112d175d
[2/4] drm/bridge: nwl-dsi: Limit LCDIF specific sync override
commit: 54a88d9afcca66221d14f438d0960472984968ec
Best regards,
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes
2026-10-27 10:33 [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
` (4 preceding siblings ...)
2026-11-03 11:22 ` (subset) [PATCH v5 0/4] drm/bridge: nwl-dsi: Various fixes Luca Ceresoli
@ 2026-11-03 11:31 ` Luca Ceresoli
5 siblings, 0 replies; 7+ messages in thread
From: Luca Ceresoli @ 2026-11-03 11:31 UTC (permalink / raw)
To: Esben Haabendal, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Guido Günther, Fabio Estevam,
Robert Chiras, Sam Ravnborg, imx
Cc: Frank.Li, dri-devel, linux-kernel, stable, Laurentiu Palcu,
Oliver F. Brown, Sebastian Krzyszkowiak, Liu Ying
Hello Esben, Robert,
On Tue Oct 27, 2026 at 11:33 AM CET, Esben Haabendal wrote:
> This series brings a few patches fixing horizontal sync timing, EOTP packet
> behavior and hsync/vsync polarity selection when using DCSS endpoint, as
> well as a small fix to properly handle if/when nwl_dsi_mode_set() fails.
>
> The 3rd commit ("Correct auto-insert EOTP behavior") is taken directly from
> NXP vendor tree, so I have kept Author unchanged, although I have modified
> the commit message. Let me know if I should change Author for that.
I applied patches 1 and 2, but dim [0] reports a fatal error about patch 3:
dim: 72e5001e5c2b ("drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior"): author Signed-off-by missing.
[0] https://gitlab.freedesktop.org/drm/maintainer-tools/-/blob/master/dim?ref_type=heads#L1071-1075
@Robert, I think it's up to you to agree on having a SoB line in this
patch.
@Esben, can you help sorting this out? Also can you provide an URL of the
original patch 3 in the vendor tree?
Luca
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
> Changes in v5:
> - Add fixes tag.
> - Sort header files alphabetically.
> - Fixed speling mistake.
Funny typo here :-)
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 7+ messages in thread