Skip to contentSkip to conversation

drm: docs: Remove deprecated MIPI DSI macro

PATCH Superseded Brigham Campbell 2 participants 6 messages Jul 7, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm: docs: Remove deprecated MIPI DSI macro

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

Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/3 drm: panel: Replace usage of deprecated MIPI macro

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.

---
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c +12 -6
index 5b5082efb282..777a8ab3a397 100644
@@ -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)
Signature · 1 line
2.49.0
#2 lore raw

Re: [PATCH 1/3] drm: panel: Replace usage of deprecated MIPI macro

Hi,

Quoted 51 lines · 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.

---
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c +11 -5
index 5b5082efb282..777a8ab3a397 100644
@@ -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,

drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c static int jdi_setup_symmetrical_split(struct mipi_dsi_device *left, · line 195

Quoted 10 lines
drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c +1 -1
 				   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/[email protected]/

Signature · 1 line
Tejas Vipin
#3 lore raw

PATCH 2/3 drm: Remove unused MIPI write seq and chatty functions

In reply to 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.

---
 drivers/gpu/drm/drm_mipi_dsi.c | 34 +++-------------------------------
 include/drm/drm_mipi_dsi.h     | 23 -----------------------
 2 files changed, 3 insertions(+), 54 deletions(-)
drivers/gpu/drm/drm_mipi_dsi.c +3 -31
index a00d76443128..3b8ff24980b4 100644
@@ -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)
include/drm/drm_mipi_dsi.h +0 -23
index 369b0d8830c3..f9cc106c8eb6 100644
@@ -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
  *
Signature · 1 line
2.49.0
#4 lore raw

PATCH 3/3 drm: docs: Remove completed task from drm TODO list

In reply to Brigham Campbell

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

---
 Documentation/gpu/todo.rst | 18 ------------------
 1 file changed, 18 deletions(-)
Documentation/gpu/todo.rst +0 -18
index be8637da3fe9..76afb8a784e3 100644
@@ -497,24 +497,6 @@ Contact: Douglas Anderson <[email protected]>
 
 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 <[email protected]>
-
-Level: Starter
-
 Remove devm_drm_put_bridge()
 ----------------------------
 
Signature · 1 line
2.49.0
#5 lore raw

Re: [PATCH 3/3] drm: docs: Remove completed task from drm TODO list

Hi,

Quoted 27 lines · Brigham Campbell

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

---
 Documentation/gpu/todo.rst | 18 ------------------
 1 file changed, 18 deletions(-)
Documentation/gpu/todo.rst +0 -11
index be8637da3fe9..76afb8a784e3 100644
@@ -497,24 +497,6 @@ Contact: Douglas Anderson <[email protected]>
 
 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

Documentation/gpu/todo.rst Contact: Douglas Anderson <[email protected]> · line 502

Quoted 10 lines
Documentation/gpu/todo.rst +0 -7
-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 <[email protected]>
-
-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?

Signature · 1 line
Tejas Vipin