[PATCH v2 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
From: Qianhui Xu
Date: Tue Dec 01 2026 - 05:39:50 EST
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@xxxxxxxxxxxxxxx>
Signed-off-by: Qianhui Xu <xiaqinghuan@xxxxxxxxxxxxxxxx>
---
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