public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chintan Patel <chintanlike@gmail.com>
To: sumit.semwal@linaro.org, neil.armstrong@linaro.org
Cc: dianders@chromium.org, jesszhan0024@gmail.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Chintan Patel <chintanlike@gmail.com>
Subject: [PATCH] drm/panel: novatek-nt36672a: Inline command sequences
Date: Wed, 15 Apr 2026 16:56:08 -0700	[thread overview]
Message-ID: <20260415235608.8138-1-chintanlike@gmail.com> (raw)

Inline the command sequences and remove the nt36672a_send_cmds()
helper.

Small wrapper helpers around mipi_dsi_dcs_write_buffer_multi()
are discouraged as they add indirection without improving
readability and can increase code size.

Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
 .../gpu/drm/panel/panel-novatek-nt36672a.c    | 36 +++++++++----------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
index 7e8b5e059575..2f75200806dd 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
@@ -79,19 +79,6 @@ static inline struct nt36672a_panel *to_nt36672a_panel(struct drm_panel *panel)
 	return container_of(panel, struct nt36672a_panel, base);
 }
 
-static void nt36672a_send_cmds(struct mipi_dsi_multi_context *dsi_ctx,
-			       const struct nt36672a_panel_cmd *cmds, int num)
-{
-	unsigned int i;
-
-	for (i = 0; i < num; i++) {
-		const struct nt36672a_panel_cmd *cmd = &cmds[i];
-
-		/* cmd->data[0] is the DCS command, cmd->data[1] is the parameter */
-		mipi_dsi_dcs_write_buffer_multi(dsi_ctx, cmd->data, sizeof(cmd->data));
-	}
-}
-
 static void nt36672a_panel_power_off(struct drm_panel *panel)
 {
 	struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
@@ -108,10 +95,14 @@ static int nt36672a_panel_unprepare(struct drm_panel *panel)
 {
 	struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
 	struct mipi_dsi_multi_context dsi_ctx = { .dsi = pinfo->link };
+	unsigned int i;
 
 	/* send off cmds */
-	nt36672a_send_cmds(&dsi_ctx, pinfo->desc->off_cmds,
-			   pinfo->desc->num_off_cmds);
+	for (i = 0; i < pinfo->desc->num_off_cmds; i++) {
+		const struct nt36672a_panel_cmd *cmd = &pinfo->desc->off_cmds[i];
+
+		mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, (const u8 *)cmd->data, sizeof(cmd->data));
+	}
 
 	/* Reset error to continue with display off even if send_cmds failed */
 	dsi_ctx.accum_err = 0;
@@ -158,12 +149,16 @@ static int nt36672a_panel_prepare(struct drm_panel *panel)
 {
 	struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
 	struct mipi_dsi_multi_context dsi_ctx = { .dsi = pinfo->link };
+	unsigned int i;
 
 	dsi_ctx.accum_err = nt36672a_panel_power_on(pinfo);
 
 	/* send first part of init cmds */
-	nt36672a_send_cmds(&dsi_ctx, pinfo->desc->on_cmds_1,
-			   pinfo->desc->num_on_cmds_1);
+	for (i = 0; i < pinfo->desc->num_on_cmds_1; i++) {
+		const struct nt36672a_panel_cmd *cmd = &pinfo->desc->on_cmds_1[i];
+
+		mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, (const u8 *)cmd->data, sizeof(cmd->data));
+	}
 
 	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
 
@@ -173,8 +168,11 @@ static int nt36672a_panel_prepare(struct drm_panel *panel)
 	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
 
 	/* Send rest of the init cmds */
-	nt36672a_send_cmds(&dsi_ctx, pinfo->desc->on_cmds_2,
-			   pinfo->desc->num_on_cmds_2);
+	for (i = 0; i < pinfo->desc->num_on_cmds_2; i++) {
+		const struct nt36672a_panel_cmd *cmd = &pinfo->desc->on_cmds_2[i];
+
+		mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, (const u8 *)cmd->data, sizeof(cmd->data));
+	}
 
 	mipi_dsi_msleep(&dsi_ctx, 120);
 
-- 
2.43.0


             reply	other threads:[~2026-04-15 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 23:56 Chintan Patel [this message]
2026-04-17  3:16 ` [PATCH] drm/panel: novatek-nt36672a: Inline command sequences Doug Anderson
2026-04-18  1:51   ` Chintan Patel

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=20260415235608.8138-1-chintanlike@gmail.com \
    --to=chintanlike@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.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