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 <[email protected]>
---
 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,
 };

Reply via email to