* [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1
@ 2026-12-01 10:39 Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Qianhui Xu @ 2026-12-01 10:39 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel
The CSOT PP8807HB1-1 panel on the Lenovo Legion Y700 Gen4 (SM8750P) is
already supported upstream, but the driver only exposes the 120/60/30Hz
modes and its prepare/enable lifecycle loses state on failure. This
series adds the 40Hz and 24Hz modes and fixes three lifecycle bugs.
Patch 1 adds the two refresh rates. Patch 2 resolves the backlight and
configures every DSI device before the bridges are attached, because
attach can prepare the panel immediately. Patch 3 undoes the power-up on
every prepare() failure path instead of only the initialisation-sequence
one. Patch 4 stops the enable chain from marking a panel enabled after a
failed prepare.
Changes in v2:
- patches 2-4: add Fixes: and Cc: stable, the ordering and error
handling bugs are in the driver since it was merged in v7.3
- patch 4: explain in the commit message why the guard is not moved
into drm_panel_enable(); that function is void, and "prepare never
called" is indistinguishable from "prepare failed" there, so
panels whose bridge ops do not call drm_panel_prepare() would be
skipped as well
- no code changes since v1; the patches are identical apart from the
commit messages
The 40Hz and 24Hz modes were measured on the panel. The lifecycle fixes
are build-tested and boot-tested on the Lenovo Y700 Gen4 only, not on
other boards using this panel.
*** AI-assistance disclosure ***
This series was prepared with the help of an LLM coding assistant. The
author reviewed every line, checked each claim against the source tree,
and ran the gates quoted above; the design decisions and any errors are
the author's.
Qianhui Xu (4):
drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT
PP8807HB1-1
drm/panel: novatek-nt36536: finish setup before attaching DSI devices
drm/panel: novatek-nt36536: power off on any prepare failure
drm/panel: novatek-nt36536: reject enable when prepare failed
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 74 +++++++++++++++----
1 file changed, 58 insertions(+), 16 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT PP8807HB1-1
2026-12-01 10:39 [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
@ 2026-12-01 10:39 ` Qianhui Xu
2026-12-01 10:46 ` sashiko-bot
2026-12-01 10:39 ` [PATCH v2 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Qianhui Xu @ 2026-12-01 10:39 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel
The panel supports 40Hz and 24Hz refresh rates in addition to the modes
the driver currently exposes. Add both, keeping the mode ordering from
highest to lowest refresh rate.
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
index 8bd1256501680..4d661033791b7 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
@@ -320,6 +320,28 @@ static const struct drm_display_mode csot_pp8807hb1_1_modes[] = {
.vsync_end = 3040 + 10226 + 4,
.vtotal = 3040 + 10226 + 4 + 330,
},
+ {
+ .clock = (952 + 138 + 16 + 16) * 2 * (3040 + 6826 + 4 + 330) * 40 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 138) * 2,
+ .hsync_end = (952 + 138 + 16) * 2,
+ .htotal = (952 + 138 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 6826,
+ .vsync_end = 3040 + 6826 + 4,
+ .vtotal = 3040 + 6826 + 4 + 330,
+ },
+ {
+ .clock = (952 + 138 + 16 + 16) * 2 * (3040 + 13626 + 4 + 330) * 24 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 138) * 2,
+ .hsync_end = (952 + 138 + 16) * 2,
+ .htotal = (952 + 138 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 13626,
+ .vsync_end = 3040 + 13626 + 4,
+ .vtotal = 3040 + 13626 + 4 + 330,
+ },
/* 1064606.4 KHz */
{
.clock = (952 + 50 + 16 + 16) * 2 * (3040 + 26 + 4 + 50) * 165 / 1000,
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices
2026-12-01 10:39 [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
@ 2026-12-01 10:39 ` Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
3 siblings, 0 replies; 7+ messages in thread
From: Qianhui Xu @ 2026-12-01 10:39 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel, stable
Attaching a DSI device can bind the DRM bridge and immediately prepare
the panel. Two things must be ready by then: the backlight device, which
prepare() enables, and the MIPI DSI format/mode flags of every DSI
device of a dual-DSI panel. Resolve the backlight before
drm_panel_add()/attach, and configure all DSI devices in a separate loop
before attaching any of them.
Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 26 +++++++++++--------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
index 4d661033791b7..fb77ae437bbc8 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
@@ -439,6 +439,18 @@ static int novatek_probe(struct mipi_dsi_device *dsi)
ctx->dsi[0] = dsi;
mipi_dsi_set_drvdata(dsi, ctx);
+ /* Resolve suppliers before attachment can bind DRM and prepare the panel. */
+ if (desc->has_dcs_backlight) {
+ ctx->backlight = novatek_create_backlight(ctx);
+ if (IS_ERR(ctx->backlight))
+ return dev_err_probe(dev, PTR_ERR(ctx->backlight),
+ "Failed to create backlight\n");
+ } else {
+ ret = drm_panel_of_backlight(&ctx->panel);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get backlight\n");
+ }
+
ctx->panel.prepare_prev_first = true;
ret = devm_drm_panel_add(dev, &ctx->panel);
@@ -450,23 +462,15 @@ static int novatek_probe(struct mipi_dsi_device *dsi)
ctx->dsi[i]->format = desc->format;
ctx->dsi[i]->mode_flags = desc->mode_flags;
ctx->dsi[i]->dsc = &ctx->dsc;
+ }
+
+ for (i = 0; i < num_dsi; i++) {
ret = devm_mipi_dsi_attach(dev, ctx->dsi[i]);
if (ret < 0)
return dev_err_probe(dev, ret,
"Failed to attach to DSI host\n");
}
- if (desc->has_dcs_backlight) {
- ctx->backlight = novatek_create_backlight(ctx);
- if (IS_ERR(ctx->backlight))
- return dev_err_probe(dev, PTR_ERR(ctx->backlight),
- "Failed to create backlight\n");
- } else {
- ret = drm_panel_of_backlight(&ctx->panel);
- if (ret)
- return dev_err_probe(dev, ret, "Failed to get backlight\n");
- }
-
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] drm/panel: novatek-nt36536: power off on any prepare failure
2026-12-01 10:39 [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
@ 2026-12-01 10:39 ` Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
3 siblings, 0 replies; 7+ messages in thread
From: Qianhui Xu @ 2026-12-01 10:39 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel, stable
prepare() only undid the power-up when the initialisation sequence
failed. Failures of the picture parameter set, the compression mode
commands or the backlight enable were ignored, leaving the panel powered
with a wrong state and -- for the backlight -- with the error swallowed.
Use a single power_off label for all error paths and also check
dsi_ctx.accum_err after the batched MIPI writes, as those helpers only
record their error there.
Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
index fb77ae437bbc8..88a003f5a9441 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
@@ -100,18 +100,27 @@ static int novatek_prepare(struct drm_panel *panel)
ret = ctx->desc->init_sequence(&dsi_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(novatek_supplies),
- ctx->supplies);
- return ret;
+ goto power_off;
}
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 = dsi_ctx.accum_err;
+ if (ret)
+ goto power_off;
+
+ ret = backlight_enable(ctx->backlight);
+ if (ret)
+ goto power_off;
+
+ return 0;
- return backlight_enable(ctx->backlight);
+power_off:
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ regulator_bulk_disable(ARRAY_SIZE(novatek_supplies), ctx->supplies);
+ return ret;
}
static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
2026-12-01 10:39 [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
` (2 preceding siblings ...)
2026-12-01 10:39 ` [PATCH v2 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
@ 2026-12-01 10:39 ` Qianhui Xu
2026-12-01 10:47 ` sashiko-bot
3 siblings, 1 reply; 7+ messages in thread
From: Qianhui Xu @ 2026-12-01 10:39 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel, stable
drm_panel_prepare() cannot report a failure to its caller, so the enable
part of the bridge chain still runs with panel->prepared unset. Provide
an enable() callback that returns -EIO in that case, so the panel is not
marked as enabled and the backlight stays off.
Checking this in drm_panel_enable() instead was considered: the state
lives in the core, but drm_panel_enable() is void and there is no way to
tell "prepare was never called" from "prepare failed". Panels that never
implement prepare(), or whose bridge ops skip drm_panel_prepare(), would
then be skipped as well, so the guard stays local to the driver that can
actually fail.
Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
index 88a003f5a9441..698e7b85a8a76 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
@@ -123,6 +123,12 @@ static int novatek_prepare(struct drm_panel *panel)
return ret;
}
+static int novatek_enable(struct drm_panel *panel)
+{
+ /* The bridge enable chain can continue after a failed prepare callback. */
+ return panel->prepared ? 0 : -EIO;
+}
+
static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
{
mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
@@ -186,6 +192,7 @@ static int novatek_get_modes(struct drm_panel *panel,
static const struct drm_panel_funcs novatek_panel_funcs = {
.prepare = novatek_prepare,
+ .enable = novatek_enable,
.unprepare = novatek_unprepare,
.get_modes = novatek_get_modes,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT PP8807HB1-1
2026-12-01 10:39 ` [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
@ 2026-12-01 10:46 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-01 10:46 UTC (permalink / raw)
To: Qianhui Xu, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/panel: novatek-nt36536: 40Hz mode placed after 30Hz mode
--
commit 3c3c5affa5a859a396b05da412292d3534ba8e97
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT PP8807HB1-1
This commit adds 40Hz and 24Hz display mode timings to
csot_pp8807hb1_1_modes[] for the CSOT PP8807HB1-1 panel.
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> index 8bd1256501680..4d661033791b7 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> @@ -320,6 +320,28 @@ static const struct drm_display_mode csot_pp8807hb1_1_modes[] = {
> .vsync_end = 3040 + 10226 + 4,
> .vtotal = 3040 + 10226 + 4 + 330,
> },
> + {
> + .clock = (952 + 138 + 16 + 16) * 2 * (3040 + 6826 + 4 + 330) * 40 / 1000,
> + .hdisplay = 952 * 2,
> + .hsync_start = (952 + 138) * 2,
> + .hsync_end = (952 + 138 + 16) * 2,
> + .htotal = (952 + 138 + 16 + 16) * 2,
> + .vdisplay = 3040,
> + .vsync_start = 3040 + 6826,
> + .vsync_end = 3040 + 6826 + 4,
> + .vtotal = 3040 + 6826 + 4 + 330,
> + },
[Severity: Low]
Should this 40Hz mode entry be placed before the preceding 30Hz mode entry
(with vertical front porch 10226)? Inserting it here orders the 915552 KHz
modes as 120Hz, 60Hz, 30Hz, 40Hz, 24Hz rather than from highest to lowest
refresh rate as described in the commit message.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201103915.3503057-1-xiaqinghuan@mail.ustc.edu.cn?part=1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
2026-12-01 10:39 ` [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
@ 2026-12-01 10:47 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-01 10:47 UTC (permalink / raw)
To: Qianhui Xu, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/panel: novatek_enable() reaches into drm_panel core
panel->prepared state
--
commit a50376adf296c5b8a35b17ec581a70a2368b7e12
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
drm/panel: novatek-nt36536: reject enable when prepare failed
This commit adds a novatek_enable() callback that checks panel->prepared and
returns -EIO so the panel is not marked enabled when novatek_prepare() fails.
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> index 88a003f5a9441..698e7b85a8a76 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> @@ -123,6 +123,12 @@ static int novatek_prepare(struct drm_panel *panel)
> return ret;
> }
>
> +static int novatek_enable(struct drm_panel *panel)
> +{
> + /* The bridge enable chain can continue after a failed prepare callback. */
> + return panel->prepared ? 0 : -EIO;
> +}
> +
> static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
> {
> mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
> @@ -186,6 +192,7 @@ static int novatek_get_modes(struct drm_panel *panel,
>
> static const struct drm_panel_funcs novatek_panel_funcs = {
> .prepare = novatek_prepare,
> + .enable = novatek_enable,
> .unprepare = novatek_unprepare,
> .get_modes = novatek_get_modes,
> };
[Severity: Low]
Should this panel->prepared check live in drm_panel_enable() instead of
adding a dummy novatek_enable() callback that reaches into core drm_panel
state?
Commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in
drm_panel") moved panel->prepared and panel->enabled tracking into
drivers/gpu/drm/drm_panel.c so individual panel drivers would not inspect
those fields directly. Also, the commit message states that checking
panel->prepared in drm_panel_enable() would skip panels that never implement
prepare(), but drm_panel_prepare() sets panel->prepared = true even when
panel->funcs->prepare is NULL:
drivers/gpu/drm/drm_panel.c:drm_panel_prepare() {
...
if (panel->funcs && panel->funcs->prepare) {
ret = panel->funcs->prepare(panel);
if (ret < 0)
goto exit;
}
panel->prepared = true;
...
}
Handling !panel->prepared in drm_panel_enable() would avoid driver-specific
workarounds and keep behavior consistent across all panel drivers.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201103915.3503057-1-xiaqinghuan@mail.ustc.edu.cn?part=4
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-01 10:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 10:39 [PATCH v2 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
2026-12-01 10:46 ` sashiko-bot
2026-12-01 10:39 ` [PATCH v2 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
2026-12-01 10:39 ` [PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
2026-12-01 10:47 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox