From: Chen-Yu Tsai <wens@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <jesszhan0024@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>,
Gerald Loacker <gerald.loacker@wolfvision.net>,
Michael Riesch <michael.riesch@collabora.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Chen-Yu Tsai <wens@kernel.org>, David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Archit Anant <architanant5@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [RFT PATCH v2 1/2] drm/mipi-dbi: Provide option to invert reset GPIO logic
Date: Tue, 17 Feb 2026 17:27:36 +0800 [thread overview]
Message-ID: <20260217092738.3238016-2-wens@kernel.org> (raw)
In-Reply-To: <20260217092738.3238016-1-wens@kernel.org>
When mipi_dbi (tinydrm) was added, the reset handling assumed that
"logic high" or "active" was out of reset, while "logic low" or
"inactive" was in reset. This is the opposite of how many reset
bindings are written, wherein "active" means the reset is active, i.e
the device is put or held in reset.
Provide an option to invert the logic so that drivers for bindings with
"active is in reset" using mipi_dbi can use the common reset handling.
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
drivers/gpu/drm/drm_mipi_dbi.c | 4 ++--
include/drm/drm_mipi_dbi.h | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 00482227a9cd..7fa1f73a38a4 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -713,9 +713,9 @@ void mipi_dbi_hw_reset(struct mipi_dbi *dbi)
if (!dbi->reset)
return;
- gpiod_set_value_cansleep(dbi->reset, 0);
+ gpiod_set_value_cansleep(dbi->reset, dbi->invert_reset ? 1 : 0);
usleep_range(20, 1000);
- gpiod_set_value_cansleep(dbi->reset, 1);
+ gpiod_set_value_cansleep(dbi->reset, dbi->invert_reset ? 0 : 1);
msleep(120);
}
EXPORT_SYMBOL(mipi_dbi_hw_reset);
diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index f45f9612c0bc..6cebf74bcecc 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -44,6 +44,15 @@ struct mipi_dbi {
*/
bool swap_bytes;
+ /**
+ * @invert_reset: Invert reset logic level.
+ *
+ * This is needed as drm_mipi_dbi (formerly tinydrm) introduced reset
+ * GPIO controls with "logic high" being "out of reset", while other
+ * bindings typically have "logic high" as "in reset".
+ */
+ bool invert_reset;
+
/**
* @reset: Optional reset gpio
*/
--
2.47.3
next prev parent reply other threads:[~2026-02-17 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 9:27 [RFT PATCH v2 0/2] drm/panel: sitronix-st7789v: Convert to mipi_dbi Chen-Yu Tsai
2026-02-17 9:27 ` Chen-Yu Tsai [this message]
2026-02-17 9:27 ` [RFT PATCH v2 2/2] " Chen-Yu Tsai
2026-02-18 6:37 ` [RFT PATCH v2 0/2] " Archit Anant
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=20260217092738.3238016-2-wens@kernel.org \
--to=wens@kernel.org \
--cc=airlied@gmail.com \
--cc=architanant5@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gerald.loacker@wolfvision.net \
--cc=jesszhan0024@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michael.riesch@collabora.com \
--cc=miquel.raynal@bootlin.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=sebastian.reichel@collabora.com \
--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
Powered by JetHome