From: Hsieh Hung-En <hungen3108@gmail.com>
To: dianders@chromium.org, neil.armstrong@linaro.org, jesszhan0024@gmail.com
Cc: jagan@amarulasolutions.com, osama.abdelkader@gmail.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
Hsieh Hung-En <hungen3108@gmail.com>,
Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH v2 2/5] drm/panel: raydium-rm68200: Fix prepare error cleanup
Date: Mon, 2 Nov 2026 12:32:12 +0800 [thread overview]
Message-ID: <20261102043215.990351-3-hungen3108@gmail.com> (raw)
In-Reply-To: <20261102043215.990351-1-hungen3108@gmail.com>
rm68200_prepare() returns without disabling the supply regulator if
EXIT_SLEEP_MODE or SET_DISPLAY_ON fails. Since drm_panel_prepare() does
not mark the panel as prepared on failure, drm_panel_unprepare() does
not call the driver's unprepare() callback, leaving the regulator
enable count elevated even after subsequent successful
prepare/unprepare cycles.
On failure, restore the reset GPIO to its unprepared state, following
the existing reset sequence in unprepare(), and disable the supply
regulator before returning the original error.
Fixes: 2b7ed18bed1a ("drm/panel: Add support for Raydium RM68200 panel driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/sashiko-outbox-171393@kernel.org
Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
---
Notes:
In this patch, rm68200_init_sequence() still returns void and only
logs DCS write failures. These failures do not cause prepare() to
return early. A later patch in this series will propagate
initialization errors through prepare(), where this cleanup path
will also handle them.
The error path does not send SET_DISPLAY_OFF or ENTER_SLEEP_MODE,
as DCS communication may already have failed. Instead, it follows
the existing reset and regulator shutdown sequence in unprepare().
drivers/gpu/drm/panel/panel-raydium-rm68200.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index c535dc931903..3a59eb00274d 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -277,17 +277,26 @@ static int rm68200_prepare(struct drm_panel *panel)
ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
if (ret)
- return ret;
+ goto assert_reset;
msleep(125);
ret = mipi_dsi_dcs_set_display_on(dsi);
if (ret)
- return ret;
+ goto assert_reset;
msleep(20);
return 0;
+
+assert_reset:
+ if (ctx->reset_gpio) {
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ msleep(20);
+ }
+ /* Balance the regulator enable count on prepare failure. */
+ regulator_disable(ctx->supply);
+ return ret;
}
static int rm68200_get_modes(struct drm_panel *panel,
--
2.43.0
next prev parent reply other threads:[~2026-11-02 4:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 4:32 [PATCH v2 0/5] drm/panel: Use mipi_dsi_*_multi() in feiyang and rm68200 Hsieh Hung-En
2026-11-02 4:32 ` [PATCH v2 1/5] drm/panel: feiyang-fy07024di26a30d: Fix prepare error cleanup Hsieh Hung-En
2026-11-02 13:00 ` neil.armstrong
2026-11-02 4:32 ` Hsieh Hung-En [this message]
2026-11-02 13:01 ` [PATCH v2 2/5] drm/panel: raydium-rm68200: " neil.armstrong
2026-11-02 4:32 ` [PATCH v2 3/5] drm/panel: feiyang-fy07024di26a30d: Use mipi_dsi_*_multi() functions Hsieh Hung-En
2026-11-02 13:02 ` neil.armstrong
2026-11-02 4:32 ` [PATCH v2 4/5] drm/panel: raydium-rm68200: " Hsieh Hung-En
2026-11-02 13:02 ` neil.armstrong
2026-11-02 4:32 ` [PATCH v2 5/5] drm/panel: raydium-rm68200: Use lowercase hex literals Hsieh Hung-En
2026-11-02 13:02 ` neil.armstrong
2026-11-02 13:40 ` [PATCH v2 0/5] drm/panel: Use mipi_dsi_*_multi() in feiyang and rm68200 Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102043215.990351-3-hungen3108@gmail.com \
--to=hungen3108@gmail.com \
--cc=airlied@gmail.com \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jagan@amarulasolutions.com \
--cc=jesszhan0024@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=osama.abdelkader@gmail.com \
--cc=sashiko-bot@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®