From: Mikko Perttunen <mperttunen@nvidia.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>,
Svyatoslav Ryhel <clamor95@gmail.com>,
devicetree@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
Svyatoslav Ryhel <clamor95@gmail.com>
Subject: Re: [PATCH v8 05/12] drm/panel: panel-lg-lh400wv3: Convert to mipi_dbi_write_seq_multi()
Date: Fri, 27 Nov 2026 13:40:57 +0900 [thread overview]
Message-ID: <HQu8082xS7qYmUTkCtc3sA@nvidia.com> (raw)
In-Reply-To: <20261122081820.53199-6-clamor95@gmail.com>
On Sunday, November 22, 2026 5:18 PM Svyatoslav Ryhel wrote:
> Switch from the internal panel command-sending macro to a generic one to
> improve code reuse.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
> drivers/gpu/drm/panel/panel-lg-lh400wv3.c | 91 ++++++++++-------------
> 1 file changed, 40 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-lg-lh400wv3.c b/drivers/gpu/drm/panel/panel-lg-lh400wv3.c
> index 63efeb434be13..02150330f1735 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lh400wv3.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lh400wv3.c
> @@ -37,19 +37,6 @@ static inline struct lg_lh400wv3 *to_lg_lh400wv3(struct drm_panel *panel)
> return container_of(panel, struct lg_lh400wv3, 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 lg_lh400wv3_prepare(struct drm_panel *panel)
> {
> struct lg_lh400wv3 *priv = to_lg_lh400wv3(panel);
> @@ -76,57 +63,59 @@ static int lg_lh400wv3_prepare(struct drm_panel *panel)
> static int lg_lh400wv3_enable(struct drm_panel *panel)
> {
> struct lg_lh400wv3 *priv = to_lg_lh400wv3(panel);
> -
> - panel_dbi_command(priv, MIPI_DCS_EXIT_INVERT_MODE);
> - panel_dbi_command(priv, MIPI_DCS_SET_TEAR_ON);
> -
> - panel_dbi_command(priv, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_24BIT |
> - MIPI_DCS_PIXEL_FMT_24BIT << 4);
> -
> - panel_dbi_command(priv, 0xb2, 0x00, 0xc8);
> - panel_dbi_command(priv, 0xb3, 0x00);
> - panel_dbi_command(priv, 0xb4, 0x04);
> - panel_dbi_command(priv, 0xb5, 0x42, 0x10, 0x10, 0x00, 0x20);
> - panel_dbi_command(priv, 0xb6, 0x0b, 0x0f, 0x3c, 0x13, 0x13, 0xe8);
> - panel_dbi_command(priv, 0xb7, 0x4c, 0x06, 0x0c, 0x00, 0x00);
> -
> - panel_dbi_command(priv, 0xc0, 0x01, 0x11);
> - panel_dbi_command(priv, 0xc3, 0x07, 0x03, 0x04, 0x04, 0x04);
> - panel_dbi_command(priv, 0xc4, 0x12, 0x24, 0x18, 0x18, 0x02, 0x49);
> - panel_dbi_command(priv, 0xc5, 0x65);
> - panel_dbi_command(priv, 0xc6, 0x41, 0x63);
> -
> - panel_dbi_command(priv, 0xd0, 0x00, 0x46, 0x74, 0x32, 0x1d, 0x03, 0x51, 0x15, 0x04);
> - panel_dbi_command(priv, 0xd1, 0x00, 0x46, 0x74, 0x32, 0x1d, 0x03, 0x51, 0x15, 0x04);
> - panel_dbi_command(priv, 0xd2, 0x00, 0x46, 0x74, 0x32, 0x1f, 0x03, 0x51, 0x15, 0x04);
> - panel_dbi_command(priv, 0xd3, 0x00, 0x46, 0x74, 0x32, 0x1f, 0x03, 0x51, 0x15, 0x04);
> - panel_dbi_command(priv, 0xd4, 0x01, 0x46, 0x74, 0x25, 0x00, 0x03, 0x51, 0x15, 0x04);
> - panel_dbi_command(priv, 0xd5, 0x01, 0x46, 0x74, 0x25, 0x00, 0x03, 0x51, 0x15, 0x04);
> -
> - panel_dbi_command(priv, MIPI_DCS_SET_COLUMN_ADDRESS, 0x00, 0x00, 0x01, 0xdf);
> - panel_dbi_command(priv, MIPI_DCS_SET_PAGE_ADDRESS, 0x00, 0x00, 0x03, 0x1f);
> -
> - 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_EXIT_INVERT_MODE);
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_TEAR_ON);
> +
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_24BIT |
> + MIPI_DCS_PIXEL_FMT_24BIT << 4);
> +
> + mipi_dbi_write_seq_multi(&ctx, 0xb2, 0x00, 0xc8);
> + mipi_dbi_write_seq_multi(&ctx, 0xb3, 0x00);
> + mipi_dbi_write_seq_multi(&ctx, 0xb4, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xb5, 0x42, 0x10, 0x10, 0x00, 0x20);
> + mipi_dbi_write_seq_multi(&ctx, 0xb6, 0x0b, 0x0f, 0x3c, 0x13, 0x13, 0xe8);
> + mipi_dbi_write_seq_multi(&ctx, 0xb7, 0x4c, 0x06, 0x0c, 0x00, 0x00);
> +
> + mipi_dbi_write_seq_multi(&ctx, 0xc0, 0x01, 0x11);
> + mipi_dbi_write_seq_multi(&ctx, 0xc3, 0x07, 0x03, 0x04, 0x04, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xc4, 0x12, 0x24, 0x18, 0x18, 0x02, 0x49);
> + mipi_dbi_write_seq_multi(&ctx, 0xc5, 0x65);
> + mipi_dbi_write_seq_multi(&ctx, 0xc6, 0x41, 0x63);
> +
> + mipi_dbi_write_seq_multi(&ctx, 0xd0, 0x00, 0x46, 0x74, 0x32, 0x1d, 0x03, 0x51, 0x15, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xd1, 0x00, 0x46, 0x74, 0x32, 0x1d, 0x03, 0x51, 0x15, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xd2, 0x00, 0x46, 0x74, 0x32, 0x1f, 0x03, 0x51, 0x15, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xd3, 0x00, 0x46, 0x74, 0x32, 0x1f, 0x03, 0x51, 0x15, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xd4, 0x01, 0x46, 0x74, 0x25, 0x00, 0x03, 0x51, 0x15, 0x04);
> + mipi_dbi_write_seq_multi(&ctx, 0xd5, 0x01, 0x46, 0x74, 0x25, 0x00, 0x03, 0x51, 0x15, 0x04);
> +
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_COLUMN_ADDRESS, 0x00, 0x00, 0x01, 0xdf);
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_PAGE_ADDRESS, 0x00, 0x00, 0x03, 0x1f);
> +
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_EXIT_SLEEP_MODE);
> msleep(120);
>
> - panel_dbi_command(priv, MIPI_DCS_WRITE_MEMORY_START);
> - panel_dbi_command(priv, MIPI_DCS_SET_DISPLAY_ON);
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_WRITE_MEMORY_START);
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_ON);
>
> - return 0;
> + return ctx.accum_err;
> }
>
> static int lg_lh400wv3_disable(struct drm_panel *panel)
> {
> struct lg_lh400wv3 *priv = to_lg_lh400wv3(panel);
> + struct mipi_dbi_multi_context ctx = { .dbidev = priv->dbidev };
>
> - panel_dbi_command(priv, MIPI_DCS_SET_DISPLAY_OFF);
> - panel_dbi_command(priv, MIPI_DCS_ENTER_SLEEP_MODE);
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_OFF);
> + mipi_dbi_write_seq_multi(&ctx, MIPI_DCS_ENTER_SLEEP_MODE);
> msleep(150);
>
> - panel_dbi_command(priv, 0xc1, 0x01);
> + mipi_dbi_write_seq_multi(&ctx, 0xc1, 0x01);
> usleep_range(10000, 11000);
>
> - return 0;
> + return ctx.accum_err;
> }
>
> static int lg_lh400wv3_unprepare(struct drm_panel *panel)
> --
> 2.53.0
>
>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
next prev parent reply other threads:[~2026-11-27 4:42 UTC|newest]
Thread overview: 31+ 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-27 4:16 ` Mikko Perttunen
2026-11-27 9:06 ` Svyatoslav Ryhel
2026-11-27 12:14 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 02/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-27 4:23 ` Mikko Perttunen
2026-11-27 9:10 ` Svyatoslav Ryhel
2026-11-27 12:16 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 03/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-27 4:40 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 04/12] drm/panel: panel-lg-lh400wv3: Convert to use MIPI DBI bus 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-27 4:40 ` Mikko Perttunen [this message]
2026-11-22 8:18 ` [PATCH v8 06/12] drm/tegra: dc: Add elements required by Tegra MIPI DBI Svyatoslav Ryhel
2026-11-27 4:56 ` Mikko Perttunen
2026-11-27 9:16 ` 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-27 5:01 ` Mikko Perttunen
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-27 5:24 ` Mikko Perttunen
2026-11-27 9:17 ` Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 10/12] drm/tegra: rgb: Parameterize configuration based on bus flags Svyatoslav Ryhel
2026-11-27 6:22 ` Mikko Perttunen
2026-11-27 9:21 ` Svyatoslav Ryhel
2026-11-27 9:41 ` Svyatoslav Ryhel
2026-11-27 12:26 ` Mikko Perttunen
2026-11-27 12:35 ` Mikko Perttunen
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
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=HQu8082xS7qYmUTkCtc3sA@nvidia.com \
--to=mperttunen@nvidia.com \
--cc=airlied@gmail.com \
--cc=clamor95@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=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