drm/panel: tdo-tl070wsh30: Use mipi_dsi_*_multi(); fix minor bugs

The mipi_dsi_dcs_*() functions used by this driver are deprecated in
favor of their _multi() counterparts, as noted in
Documentation/gpu/todo.rst. The _multi() variants record the first
error in a context structure and skip every later call once an error
is set, so the return value no longer has to be checked after each
command. They also log their own failures, which makes the per-call
dev_err() calls redundant.

Convert prepare() and unprepare(). prepare() uses mipi_dsi_msleep()
for the delays between DSI commands. unprepare() uses plain
usleep_range() so the delays run unconditionally after the
accumulated error is cleared. The delays in the GPIO reset sequence
stay as plain msleep() and usleep_range(), since they run before any
DSI transaction.

unprepare() now disables the regulator unconditionally and returns 0.
Previously a failure of set_display_off() was logged and the sequence
continued, while a failure of enter_sleep_mode() returned early,
leaving the regulator enabled and the panel unable to be brought back
up, since drm_panel_unprepare() skips panel->prepared = false on
error. The accumulated error from set_display_off() is cleared so
that the delay and enter_sleep_mode() are still attempted, preserving
the original fall-through behavior. Both drm_panel_prepare() and
drm_panel_unprepare() return void, so the error was never propagated
to a caller in any case.

Signed-off-by: Akash Sukhavasi <akash.sukhavasi@gmail.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patch.msgid.link/20260730-mipi-dsi-tl070wsh30-multi-v3-1-60592caef4f4@gmail.com
This commit is contained in:
Akash Sukhavasi 2026-07-30 19:11:31 -05:00 committed by Douglas Anderson
parent 559b757a71
commit 263728b4c4

View File

@ -35,6 +35,7 @@ struct tdo_tl070wsh30_panel *to_tdo_tl070wsh30_panel(struct drm_panel *panel)
static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel)
{
struct tdo_tl070wsh30_panel *tdo_tl070wsh30 = to_tdo_tl070wsh30_panel(panel);
struct mipi_dsi_multi_context dsi_ctx = { .dsi = tdo_tl070wsh30->link };
int err;
err = regulator_enable(tdo_tl070wsh30->supply);
@ -51,44 +52,27 @@ static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel)
msleep(200);
err = mipi_dsi_dcs_exit_sleep_mode(tdo_tl070wsh30->link);
if (err < 0) {
dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
mipi_dsi_msleep(&dsi_ctx, 200);
mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
mipi_dsi_msleep(&dsi_ctx, 20);
if (dsi_ctx.accum_err)
regulator_disable(tdo_tl070wsh30->supply);
return err;
}
msleep(200);
err = mipi_dsi_dcs_set_display_on(tdo_tl070wsh30->link);
if (err < 0) {
dev_err(panel->dev, "failed to set display on: %d\n", err);
regulator_disable(tdo_tl070wsh30->supply);
return err;
}
msleep(20);
return 0;
return dsi_ctx.accum_err;
}
static int tdo_tl070wsh30_panel_unprepare(struct drm_panel *panel)
{
struct tdo_tl070wsh30_panel *tdo_tl070wsh30 = to_tdo_tl070wsh30_panel(panel);
int err;
err = mipi_dsi_dcs_set_display_off(tdo_tl070wsh30->link);
if (err < 0)
dev_err(panel->dev, "failed to set display off: %d\n", err);
struct mipi_dsi_multi_context dsi_ctx = { .dsi = tdo_tl070wsh30->link };
mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
/* Reset error to continue power-down sequence even if display off failed */
dsi_ctx.accum_err = 0;
usleep_range(10000, 11000);
err = mipi_dsi_dcs_enter_sleep_mode(tdo_tl070wsh30->link);
if (err < 0) {
dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);
return err;
}
mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
usleep_range(10000, 11000);
regulator_disable(tdo_tl070wsh30->supply);