public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Hussain Qadri <hussain.bqadri@gmail.com>
To: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Hussain Qadri <hussain.bqadri@gmail.com>
Subject: [PATCH] drm/bridge: tc358762: Use mipi_dsi_generic_write_multi()
Date: Sat, 11 Apr 2026 02:06:48 +0100	[thread overview]
Message-ID: <20260411010648.39585-1-hussain.bqadri@gmail.com> (raw)

Replace the driver-local error accumulation around
mipi_dsi_generic_write() with mipi_dsi_generic_write_multi()
and struct mipi_dsi_multi_context.

Signed-off-by: Hussain Qadri <hussain.bqadri@gmail.com>
---
 drivers/gpu/drm/bridge/tc358762.c | 46 +++++++++++--------------------
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 98df3e667d4a..0630c4078987 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -76,25 +76,12 @@ struct tc358762 {
 	struct gpio_desc *reset_gpio;
 	struct drm_display_mode mode;
 	bool pre_enabled;
-	int error;
 };
 
-static int tc358762_clear_error(struct tc358762 *ctx)
+static void tc358762_write(struct mipi_dsi_multi_context *dsi_ctx, u16 addr, u32 val)
 {
-	int ret = ctx->error;
-
-	ctx->error = 0;
-	return ret;
-}
-
-static void tc358762_write(struct tc358762 *ctx, u16 addr, u32 val)
-{
-	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
-	ssize_t ret;
 	u8 data[6];
 
-	if (ctx->error)
-		return;
 
 	data[0] = addr;
 	data[1] = addr >> 8;
@@ -103,9 +90,7 @@ static void tc358762_write(struct tc358762 *ctx, u16 addr, u32 val)
 	data[4] = val >> 16;
 	data[5] = val >> 24;
 
-	ret = mipi_dsi_generic_write(dsi, data, sizeof(data));
-	if (ret < 0)
-		ctx->error = ret;
+	mipi_dsi_generic_write_multi(dsi_ctx, data, sizeof(data));
 }
 
 static inline struct tc358762 *bridge_to_tc358762(struct drm_bridge *bridge)
@@ -115,17 +100,19 @@ static inline struct tc358762 *bridge_to_tc358762(struct drm_bridge *bridge)
 
 static int tc358762_init(struct tc358762 *ctx)
 {
+	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
 	u32 lcdctrl;
 
-	tc358762_write(ctx, DSI_LANEENABLE,
+	tc358762_write(&dsi_ctx, DSI_LANEENABLE,
 		       LANEENABLE_L0EN | LANEENABLE_CLEN);
-	tc358762_write(ctx, PPI_D0S_CLRSIPOCOUNT, 5);
-	tc358762_write(ctx, PPI_D1S_CLRSIPOCOUNT, 5);
-	tc358762_write(ctx, PPI_D0S_ATMR, 0);
-	tc358762_write(ctx, PPI_D1S_ATMR, 0);
-	tc358762_write(ctx, PPI_LPTXTIMECNT, LPX_PERIOD);
+	tc358762_write(&dsi_ctx, PPI_D0S_CLRSIPOCOUNT, 5);
+	tc358762_write(&dsi_ctx, PPI_D1S_CLRSIPOCOUNT, 5);
+	tc358762_write(&dsi_ctx, PPI_D0S_ATMR, 0);
+	tc358762_write(&dsi_ctx, PPI_D1S_ATMR, 0);
+	tc358762_write(&dsi_ctx, PPI_LPTXTIMECNT, LPX_PERIOD);
 
-	tc358762_write(ctx, SPICMR, 0x00);
+	tc358762_write(&dsi_ctx, SPICMR, 0x00);
 
 	lcdctrl = LCDCTRL_VSDELAY(1) | LCDCTRL_RGB888 |
 		  LCDCTRL_UNK6 | LCDCTRL_VTGEN;
@@ -136,17 +123,16 @@ static int tc358762_init(struct tc358762 *ctx)
 	if (ctx->mode.flags & DRM_MODE_FLAG_NVSYNC)
 		lcdctrl |= LCDCTRL_VSPOL;
 
-	tc358762_write(ctx, LCDCTRL, lcdctrl);
+	tc358762_write(&dsi_ctx, LCDCTRL, lcdctrl);
 
-	tc358762_write(ctx, SYSCTRL, 0x040f);
+	tc358762_write(&dsi_ctx, SYSCTRL, 0x040f);
 	msleep(100);
 
-	tc358762_write(ctx, PPI_STARTPPI, PPI_START_FUNCTION);
-	tc358762_write(ctx, DSI_STARTDSI, DSI_RX_START);
+	tc358762_write(&dsi_ctx, PPI_STARTPPI, PPI_START_FUNCTION);
+	tc358762_write(&dsi_ctx, DSI_STARTDSI, DSI_RX_START);
 
 	msleep(100);
-
-	return tc358762_clear_error(ctx);
+	return dsi_ctx.accum_err;
 }
 
 static void tc358762_post_disable(struct drm_bridge *bridge,
-- 
2.53.0


             reply	other threads:[~2026-04-11 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-11  1:06 Hussain Qadri [this message]
2026-04-11 23:13 ` Claude review: drm/bridge: tc358762: Use mipi_dsi_generic_write_multi() Claude Code Review Bot
2026-04-11 23:13 ` Claude Code Review 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=20260411010648.39585-1-hussain.bqadri@gmail.com \
    --to=hussain.bqadri@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    /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