* [PATCH 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT PP8807HB1-1
2026-12-01 9:14 [PATCH 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
@ 2026-12-01 9:14 ` Qianhui Xu
2026-12-01 9:14 ` [PATCH 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Qianhui Xu @ 2026-12-01 9:14 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 used on Lenovo TB322FC supports 40Hz and
24Hz refresh rates in addition to the existing modes. Add both modes so
they can be selected through the standard mode list.
The vertical totals (10200 and 17000) are taken from the panel datasheet
and follow the same htotal/vtotal layout as the existing entries.
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,
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices
2026-12-01 9:14 [PATCH 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-01 9:14 ` [PATCH 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
@ 2026-12-01 9:14 ` Qianhui Xu
2026-12-01 9:22 ` sashiko-bot
2026-12-01 9:14 ` [PATCH 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
2026-12-01 9:14 ` [PATCH 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
3 siblings, 1 reply; 8+ messages in thread
From: Qianhui Xu @ 2026-12-01 9:14 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel
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.
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;
}
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices
2026-12-01 9:14 ` [PATCH 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
@ 2026-12-01 9:22 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-12-01 9:22 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: missing Fixes trailer for
novatek_probe() ordering fix
--
commit 0955a3a53c64f23f46eda5271327e507a4ffe431
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> drm/panel: novatek-nt36536: finish setup before attaching DSI devices
>
> 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.
>
> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
[Severity: Low]
This fixes probe ordering bugs introduced with the driver. Should this
include:
Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201091454.153619-1-xiaqinghuan@mail.ustc.edu.cn?part=2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] drm/panel: novatek-nt36536: power off on any prepare failure
2026-12-01 9:14 [PATCH 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-01 9:14 ` [PATCH 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes " Qianhui Xu
2026-12-01 9:14 ` [PATCH 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
@ 2026-12-01 9:14 ` Qianhui Xu
2026-12-01 9:20 ` sashiko-bot
2026-12-01 9:14 ` [PATCH 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
3 siblings, 1 reply; 8+ messages in thread
From: Qianhui Xu @ 2026-12-01 9:14 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel
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.
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)
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 3/4] drm/panel: novatek-nt36536: power off on any prepare failure
2026-12-01 9:14 ` [PATCH 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
@ 2026-12-01 9:20 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-12-01 9:20 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: missing Fixes: trailer for
novatek_prepare() fix
--
commit 7027b4a69fa12b5bdef6196196575c644883b906
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> drm/panel: novatek-nt36536: power off on any prepare failure
>
> 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.
>
> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
[Severity: Low]
This fixes error handling in novatek_prepare(). Should this include:
Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201091454.153619-1-xiaqinghuan@mail.ustc.edu.cn?part=3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
2026-12-01 9:14 [PATCH 0/4] drm/panel: novatek-nt36536: mode additions and lifecycle fixes for CSOT PP8807HB1-1 Qianhui Xu
` (2 preceding siblings ...)
2026-12-01 9:14 ` [PATCH 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
@ 2026-12-01 9:14 ` Qianhui Xu
2026-12-01 9:23 ` sashiko-bot
3 siblings, 1 reply; 8+ messages in thread
From: Qianhui Xu @ 2026-12-01 9:14 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, linux-kernel
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.
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,
};
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
2026-12-01 9:14 ` [PATCH 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
@ 2026-12-01 9:23 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-12-01 9:23 UTC (permalink / raw)
To: Qianhui Xu, dri-devel
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] drm/panel: novatek_enable() reaches into drm_panel core
panel->prepared state
- [Low] drm/panel: missing Fixes trailer in commit message
--
commit bda58794a2620a7efd289beb14b6a30327dba914
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> drm/panel: novatek-nt36536: reject enable when prepare failed
>
> 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.
>
> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
[Severity: Low]
Should this include a Fixes tag for the commit that introduced the driver?
Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
> 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;
> +}
[Severity: Low]
Should panel->prepared be checked in drm_panel_enable() instead of in a
driver-specific enable() callback?
Commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in
drm_panel") centralized panel->prepared and panel->enabled tracking in
drivers/gpu/drm/drm_panel.c so individual panel drivers do not inspect it,
and drm_panel_funcs.enable is otherwise optional for drivers whose power-on
sequence runs in prepare(). Checking panel->prepared in drm_panel_enable()
before setting panel->enabled and enabling panel->backlight would avoid
reaching into drm_panel core state here and cover all panel drivers without
their own enable step.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201091454.153619-1-xiaqinghuan@mail.ustc.edu.cn?part=4
^ permalink raw reply [flat|nested] 8+ messages in thread