From: Guido Günther <[email protected]>

With prepare_prev_first set, DRM calls visionox_rm69299_unprepare()
after the display controller timing engine has been stopped and before
the DSI host bridge post_disable() resets the video engine. Sending the
display-off and enter-sleep DCS commands from unprepare() therefore
causes DSI timeouts on every screen blank/unblank on the SHIFT6mq:

dmesg:
  msm_dsi ae94000.dsi: [drm:dsi_cmds2buf_tx] *ERROR* wait for video done timed 
out
  dsi_cmds2buf_tx: cmd dma tx failed, type=0x5, data0=0x28, len=4, ret=-110
  panel-visionox-rm69299 ae94000.dsi.0: sending DCS SET_DISPLAY_OFF failed: -110

Move the display-off and enter-sleep DCS commands into a new disable()
callback so they execute while the DSI link is still active, while
keeping the power-on and initialization commands in prepare() where the
link is in LP11 before video starts.

Fixes: 4a92ef0c57df ("drm/panel: visionox-rm69299: Make use of 
prepare_prev_first")
Signed-off-by: Guido Günther <[email protected]>
[David: keep power-on and init commands in prepare() per v1 review]
Signed-off-by: David Heidelberg <[email protected]>
---
 drivers/gpu/drm/panel/panel-visionox-rm69299.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c 
b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
index 4309e04c35c4b..bca1004656e45 100644
--- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
+++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
@@ -184,30 +184,37 @@ static int visionox_rm69299_power_on(struct 
visionox_rm69299 *ctx)
 static int visionox_rm69299_power_off(struct visionox_rm69299 *ctx)
 {
        gpiod_set_value(ctx->reset_gpio, 0);
 
        return regulator_bulk_disable(ARRAY_SIZE(visionox_rm69299_supplies),
                                      ctx->supplies);
 }
 
-static int visionox_rm69299_unprepare(struct drm_panel *panel)
+static int visionox_rm69299_disable(struct drm_panel *panel)
 {
        struct visionox_rm69299 *ctx = panel_to_ctx(panel);
        struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
 
        ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
        mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
 
        /* 120ms delay required here as per DCS spec */
        mipi_dsi_msleep(&dsi_ctx, 120);
 
        mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
 
+       return dsi_ctx.accum_err;
+}
+
+static int visionox_rm69299_unprepare(struct drm_panel *panel)
+{
+       struct visionox_rm69299 *ctx = panel_to_ctx(panel);
+
        return visionox_rm69299_power_off(ctx);
 }
 
 static int visionox_rm69299_prepare(struct drm_panel *panel)
 {
        struct visionox_rm69299 *ctx = panel_to_ctx(panel);
        struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
        int ret, i;
@@ -277,16 +284,17 @@ static int visionox_rm69299_get_modes(struct drm_panel 
*panel,
        connector->display_info.height_mm = 131;
        mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
        drm_mode_probed_add(connector, mode);
 
        return 1;
 }
 
 static const struct drm_panel_funcs visionox_rm69299_drm_funcs = {
+       .disable = visionox_rm69299_disable,
        .unprepare = visionox_rm69299_unprepare,
        .prepare = visionox_rm69299_prepare,
        .get_modes = visionox_rm69299_get_modes,
 };
 
 static int visionox_rm69299_bl_get_brightness(struct backlight_device *bl)
 {
        struct mipi_dsi_device *dsi = bl_get_data(bl);

-- 
2.55.0


Reply via email to