From: Svyatoslav Ryhel <clamor95@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <jesszhan0024@gmail.com>,
Mikko Perttunen <mperttunen@nvidia.com>,
Svyatoslav Ryhel <clamor95@gmail.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v8 03/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to mipi_dbi_write_seq_multi()
Date: Sun, 22 Nov 2026 10:18:11 +0200 [thread overview]
Message-ID: <20261122081820.53199-4-clamor95@gmail.com> (raw)
In-Reply-To: <20261122081820.53199-1-clamor95@gmail.com>
Switch from the internal panel command-sending macro to a generic one
to improve code reuse.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../drm/panel/panel-hitachi-tx10d07vm0baa.c | 213 +++++++++---------
1 file changed, 101 insertions(+), 112 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c b/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c
index 318ece68b7806..c5b59a7341d8e 100644
--- a/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c
+++ b/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c
@@ -37,19 +37,6 @@ static inline struct hitachi_tx10d07vm0baa *to_hitachi_tx10d07vm0baa(struct drm_
return container_of(panel, struct hitachi_tx10d07vm0baa, panel);
}
-#define panel_dbi_command(priv, cmd, seq...) \
-({ \
- const u8 d[] = { seq }; \
- struct drm_panel *panel = &(priv)->panel; \
- struct mipi_dbi_device *dbidev = (priv)->dbidev; \
- struct device *dev = panel->dev; \
- int ret; \
- ret = mipi_dbi_command_stackbuf((dbidev)->dbi, cmd, d, ARRAY_SIZE(d)); \
- if (ret) \
- dev_err_ratelimited(dev, "error %d when sending command %#02x\n", ret, cmd); \
- ret; \
-})
-
static int hitachi_tx10d07vm0baa_prepare(struct drm_panel *panel)
{
struct hitachi_tx10d07vm0baa *priv = to_hitachi_tx10d07vm0baa(panel);
@@ -76,118 +63,120 @@ static int hitachi_tx10d07vm0baa_prepare(struct drm_panel *panel)
static int hitachi_tx10d07vm0baa_enable(struct drm_panel *panel)
{
struct hitachi_tx10d07vm0baa *priv = to_hitachi_tx10d07vm0baa(panel);
-
- panel_dbi_command(priv, MIPI_DCS_SET_PARTIAL_ROWS, 0x00, 0x00, 0x03, 0x1f);
- panel_dbi_command(priv, MIPI_DCS_SET_SCROLL_AREA, 0x00, 0x00, 0x03, 0x20,
- 0x00, 0x00);
-
- panel_dbi_command(priv, MIPI_DCS_SET_ADDRESS_MODE, 0x0a);
- panel_dbi_command(priv, MIPI_DCS_SET_SCROLL_START, 0x00, 0x00);
-
- panel_dbi_command(priv, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_24BIT);
- panel_dbi_command(priv, MIPI_DCS_SET_TEAR_SCANLINE, 0x00, 0x00);
-
- panel_dbi_command(priv, 0x71, 0x00); /* Ex_Vsync_en */
-
- panel_dbi_command(priv, 0xb2, 0x00); /* VCSEL */
- panel_dbi_command(priv, 0xb4, 0xaa); /* setvgmpm */
- panel_dbi_command(priv, 0xb5, 0x33); /* rbias1 */
- panel_dbi_command(priv, 0xb6, 0x03); /* rbias2 */
-
- panel_dbi_command(priv, 0xb7, 0x1a, 0x33, 0x03, 0x03,
- 0x03, 0x00, 0x00, 0x01, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x01, 0x01, 0x01); /* set_ddvdhp */
- panel_dbi_command(priv, 0xb8, 0x1c, 0x53, 0x03, 0x03,
- 0x00, 0x01, 0x02, 0x00, 0x00, 0x04,
- 0x00, 0x01, 0x01); /* set_ddvdhm */
-
- panel_dbi_command(priv, 0xb9, 0x0a, 0x01, 0x01, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x02, 0x01); /* set_vgh */
- panel_dbi_command(priv, 0xba, 0x0f, 0x01, 0x01, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x02, 0x01); /* set_vgl */
- panel_dbi_command(priv, 0xbb, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x01); /* set_vcl */
-
- panel_dbi_command(priv, 0xc1, 0x01); /* number of lines */
- panel_dbi_command(priv, 0xc2, 0x08); /* number of fp lines */
- panel_dbi_command(priv, 0xc3, 0x04); /* gateset(1) */
- panel_dbi_command(priv, 0xc4, 0x4c); /* 1h period */
- panel_dbi_command(priv, 0xc5, 0x03); /* source precharge */
- panel_dbi_command(priv, 0xc6, 0xc4, 0x04); /* source precharge timing */
- panel_dbi_command(priv, 0xc7, 0x00); /* source level */
- panel_dbi_command(priv, 0xc8, 0x02); /* number of bp lines */
- panel_dbi_command(priv, 0xc9, 0x10); /* gateset(2) */
- panel_dbi_command(priv, 0xca, 0x04, 0x04); /* gateset(3) */
- panel_dbi_command(priv, 0xcb, 0x03); /* gateset(4) */
- panel_dbi_command(priv, 0xcc, 0x12); /* gateset(5) */
- panel_dbi_command(priv, 0xcd, 0x12); /* gateset(6) */
- panel_dbi_command(priv, 0xce, 0x30); /* gateset(7) */
- panel_dbi_command(priv, 0xcf, 0x30); /* gateset(8) */
- panel_dbi_command(priv, 0xd0, 0x40); /* gateset(9) */
- panel_dbi_command(priv, 0xd1, 0x22); /* flhw */
- panel_dbi_command(priv, 0xd2, 0x22); /* vckhw */
- panel_dbi_command(priv, 0xd3, 0x04); /* flt */
- panel_dbi_command(priv, 0xd4, 0x14); /* tctrl */
- panel_dbi_command(priv, 0xd6, 0x02); /* dotinv */
- panel_dbi_command(priv, 0xd7, 0x00); /* on/off sequence period */
-
- panel_dbi_command(priv, 0xd8, 0x01, 0x05, 0x06, 0x0d,
- 0x18, 0x09, 0x22, 0x23, 0x00); /* ponseqa */
- panel_dbi_command(priv, 0xd9, 0x24, 0x01); /* ponseqb */
- panel_dbi_command(priv, 0xde, 0x09, 0x0f, 0x21, 0x12,
- 0x04); /* ponseqc */
-
- panel_dbi_command(priv, 0xdf, 0x02, 0x06, 0x06, 0x06,
- 0x06, 0x00); /* pofseqa */
- panel_dbi_command(priv, 0xe0, 0x01); /* pofseqb */
-
- panel_dbi_command(priv, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
- panel_dbi_command(priv, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x40);
-
- panel_dbi_command(priv, 0xe2, 0x00, 0x00); /* cabc pwm */
- panel_dbi_command(priv, 0xe3, 0x03); /* cabc */
- panel_dbi_command(priv, 0xe4, 0x66, 0x7b, 0x90, 0xa5,
- 0xbb, 0xc7, 0xe1, 0xe5); /* cabc brightness */
- panel_dbi_command(priv, 0xe5, 0xc5, 0xc5, 0xc9, 0xc9,
- 0xd1, 0xe1, 0xf1, 0xfe); /* cabc brightness */
- panel_dbi_command(priv, 0xe7, 0x2a); /* cabc */
- panel_dbi_command(priv, 0xe8, 0x00); /* brt_rev */
- panel_dbi_command(priv, 0xe9, 0x00); /* tefreq */
-
- panel_dbi_command(priv, 0xea, 0x01); /* high speed ram */
-
- panel_dbi_command(priv, 0xeb, 0x00, 0x33, 0x0e, 0x15,
- 0xb7, 0x78, 0x88, 0x0f); /* gamma setting r pos */
- panel_dbi_command(priv, 0xec, 0x00, 0x33, 0x0e, 0x15,
- 0xb7, 0x78, 0x88, 0x0f); /* gamma setting r neg */
- panel_dbi_command(priv, 0xed, 0x00, 0x33, 0x0e, 0x15,
- 0xb7, 0x78, 0x88, 0x0f); /* gamma setting g pos */
- panel_dbi_command(priv, 0xee, 0x00, 0x33, 0x0e, 0x15,
- 0xb7, 0x78, 0x88, 0x0f); /* gamma setting g neg */
- panel_dbi_command(priv, 0xef, 0x00, 0x33, 0x0e, 0x15,
- 0xb7, 0x78, 0x88, 0x0f); /* gamma setting b pos */
- panel_dbi_command(priv, 0xf0, 0x00, 0x33, 0x0e, 0x15,
- 0xb7, 0x78, 0x88, 0x0f); /* gamma setting b neg */
-
- panel_dbi_command(priv, MIPI_DCS_EXIT_SLEEP_MODE);
+ struct mipi_dbi_multi_context ctx = { .dbidev = priv->dbidev };
+
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_PARTIAL_ROWS, 0x00, 0x00, 0x03, 0x1f);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_SCROLL_AREA, 0x00, 0x00, 0x03, 0x20,
+ 0x00, 0x00);
+
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x0a);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_SCROLL_START, 0x00, 0x00);
+
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_24BIT);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_TEAR_SCANLINE, 0x00, 0x00);
+
+ mipi_dbi_write_seq_multi(&ctx, 0x71, 0x00); /* Ex_Vsync_en */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xb2, 0x00); /* VCSEL */
+ mipi_dbi_write_seq_multi(&ctx, 0xb4, 0xaa); /* setvgmpm */
+ mipi_dbi_write_seq_multi(&ctx, 0xb5, 0x33); /* rbias1 */
+ mipi_dbi_write_seq_multi(&ctx, 0xb6, 0x03); /* rbias2 */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xb7, 0x1a, 0x33, 0x03, 0x03,
+ 0x03, 0x00, 0x00, 0x01, 0x02, 0x00,
+ 0x00, 0x04, 0x00, 0x01, 0x01, 0x01); /* set_ddvdhp */
+ mipi_dbi_write_seq_multi(&ctx, 0xb8, 0x1c, 0x53, 0x03, 0x03,
+ 0x00, 0x01, 0x02, 0x00, 0x00, 0x04,
+ 0x00, 0x01, 0x01); /* set_ddvdhm */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xb9, 0x0a, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x02, 0x01); /* set_vgh */
+ mipi_dbi_write_seq_multi(&ctx, 0xba, 0x0f, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x02, 0x01); /* set_vgl */
+ mipi_dbi_write_seq_multi(&ctx, 0xbb, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x01); /* set_vcl */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xc1, 0x01); /* number of lines */
+ mipi_dbi_write_seq_multi(&ctx, 0xc2, 0x08); /* number of fp lines */
+ mipi_dbi_write_seq_multi(&ctx, 0xc3, 0x04); /* gateset(1) */
+ mipi_dbi_write_seq_multi(&ctx, 0xc4, 0x4c); /* 1h period */
+ mipi_dbi_write_seq_multi(&ctx, 0xc5, 0x03); /* source precharge */
+ mipi_dbi_write_seq_multi(&ctx, 0xc6, 0xc4, 0x04); /* source precharge timing */
+ mipi_dbi_write_seq_multi(&ctx, 0xc7, 0x00); /* source level */
+ mipi_dbi_write_seq_multi(&ctx, 0xc8, 0x02); /* number of bp lines */
+ mipi_dbi_write_seq_multi(&ctx, 0xc9, 0x10); /* gateset(2) */
+ mipi_dbi_write_seq_multi(&ctx, 0xca, 0x04, 0x04); /* gateset(3) */
+ mipi_dbi_write_seq_multi(&ctx, 0xcb, 0x03); /* gateset(4) */
+ mipi_dbi_write_seq_multi(&ctx, 0xcc, 0x12); /* gateset(5) */
+ mipi_dbi_write_seq_multi(&ctx, 0xcd, 0x12); /* gateset(6) */
+ mipi_dbi_write_seq_multi(&ctx, 0xce, 0x30); /* gateset(7) */
+ mipi_dbi_write_seq_multi(&ctx, 0xcf, 0x30); /* gateset(8) */
+ mipi_dbi_write_seq_multi(&ctx, 0xd0, 0x40); /* gateset(9) */
+ mipi_dbi_write_seq_multi(&ctx, 0xd1, 0x22); /* flhw */
+ mipi_dbi_write_seq_multi(&ctx, 0xd2, 0x22); /* vckhw */
+ mipi_dbi_write_seq_multi(&ctx, 0xd3, 0x04); /* flt */
+ mipi_dbi_write_seq_multi(&ctx, 0xd4, 0x14); /* tctrl */
+ mipi_dbi_write_seq_multi(&ctx, 0xd6, 0x02); /* dotinv */
+ mipi_dbi_write_seq_multi(&ctx, 0xd7, 0x00); /* on/off sequence period */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xd8, 0x01, 0x05, 0x06, 0x0d,
+ 0x18, 0x09, 0x22, 0x23, 0x00); /* ponseqa */
+ mipi_dbi_write_seq_multi(&ctx, 0xd9, 0x24, 0x01); /* ponseqb */
+ mipi_dbi_write_seq_multi(&ctx, 0xde, 0x09, 0x0f, 0x21, 0x12,
+ 0x04); /* ponseqc */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xdf, 0x02, 0x06, 0x06, 0x06,
+ 0x06, 0x00); /* pofseqa */
+ mipi_dbi_write_seq_multi(&ctx, 0xe0, 0x01); /* pofseqb */
+
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x40);
+
+ mipi_dbi_write_seq_multi(&ctx, 0xe2, 0x00, 0x00); /* cabc pwm */
+ mipi_dbi_write_seq_multi(&ctx, 0xe3, 0x03); /* cabc */
+ mipi_dbi_write_seq_multi(&ctx, 0xe4, 0x66, 0x7b, 0x90, 0xa5,
+ 0xbb, 0xc7, 0xe1, 0xe5); /* cabc brightness */
+ mipi_dbi_write_seq_multi(&ctx, 0xe5, 0xc5, 0xc5, 0xc9, 0xc9,
+ 0xd1, 0xe1, 0xf1, 0xfe); /* cabc brightness */
+ mipi_dbi_write_seq_multi(&ctx, 0xe7, 0x2a); /* cabc */
+ mipi_dbi_write_seq_multi(&ctx, 0xe8, 0x00); /* brt_rev */
+ mipi_dbi_write_seq_multi(&ctx, 0xe9, 0x00); /* tefreq */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xea, 0x01); /* high speed ram */
+
+ mipi_dbi_write_seq_multi(&ctx, 0xeb, 0x00, 0x33, 0x0e, 0x15,
+ 0xb7, 0x78, 0x88, 0x0f); /* gamma setting r pos */
+ mipi_dbi_write_seq_multi(&ctx, 0xec, 0x00, 0x33, 0x0e, 0x15,
+ 0xb7, 0x78, 0x88, 0x0f); /* gamma setting r neg */
+ mipi_dbi_write_seq_multi(&ctx, 0xed, 0x00, 0x33, 0x0e, 0x15,
+ 0xb7, 0x78, 0x88, 0x0f); /* gamma setting g pos */
+ mipi_dbi_write_seq_multi(&ctx, 0xee, 0x00, 0x33, 0x0e, 0x15,
+ 0xb7, 0x78, 0x88, 0x0f); /* gamma setting g neg */
+ mipi_dbi_write_seq_multi(&ctx, 0xef, 0x00, 0x33, 0x0e, 0x15,
+ 0xb7, 0x78, 0x88, 0x0f); /* gamma setting b pos */
+ mipi_dbi_write_seq_multi(&ctx, 0xf0, 0x00, 0x33, 0x0e, 0x15,
+ 0xb7, 0x78, 0x88, 0x0f); /* gamma setting b neg */
+
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_EXIT_SLEEP_MODE);
msleep(110);
- panel_dbi_command(priv, MIPI_DCS_SET_DISPLAY_ON);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_ON);
- return 0;
+ return ctx.accum_err;
}
static int hitachi_tx10d07vm0baa_disable(struct drm_panel *panel)
{
struct hitachi_tx10d07vm0baa *priv = to_hitachi_tx10d07vm0baa(panel);
+ struct mipi_dbi_multi_context ctx = { .dbidev = priv->dbidev };
- panel_dbi_command(priv, MIPI_DCS_SET_DISPLAY_OFF);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_OFF);
msleep(35);
- panel_dbi_command(priv, MIPI_DCS_ENTER_SLEEP_MODE);
+ mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_ENTER_SLEEP_MODE);
msleep(50);
- return 0;
+ return ctx.accum_err;
}
static int hitachi_tx10d07vm0baa_unprepare(struct drm_panel *panel)
--
2.53.0
next prev parent reply other threads:[~2026-11-22 8:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 8:18 [PATCH v8 00/12] drm/tegra: Add support for Tegra20/Tegra30 8-bit CPU interface Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 01/12] drm: Add MIPI DBI bus support for MIPI DBI Type A and B Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 02/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-22 8:18 ` Svyatoslav Ryhel [this message]
2026-11-22 8:18 ` [PATCH v8 04/12] drm/panel: panel-lg-lh400wv3: " Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 05/12] drm/panel: panel-lg-lh400wv3: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 06/12] drm/tegra: dc: Add elements required by Tegra MIPI DBI Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 07/12] dt-bindings: display: tegra: Document Tegra20 DSI port Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 08/12] drm/tegra: output: Make panel parsing configurable Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 09/12] drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 10/12] drm/tegra: rgb: Parameterize configuration based on bus flags Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 11/12] dt-bindings: display: tegra: Document 8-bit CPU parallel interface Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 12/12] drm/tegra: Add support for 8-bit CPU interface Svyatoslav Ryhel
2026-11-22 8:43 ` sashiko-bot
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=20261122081820.53199-4-clamor95@gmail.com \
--to=clamor95@gmail.com \
--cc=airlied@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mperttunen@nvidia.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=thierry.reding@kernel.org \
--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