* [PATCH 0/3] drm/bridge: nwl-dsi: Various fixes
@ 2026-07-10 13:53 Esben Haabendal
2026-07-10 13:53 ` [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-07-10 13:53 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
Cc: dri-devel, linux-kernel, Esben Haabendal, Robert Chiras,
Laurentiu Palcu, Oliver F. Brown
This series brings a few patches fixing horizontal sync timing, EOTP packet
behavior and hsync/vsync polarity selection when using DCSS endpoint.
The 2nd 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.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
Esben Haabendal (2):
drm/bridge: nwl-dsi: Limit LCDIF specific sync override
drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing
Robert Chiras (1):
drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior
drivers/gpu/drm/bridge/nwl-dsi.c | 83 +++++++++++++++++++++++++++++++++-------
1 file changed, 70 insertions(+), 13 deletions(-)
---
base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
change-id: 20260710-nwl-dsi-fixes-c148b0adb685
Best regards,
--
Esben Haabendal <esben@geanix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override
2026-07-10 13:53 [PATCH 0/3] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
@ 2026-07-10 13:53 ` Esben Haabendal
2026-07-10 14:09 ` sashiko-bot
2026-07-10 13:53 ` [PATCH 2/3] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior Esben Haabendal
2026-07-10 13:53 ` [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing Esben Haabendal
2 siblings, 1 reply; 6+ messages in thread
From: Esben Haabendal @ 2026-07-10 13:53 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
Cc: dri-devel, linux-kernel, Esben Haabendal
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.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 3c9ae93c4f67..915e1bdc73c8 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 = {
@@ -821,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.
@@ -1088,13 +1093,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 +1107,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 == NWL_DSI_ENDPOINT_DCSS);
if (ret < 0)
DRM_DEV_ERROR(dsi->dev, "Failed to select input: %d\n", ret);
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior
2026-07-10 13:53 [PATCH 0/3] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
2026-07-10 13:53 ` [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
@ 2026-07-10 13:53 ` Esben Haabendal
2026-07-10 13:53 ` [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing Esben Haabendal
2 siblings, 0 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-07-10 13:53 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
Cc: dri-devel, linux-kernel, Esben Haabendal, Robert Chiras,
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.
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 915e1bdc73c8..c9af6a3d47e1 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.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing
2026-07-10 13:53 [PATCH 0/3] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
2026-07-10 13:53 ` [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
2026-07-10 13:53 ` [PATCH 2/3] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior Esben Haabendal
@ 2026-07-10 13:53 ` Esben Haabendal
2026-07-10 14:27 ` sashiko-bot
2 siblings, 1 reply; 6+ messages in thread
From: Esben Haabendal @ 2026-07-10 13:53 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
Cc: dri-devel, linux-kernel, Esben Haabendal, Robert Chiras,
Oliver F. Brown
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")
Signed-off-by: Esben Haabendal <esben@geanix.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Oliver F. Brown <oliver.brown@oss.nxp.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 56 +++++++++++++++++++++++++++++++++++++---
1 file changed, 53 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index c9af6a3d47e1..ed61580a3545 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -22,6 +22,7 @@
#include <linux/reset.h>
#include <linux/sys_soc.h>
#include <linux/time64.h>
+#include <linux/math64.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_bridge.h>
@@ -264,6 +265,10 @@ 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;
+ unsigned long long pclk_period;
+ unsigned long long hs_period;
+ 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 +322,54 @@ 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);
+ pclk_period = DIV_ROUND_UP_ULL(PSEC_PER_SEC, dsi->mode.clock * 1000);
+ DRM_DEV_DEBUG_DRIVER(dsi->dev, "pclk_period: %llu\n", pclk_period);
+
+ hs_period = DIV_ROUND_UP_ULL(PSEC_PER_SEC, dsi->phy_cfg.mipi_dphy.hs_clk_rate);
+ DRM_DEV_DEBUG_DRIVER(dsi->dev, "hs_period: %llu\n", hs_period);
+
+ /*
+ * 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)
+ */
+ hfp = hfront_porch * pclk_period * dsi->lanes / (8 * hs_period);
+ hbp = hback_porch * pclk_period * dsi->lanes / (8 * hs_period);
+ hsa = hsync_len * pclk_period * dsi->lanes / (8 * hs_period);
+
+ /* Make sure horizontal blankins 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;
+
+ pkt_len = roundup(((hfp * 100 / h_blank) * 32) / 100, 2);
+ pkt_hdr_len = pkt_len;
+ hfp -= pkt_len;
+
+ pkt_len = roundup(((hbp * 100 / h_blank) * 32) / 100, 2);
+ pkt_hdr_len += pkt_len;
+ hbp -= pkt_len;
+
+ hsa -= (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.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override
2026-07-10 13:53 ` [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
@ 2026-07-10 14:09 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-10 14:09 UTC (permalink / raw)
To: Esben Haabendal; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Dangling pointer `dsi->xfer` leads to stack Use-After-Free if a timeout or clock error occurs during transfer.
--
--- Patch [1]: [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override ---
commit 36a9bfa60fd8b6568d59af4e95e04fc059970758
Author: Esben Haabendal <esben@geanix.com>
drm/bridge: nwl-dsi: Limit LCDIF specific sync override
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.
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 3c9ae93c4f671..915e1bdc73c80 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;
[Severity: High]
This is a pre-existing issue, but could this pointer lead to a stack
use-after-free if a timeout or clock error occurs during a transfer?
In nwl_dsi_host_transfer(), dsi->xfer is assigned the address of a local stack
variable:
struct nwl_dsi_transfer xfer;
...
dsi->xfer = &xfer;
If clk_prepare_enable(dsi->rx_esc_clk) fails, or if the DSI transfer times out
(wait_for_completion_timeout() returns 0), the function returns without
clearing dsi->xfer.
If a delayed or spurious hardware interrupt later triggers
nwl_dsi_irq_handler(), it will call nwl_dsi_finish_transmission() which
dereferences the dangling dsi->xfer pointer:
xfer->status = xfer->tx_len;
complete(&xfer->completed);
Because xfer was originally on the stack of the returned function, could this
overwrite arbitrary stack memory of whatever thread happens to be running at
the time of the interrupt?
> +
> + unsigned int endpoint;
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-nwl-dsi-fixes-v1-0-927d918a86ad@geanix.com?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing
2026-07-10 13:53 ` [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing Esben Haabendal
@ 2026-07-10 14:27 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-10 14:27 UTC (permalink / raw)
To: Esben Haabendal; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] Division by zero kernel panic if a display mode has zero horizontal blanking.
- [High] Integer underflow leading to hardware register corruption when horizontal blanking is too small.
- [Low] Build failure on 32-bit architectures due to 64-bit division.
--
--- Patch [3]: [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing ---
commit eb9d34f1c88e6933d5822b8331847848414cfe4d
Author: Esben Haabendal <esben@geanix.com>
drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing
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 formula implemented here converts the hfp, hsa, and hbp to DSI packet
bytes and then subtracts the number of packet header bytes.
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index c9af6a3d47e1d..ed61580a35457 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -317,9 +322,54 @@ 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);
> + pclk_period = DIV_ROUND_UP_ULL(PSEC_PER_SEC, dsi->mode.clock * 1000);
> + DRM_DEV_DEBUG_DRIVER(dsi->dev, "pclk_period: %llu\n", pclk_period);
> +
> + hs_period = DIV_ROUND_UP_ULL(PSEC_PER_SEC, dsi->phy_cfg.mipi_dphy.hs_clk_rate);
> + DRM_DEV_DEBUG_DRIVER(dsi->dev, "hs_period: %llu\n", hs_period);
> +
> + /*
> + * 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)
> + */
> + hfp = hfront_porch * pclk_period * dsi->lanes / (8 * hs_period);
> + hbp = hback_porch * pclk_period * dsi->lanes / (8 * hs_period);
> + hsa = hsync_len * pclk_period * dsi->lanes / (8 * hs_period);
[Severity: Low]
Will this cause a build failure on 32-bit architectures?
The variables pclk_period and hs_period are 64-bit unsigned integers
(unsigned long long), and using the native division operator here instead of
kernel macros like div64_u64() can result in an undefined reference to
'__udivdi3' when compiling on 32-bit systems.
> +
> + /* Make sure horizontal blankins 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;
> +
> + pkt_len = roundup(((hfp * 100 / h_blank) * 32) / 100, 2);
[Severity: Critical]
Could h_blank be zero here?
If userspace configures a display mode where hdisplay == hsync_start ==
hsync_end == htotal (meaning zero horizontal blanking), the porches and
sync length will be zero. This makes hfp, hbp, and hsa zero, causing h_blank
to evaluate to 0.
Since the mode parameters are not restricted from being zero during validation,
could a custom mode submitted via DRM atomic commits trigger a division by
zero kernel panic here?
> + pkt_hdr_len = pkt_len;
> + hfp -= pkt_len;
> +
> + pkt_len = roundup(((hbp * 100 / h_blank) * 32) / 100, 2);
> + pkt_hdr_len += pkt_len;
> + hbp -= pkt_len;
> +
> + hsa -= (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);
[Severity: High]
Can these subtractions cause integer underflow if the horizontal blanking is
too small?
If userspace configures a mode with a valid but very small horizontal blanking
(where the calculated h_blank is less than the equivalent of 32 bytes),
subtracting up to 32 bytes proportionally could cause hfp, hbp, or hsa to
underflow and become negative.
Would those underflowed negative values then be implicitly cast to large u32
integers when written directly to the DSI hardware registers here?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-nwl-dsi-fixes-v1-0-927d918a86ad@geanix.com?part=3
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-10 14:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 13:53 [PATCH 0/3] drm/bridge: nwl-dsi: Various fixes Esben Haabendal
2026-07-10 13:53 ` [PATCH 1/3] drm/bridge: nwl-dsi: Limit LCDIF specific sync override Esben Haabendal
2026-07-10 14:09 ` sashiko-bot
2026-07-10 13:53 ` [PATCH 2/3] drm/bridge: nwl-dsi: Correct auto-insert EOTP behavior Esben Haabendal
2026-07-10 13:53 ` [PATCH 3/3] drm/bridge: nwl-dsi: Correct MIPI DSI horizontal sync timing Esben Haabendal
2026-07-10 14:27 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox