* [PATCH v2 1/3] drm/panel: novatek-nt37705: Fix prepare error cleanup
2026-12-06 5:23 [PATCH v2 0/3] drm/panel: Convert nt37705 and rm69220 prepare() to _multi() Hsieh Hung-En
@ 2026-12-06 5:23 ` Hsieh Hung-En
2026-12-06 5:23 ` [PATCH v2 2/3] drm/panel: novatek-nt37705: Use mipi_dsi_*_multi() in prepare() Hsieh Hung-En
2026-12-06 5:23 ` [PATCH v2 3/3] drm/panel: raydium-rm69220: " Hsieh Hung-En
2 siblings, 0 replies; 4+ messages in thread
From: Hsieh Hung-En @ 2026-12-06 5:23 UTC (permalink / raw)
To: neil.armstrong, jesszhan0024, dianders, akoskovich, luca.weiss
Cc: dmitry.baryshkov, maarten.lankhorst, mripard, tzimmermann,
airlied, simona, dri-devel, linux-kernel, Hsieh Hung-En, Sashiko
If mipi_dsi_picture_parameter_set() or mipi_dsi_compression_mode() fails
in nt37705_prepare(), the error is returned directly without asserting
reset_gpio or disabling the regulators. Because drm_panel_prepare() does
not mark the panel as prepared on failure, nt37705_unprepare() will not
be called, leaving reset deasserted and leaking the enable count on all
three supplies (vddio, dvdd, vci) so they can no longer be powered off.
Route all failure paths after nt37705_reset() through a shared error
cleanup path that asserts reset_gpio and disables the supplies.
Fixes: 9ffe0df0262b ("drm/panel: Add driver for Novatek NT37705 panel")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/sashiko-outbox-165407@kernel.org
Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
---
drivers/gpu/drm/panel/panel-novatek-nt37705.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37705.c b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
index 342e58591bab..a37bbd569ee5 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt37705.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
@@ -209,9 +209,7 @@ static int nt37705_prepare(struct drm_panel *panel)
ret = nt37705_on(ctx);
if (ret < 0) {
dev_err(dev, "Failed to initialize panel: %d\n", ret);
- gpiod_set_value_cansleep(ctx->reset_gpio, 1);
- regulator_bulk_disable(ARRAY_SIZE(nt37705_supplies), ctx->supplies);
- return ret;
+ goto err;
}
drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
@@ -219,18 +217,23 @@ static int nt37705_prepare(struct drm_panel *panel)
ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
if (ret < 0) {
dev_err(panel->dev, "failed to transmit PPS: %d\n", ret);
- return ret;
+ goto err;
}
ret = mipi_dsi_compression_mode(ctx->dsi, true);
if (ret < 0) {
dev_err(dev, "failed to enable compression mode: %d\n", ret);
- return ret;
+ goto err;
}
msleep(28); /* TODO: Is this panel-dependent? */
return 0;
+
+err:
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ regulator_bulk_disable(ARRAY_SIZE(nt37705_supplies), ctx->supplies);
+ return ret;
}
static int nt37705_unprepare(struct drm_panel *panel)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 2/3] drm/panel: novatek-nt37705: Use mipi_dsi_*_multi() in prepare()
2026-12-06 5:23 [PATCH v2 0/3] drm/panel: Convert nt37705 and rm69220 prepare() to _multi() Hsieh Hung-En
2026-12-06 5:23 ` [PATCH v2 1/3] drm/panel: novatek-nt37705: Fix prepare error cleanup Hsieh Hung-En
@ 2026-12-06 5:23 ` Hsieh Hung-En
2026-12-06 5:23 ` [PATCH v2 3/3] drm/panel: raydium-rm69220: " Hsieh Hung-En
2 siblings, 0 replies; 4+ messages in thread
From: Hsieh Hung-En @ 2026-12-06 5:23 UTC (permalink / raw)
To: neil.armstrong, jesszhan0024, dianders, akoskovich, luca.weiss
Cc: dmitry.baryshkov, maarten.lankhorst, mripard, tzimmermann,
airlied, simona, dri-devel, linux-kernel, Hsieh Hung-En
Replace the deprecated mipi_dsi_picture_parameter_set() call in
nt37705_prepare() with mipi_dsi_picture_parameter_set_multi(), as
suggested in Documentation/gpu/todo.rst. Also convert the subsequent
mipi_dsi_compression_mode() and msleep(28) calls to
mipi_dsi_compression_mode_multi() and mipi_dsi_msleep() so the whole
DSC setup sequence shares one mipi_dsi_multi_context and a single
error check.
The _multi() helpers log transfer errors automatically, removing the
need for the manual dev_err() calls. As before, the 28ms delay is
skipped on failure. The command sequence and error cleanup path are
unchanged.
Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
---
drivers/gpu/drm/panel/panel-novatek-nt37705.c | 21 +++++++------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37705.c b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
index a37bbd569ee5..bff1955581d9 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt37705.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
@@ -194,6 +194,7 @@ static int nt37705_off(struct nt37705_panel *ctx)
static int nt37705_prepare(struct drm_panel *panel)
{
struct nt37705_panel *ctx = to_nt37705_panel(panel);
+ struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
struct device *dev = &ctx->dsi->dev;
struct drm_dsc_picture_parameter_set pps;
int ret;
@@ -213,22 +214,14 @@ static int nt37705_prepare(struct drm_panel *panel)
}
drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
+ mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
+ mipi_dsi_compression_mode_multi(&dsi_ctx, true);
+ mipi_dsi_msleep(&dsi_ctx, 28); /* TODO: Is this panel-dependent? */
- ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
- if (ret < 0) {
- dev_err(panel->dev, "failed to transmit PPS: %d\n", ret);
- goto err;
- }
-
- ret = mipi_dsi_compression_mode(ctx->dsi, true);
- if (ret < 0) {
- dev_err(dev, "failed to enable compression mode: %d\n", ret);
- goto err;
- }
+ if (!dsi_ctx.accum_err)
+ return 0;
- msleep(28); /* TODO: Is this panel-dependent? */
-
- return 0;
+ ret = dsi_ctx.accum_err;
err:
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 3/3] drm/panel: raydium-rm69220: Use mipi_dsi_*_multi() in prepare()
2026-12-06 5:23 [PATCH v2 0/3] drm/panel: Convert nt37705 and rm69220 prepare() to _multi() Hsieh Hung-En
2026-12-06 5:23 ` [PATCH v2 1/3] drm/panel: novatek-nt37705: Fix prepare error cleanup Hsieh Hung-En
2026-12-06 5:23 ` [PATCH v2 2/3] drm/panel: novatek-nt37705: Use mipi_dsi_*_multi() in prepare() Hsieh Hung-En
@ 2026-12-06 5:23 ` Hsieh Hung-En
2 siblings, 0 replies; 4+ messages in thread
From: Hsieh Hung-En @ 2026-12-06 5:23 UTC (permalink / raw)
To: neil.armstrong, jesszhan0024, dianders, akoskovich, luca.weiss
Cc: dmitry.baryshkov, maarten.lankhorst, mripard, tzimmermann,
airlied, simona, dri-devel, linux-kernel, Hsieh Hung-En
Replace the deprecated mipi_dsi_picture_parameter_set() call in
raydium_rm69220_prepare() with mipi_dsi_picture_parameter_set_multi(),
as suggested in Documentation/gpu/todo.rst. Also convert the subsequent
mipi_dsi_compression_mode() and msleep(28) calls to
mipi_dsi_compression_mode_multi() and mipi_dsi_msleep() so the whole
DSC setup sequence shares one mipi_dsi_multi_context and a single
error check.
The _multi() helpers log transfer errors automatically, removing the
need for the manual dev_err() calls. As before, the 28ms delay is
skipped on failure. The command sequence and error cleanup path are
unchanged.
Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
---
drivers/gpu/drm/panel/panel-raydium-rm69220.c | 21 +++++++------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm69220.c b/drivers/gpu/drm/panel/panel-raydium-rm69220.c
index 3030f8b89760..9ea621d6fb92 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm69220.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm69220.c
@@ -218,6 +218,7 @@ static int raydium_rm69220_off(struct raydium_rm69220 *ctx)
static int raydium_rm69220_prepare(struct drm_panel *panel)
{
struct raydium_rm69220 *ctx = to_raydium_rm69220(panel);
+ struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
struct device *dev = &ctx->dsi->dev;
struct drm_dsc_picture_parameter_set pps;
int ret;
@@ -237,22 +238,14 @@ static int raydium_rm69220_prepare(struct drm_panel *panel)
}
drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
+ mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
+ mipi_dsi_compression_mode_multi(&dsi_ctx, true);
+ mipi_dsi_msleep(&dsi_ctx, 28);
- ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps);
- if (ret < 0) {
- dev_err(dev, "failed to transmit PPS: %d\n", ret);
- goto err;
- }
-
- ret = mipi_dsi_compression_mode(ctx->dsi, true);
- if (ret < 0) {
- dev_err(dev, "failed to enable compression mode: %d\n", ret);
- goto err;
- }
+ if (!dsi_ctx.accum_err)
+ return 0;
- msleep(28);
-
- return 0;
+ ret = dsi_ctx.accum_err;
err:
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread