Replace the deprecated MIPI DSI DCS helpers with their _multi variants,
as suggested in Documentation/gpu/todo.rst.

In prepare(), use mipi_dsi_msleep() to skip delays after a failed
command, preserving the existing error handling. The helpers also
log command failures.

In unprepare(), clear accum_err between commands so that ENTER_SLEEP_MODE
is still attempted if SET_DISPLAY_OFF fails. The helpers now log failures
at error level instead of warning level.

Leave the initialization sequence unchanged, as converting its write
helpers would change error handling. This is addressed in the next patch.

Signed-off-by: Hsieh Hung-En <[email protected]>
---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c | 27 ++++++++-----------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c 
b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index c535dc931903..971d075bb060 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -232,15 +232,13 @@ static int rm68200_unprepare(struct drm_panel *panel)
 {
        struct rm68200 *ctx = panel_to_rm68200(panel);
        struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
-       int ret;
+       struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
 
-       ret = mipi_dsi_dcs_set_display_off(dsi);
-       if (ret)
-               dev_warn(panel->dev, "failed to set display off: %d\n", ret);
+       mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
 
-       ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
-       if (ret)
-               dev_warn(panel->dev, "failed to enter sleep mode: %d\n", ret);
+       /* Attempt to enter sleep mode even if display off failed. */
+       dsi_ctx.accum_err = 0;
+       mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
 
        msleep(120);
 
@@ -258,6 +256,7 @@ static int rm68200_prepare(struct drm_panel *panel)
 {
        struct rm68200 *ctx = panel_to_rm68200(panel);
        struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+       struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
        int ret;
 
        ret = regulator_enable(ctx->supply);
@@ -275,19 +274,15 @@ static int rm68200_prepare(struct drm_panel *panel)
 
        rm68200_init_sequence(ctx);
 
-       ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
-       if (ret)
-               return ret;
+       mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
 
-       msleep(125);
+       mipi_dsi_msleep(&dsi_ctx, 125);
 
-       ret = mipi_dsi_dcs_set_display_on(dsi);
-       if (ret)
-               return ret;
+       mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
 
-       msleep(20);
+       mipi_dsi_msleep(&dsi_ctx, 20);
 
-       return 0;
+       return dsi_ctx.accum_err;
 }
 
 static int rm68200_get_modes(struct drm_panel *panel,
-- 
2.43.0

Reply via email to