dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] drm: docs: Remove deprecated MIPI DSI macro
@ 2025-07-07  7:56 Brigham Campbell
  2025-07-07  7:56 ` [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro Brigham Campbell
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Brigham Campbell @ 2025-07-07  7:56 UTC (permalink / raw)
  To: dianders, tejasvipin76, skhan, linux-kernel-mentees, dri-devel,
	linux-doc, linux-kernel
  Cc: Brigham Campbell

This series removes the unintuitive mipi_dsi_generic_write_seq() macro
and related mipi_dsi_generic_write_chatty() method from the drm
subsystem. This is in accordance with a TODO item from Douglas Anderson
in the drm subsystem documentation. Tejas Vipin (among others) has
largely spearheaded this effort up until now, converting MIPI panel
drivers one at a time.

The first patch of the series converts the last remaining driver to use
the preferred _multi() variant of mipi_dsi_generic_write_seq(). This
work likely hasn't been completed until now because the panel's usage of
two separate MIPI DSI interfaces at once requires special treatment. Any
behavioral modification to the jdi lpm102a188a panel driver by this
series is unintentional.

Brigham Campbell (3):
  Replace usage of deprecated MIPI function
  Remove unused MIPI write seq and chatty functions
  Remove completed task from drm TODO list

 Documentation/gpu/todo.rst                    | 18 ----------
 drivers/gpu/drm/drm_mipi_dsi.c                | 34 ++-----------------
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 18 ++++++----
 include/drm/drm_mipi_dsi.h                    | 23 -------------
 4 files changed, 15 insertions(+), 78 deletions(-)


base-commit: e33f256dbc293a1a3a31f18d56f659e7a27a491a
-- 
2.49.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro
  2025-07-07  7:56 [PATCH 0/3] drm: docs: Remove deprecated MIPI DSI macro Brigham Campbell
@ 2025-07-07  7:56 ` Brigham Campbell
  2025-07-07 17:02   ` Tejas Vipin
  2025-07-07  7:56 ` [PATCH 2/3] drm: Remove unused MIPI write seq and chatty functions Brigham Campbell
  2025-07-07  7:56 ` [PATCH 3/3] drm: docs: Remove completed task from drm TODO list Brigham Campbell
  2 siblings, 1 reply; 6+ messages in thread
From: Brigham Campbell @ 2025-07-07  7:56 UTC (permalink / raw)
  To: dianders, tejasvipin76, skhan, linux-kernel-mentees, dri-devel,
	linux-doc, linux-kernel, Neil Armstrong, Jessica Zhang,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: Brigham Campbell

Replace all usages of the deprecated mipi_dsi_generic_write_seq() with
mipi_dsi_generic_write_seq_multi().

This patch's usage of the mipi_dsi_multi_context struct is not
idiomatic. Rightfully, the struct wasn't designed to cater to the needs
of panels with multiple MIPI DSI interfaces. This panel is an oddity
which requires swapping the dsi pointer between calls to
mipi_dsi_generic_write_seq_multi() in order to preserve the exact
behavior implemented using the non-multi variant of the macro.

Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
---
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
index 5b5082efb282..777a8ab3a397 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
@@ -161,29 +161,35 @@ static int jdi_setup_symmetrical_split(struct mipi_dsi_device *left,
 
 static int jdi_write_dcdc_registers(struct jdi_panel *jdi)
 {
+	struct mipi_dsi_multi_context dsi_ctx;
+
 	/* Clear the manufacturer command access protection */
-	mipi_dsi_generic_write_seq(jdi->link1, MCS_CMD_ACS_PROT,
+	dsi_ctx.dsi = jdi->link1;
+	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_CMD_ACS_PROT,
 				   MCS_CMD_ACS_PROT_OFF);
-	mipi_dsi_generic_write_seq(jdi->link2, MCS_CMD_ACS_PROT,
+	dsi_ctx.dsi = jdi->link2;
+	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_CMD_ACS_PROT,
 				   MCS_CMD_ACS_PROT_OFF);
 	/*
-	 * Change the VGH/VGL divide rations to move the noise generated by the
+	 * Change the VGH/VGL divide ratios to move the noise generated by the
 	 * TCONN. This should hopefully avoid interaction with the backlight
 	 * controller.
 	 */
-	mipi_dsi_generic_write_seq(jdi->link1, MCS_PWR_CTRL_FUNC,
+	dsi_ctx.dsi = jdi->link1;
+	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_PWR_CTRL_FUNC,
 				   MCS_PWR_CTRL_PARAM1_VGH_330_DIV |
 				   MCS_PWR_CTRL_PARAM1_DEFAULT,
 				   MCS_PWR_CTRL_PARAM2_VGL_410_DIV |
 				   MCS_PWR_CTRL_PARAM2_DEFAULT);
 
-	mipi_dsi_generic_write_seq(jdi->link2, MCS_PWR_CTRL_FUNC,
+	dsi_ctx.dsi = jdi->link2;
+	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_PWR_CTRL_FUNC,
 				   MCS_PWR_CTRL_PARAM1_VGH_330_DIV |
 				   MCS_PWR_CTRL_PARAM1_DEFAULT,
 				   MCS_PWR_CTRL_PARAM2_VGL_410_DIV |
 				   MCS_PWR_CTRL_PARAM2_DEFAULT);
 
-	return 0;
+	return dsi_ctx.accum_err;
 }
 
 static int jdi_panel_prepare(struct drm_panel *panel)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] drm: Remove unused MIPI write seq and chatty functions
  2025-07-07  7:56 [PATCH 0/3] drm: docs: Remove deprecated MIPI DSI macro Brigham Campbell
  2025-07-07  7:56 ` [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro Brigham Campbell
@ 2025-07-07  7:56 ` Brigham Campbell
  2025-07-07  7:56 ` [PATCH 3/3] drm: docs: Remove completed task from drm TODO list Brigham Campbell
  2 siblings, 0 replies; 6+ messages in thread
From: Brigham Campbell @ 2025-07-07  7:56 UTC (permalink / raw)
  To: dianders, tejasvipin76, skhan, linux-kernel-mentees, dri-devel,
	linux-doc, linux-kernel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: Brigham Campbell

Remove the deprecated mipi_dsi_generic_write_seq() macro and
mipi_dsi_generic_write_chatty() function now that they are no longer
used.

Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
---
 drivers/gpu/drm/drm_mipi_dsi.c | 34 +++-------------------------------
 include/drm/drm_mipi_dsi.h     | 23 -----------------------
 2 files changed, 3 insertions(+), 54 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index a00d76443128..3b8ff24980b4 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -772,41 +772,13 @@ ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
 EXPORT_SYMBOL(mipi_dsi_generic_write);
 
 /**
- * mipi_dsi_generic_write_chatty() - mipi_dsi_generic_write() w/ an error log
- * @dsi: DSI peripheral device
- * @payload: buffer containing the payload
- * @size: size of payload buffer
- *
- * Like mipi_dsi_generic_write() but includes a dev_err()
- * call for you and returns 0 upon success, not the number of bytes sent.
- *
- * Return: 0 on success or a negative error code on failure.
- */
-int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi,
-				  const void *payload, size_t size)
-{
-	struct device *dev = &dsi->dev;
-	ssize_t ret;
-
-	ret = mipi_dsi_generic_write(dsi, payload, size);
-	if (ret < 0) {
-		dev_err(dev, "sending generic data %*ph failed: %zd\n",
-			(int)size, payload, ret);
-		return ret;
-	}
-
-	return 0;
-}
-EXPORT_SYMBOL(mipi_dsi_generic_write_chatty);
-
-/**
- * mipi_dsi_generic_write_multi() - mipi_dsi_generic_write_chatty() w/ accum_err
+ * mipi_dsi_generic_write_multi() - mipi_dsi_generic_write() w/ accum_err
  * @ctx: Context for multiple DSI transactions
  * @payload: buffer containing the payload
  * @size: size of payload buffer
  *
- * Like mipi_dsi_generic_write_chatty() but deals with errors in a way that
- * makes it convenient to make several calls in a row.
+ * A wrapper around mipi_dsi_generic_write() that deals with errors in a way
+ * that makes it convenient to make several calls in a row.
  */
 void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx,
 				  const void *payload, size_t size)
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 369b0d8830c3..f9cc106c8eb6 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -285,8 +285,6 @@ void mipi_dsi_picture_parameter_set_multi(struct mipi_dsi_multi_context *ctx,
 
 ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
 			       size_t size);
-int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi,
-				  const void *payload, size_t size);
 void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx,
 				  const void *payload, size_t size);
 ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params,
@@ -379,27 +377,6 @@ void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_dsi_multi_context *ctx,
 					  u16 scanline);
 void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_multi_context *ctx);
 
-/**
- * mipi_dsi_generic_write_seq - transmit data using a generic write packet
- *
- * This macro will print errors for you and will RETURN FROM THE CALLING
- * FUNCTION (yes this is non-intuitive) upon error.
- *
- * Because of the non-intuitive return behavior, THIS MACRO IS DEPRECATED.
- * Please replace calls of it with mipi_dsi_generic_write_seq_multi().
- *
- * @dsi: DSI peripheral device
- * @seq: buffer containing the payload
- */
-#define mipi_dsi_generic_write_seq(dsi, seq...)                                \
-	do {                                                                   \
-		static const u8 d[] = { seq };                                 \
-		int ret;                                                       \
-		ret = mipi_dsi_generic_write_chatty(dsi, d, ARRAY_SIZE(d));    \
-		if (ret < 0)                                                   \
-			return ret;                                            \
-	} while (0)
-
 /**
  * mipi_dsi_generic_write_seq_multi - transmit data using a generic write packet
  *
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] drm: docs: Remove completed task from drm TODO list
  2025-07-07  7:56 [PATCH 0/3] drm: docs: Remove deprecated MIPI DSI macro Brigham Campbell
  2025-07-07  7:56 ` [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro Brigham Campbell
  2025-07-07  7:56 ` [PATCH 2/3] drm: Remove unused MIPI write seq and chatty functions Brigham Campbell
@ 2025-07-07  7:56 ` Brigham Campbell
  2025-07-07 17:05   ` Tejas Vipin
  2 siblings, 1 reply; 6+ messages in thread
From: Brigham Campbell @ 2025-07-07  7:56 UTC (permalink / raw)
  To: dianders, tejasvipin76, skhan, linux-kernel-mentees, dri-devel,
	linux-doc, linux-kernel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Jonathan Corbet
  Cc: Brigham Campbell

Remove TODO item from drm documentation to transition away from using
mipi_dsi_*_write_seq() macros now that the work is complete.

Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
---
 Documentation/gpu/todo.rst | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index be8637da3fe9..76afb8a784e3 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -497,24 +497,6 @@ Contact: Douglas Anderson <dianders@chromium.org>
 
 Level: Intermediate
 
-Transition away from using mipi_dsi_*_write_seq()
--------------------------------------------------
-
-The macros mipi_dsi_generic_write_seq() and mipi_dsi_dcs_write_seq() are
-non-intuitive because, if there are errors, they return out of the *caller's*
-function. We should move all callers to use mipi_dsi_generic_write_seq_multi()
-and mipi_dsi_dcs_write_seq_multi() macros instead.
-
-Once all callers are transitioned, the macros and the functions that they call,
-mipi_dsi_generic_write_chatty() and mipi_dsi_dcs_write_buffer_chatty(), can
-probably be removed. Alternatively, if people feel like the _multi() variants
-are overkill for some use cases, we could keep the mipi_dsi_*_write_seq()
-variants but change them not to return out of the caller.
-
-Contact: Douglas Anderson <dianders@chromium.org>
-
-Level: Starter
-
 Remove devm_drm_put_bridge()
 ----------------------------
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro
  2025-07-07  7:56 ` [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro Brigham Campbell
@ 2025-07-07 17:02   ` Tejas Vipin
  0 siblings, 0 replies; 6+ messages in thread
From: Tejas Vipin @ 2025-07-07 17:02 UTC (permalink / raw)
  To: Brigham Campbell, dianders, skhan, linux-kernel-mentees,
	dri-devel, linux-doc, linux-kernel, Neil Armstrong, Jessica Zhang,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter

Hi,

On 7/7/25 1:26 PM, Brigham Campbell wrote:
> Replace all usages of the deprecated mipi_dsi_generic_write_seq() with
> mipi_dsi_generic_write_seq_multi().
> 
> This patch's usage of the mipi_dsi_multi_context struct is not
> idiomatic. Rightfully, the struct wasn't designed to cater to the needs
> of panels with multiple MIPI DSI interfaces. This panel is an oddity
> which requires swapping the dsi pointer between calls to
> mipi_dsi_generic_write_seq_multi() in order to preserve the exact
> behavior implemented using the non-multi variant of the macro.
> 
> Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
> ---
>  drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
> index 5b5082efb282..777a8ab3a397 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
> @@ -161,29 +161,35 @@ static int jdi_setup_symmetrical_split(struct mipi_dsi_device *left,
>  
>  static int jdi_write_dcdc_registers(struct jdi_panel *jdi)
>  {
> +	struct mipi_dsi_multi_context dsi_ctx;
> +
>  	/* Clear the manufacturer command access protection */
> -	mipi_dsi_generic_write_seq(jdi->link1, MCS_CMD_ACS_PROT,
> +	dsi_ctx.dsi = jdi->link1;
> +	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_CMD_ACS_PROT,
>  				   MCS_CMD_ACS_PROT_OFF);
> -	mipi_dsi_generic_write_seq(jdi->link2, MCS_CMD_ACS_PROT,
> +	dsi_ctx.dsi = jdi->link2;
> +	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_CMD_ACS_PROT,
>  				   MCS_CMD_ACS_PROT_OFF);
>  	/*
> -	 * Change the VGH/VGL divide rations to move the noise generated by the
> +	 * Change the VGH/VGL divide ratios to move the noise generated by the
>  	 * TCONN. This should hopefully avoid interaction with the backlight
>  	 * controller.
>  	 */
> -	mipi_dsi_generic_write_seq(jdi->link1, MCS_PWR_CTRL_FUNC,
> +	dsi_ctx.dsi = jdi->link1;
> +	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_PWR_CTRL_FUNC,
>  				   MCS_PWR_CTRL_PARAM1_VGH_330_DIV |
>  				   MCS_PWR_CTRL_PARAM1_DEFAULT,
>  				   MCS_PWR_CTRL_PARAM2_VGL_410_DIV |
>  				   MCS_PWR_CTRL_PARAM2_DEFAULT);
>  
> -	mipi_dsi_generic_write_seq(jdi->link2, MCS_PWR_CTRL_FUNC,
> +	dsi_ctx.dsi = jdi->link2;
> +	mipi_dsi_generic_write_seq_multi(&dsi_ctx, MCS_PWR_CTRL_FUNC,
>  				   MCS_PWR_CTRL_PARAM1_VGH_330_DIV |
>  				   MCS_PWR_CTRL_PARAM1_DEFAULT,
>  				   MCS_PWR_CTRL_PARAM2_VGL_410_DIV |
>  				   MCS_PWR_CTRL_PARAM2_DEFAULT);
>  
> -	return 0;
> +	return dsi_ctx.accum_err;
>  }
>  
>  static int jdi_panel_prepare(struct drm_panel *panel)

There's a lot more functions that should be replaced in this panel. You
can get a good idea of which ones by looking for the keyword
"deprecated" in drm_mipi_dsi.c . Here's a good reference for what a
conversion patch usually looks like:
https://lore.kernel.org/all/20250319183106.12613-1-tejasvipin76@gmail.com/

-- 
Tejas Vipin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] drm: docs: Remove completed task from drm TODO list
  2025-07-07  7:56 ` [PATCH 3/3] drm: docs: Remove completed task from drm TODO list Brigham Campbell
@ 2025-07-07 17:05   ` Tejas Vipin
  0 siblings, 0 replies; 6+ messages in thread
From: Tejas Vipin @ 2025-07-07 17:05 UTC (permalink / raw)
  To: Brigham Campbell, dianders, skhan, linux-kernel-mentees,
	dri-devel, linux-doc, linux-kernel, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Jonathan Corbet

Hi,

On 7/7/25 1:26 PM, Brigham Campbell wrote:
> Remove TODO item from drm documentation to transition away from using
> mipi_dsi_*_write_seq() macros now that the work is complete.
> 
> Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
> ---
>  Documentation/gpu/todo.rst | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index be8637da3fe9..76afb8a784e3 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -497,24 +497,6 @@ Contact: Douglas Anderson <dianders@chromium.org>
>  
>  Level: Intermediate
>  
> -Transition away from using mipi_dsi_*_write_seq()
> --------------------------------------------------
> -
> -The macros mipi_dsi_generic_write_seq() and mipi_dsi_dcs_write_seq() are
> -non-intuitive because, if there are errors, they return out of the *caller's*
> -function. We should move all callers to use mipi_dsi_generic_write_seq_multi()
> -and mipi_dsi_dcs_write_seq_multi() macros instead.
> -
> -Once all callers are transitioned, the macros and the functions that they call,
> -mipi_dsi_generic_write_chatty() and mipi_dsi_dcs_write_buffer_chatty(), can
> -probably be removed. Alternatively, if people feel like the _multi() variants
> -are overkill for some use cases, we could keep the mipi_dsi_*_write_seq()
> -variants but change them not to return out of the caller.
> -
> -Contact: Douglas Anderson <dianders@chromium.org>
> -
> -Level: Starter
> -
>  Remove devm_drm_put_bridge()
>  ----------------------------
>  

Personally I think there's merit in keeping this TODO around until all
the other mipi_dsi functions are transitioned as well and removed
entirely. Maybe rewording it to reflect this could be better?

-- 
Tejas Vipin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-07 17:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07  7:56 [PATCH 0/3] drm: docs: Remove deprecated MIPI DSI macro Brigham Campbell
2025-07-07  7:56 ` [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro Brigham Campbell
2025-07-07 17:02   ` Tejas Vipin
2025-07-07  7:56 ` [PATCH 2/3] drm: Remove unused MIPI write seq and chatty functions Brigham Campbell
2025-07-07  7:56 ` [PATCH 3/3] drm: docs: Remove completed task from drm TODO list Brigham Campbell
2025-07-07 17:05   ` Tejas Vipin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).