Skip to contentSkip to conversation

drm/panel: panasonic-vvx10f034n00: transition to mipi_dsi wrapped functions

PATCH Superseded Avinal Kumar 3 participants 6 messages Jan 13 – Apr 13

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover drm/panel: panasonic-vvx10f034n00: transition to mipi_dsi wrapped functions

Apologies, I did use the checkpatch script but I attached the unfixed patch file by mistake. I have fixed it now. Will take care from next time.

Thanks a lot.

Changes from v2:
Fixed typo

Avinal Kumar (2):
drm/mipi-dsi: add mipi_dsi_shutdown_peripheral_multi drm/panel: panasonic-vvx10f034n00: transition to mipi_dsi wrapped
functions

 drivers/gpu/drm/drm_mipi_dsi.c                | 28 +++++++++++++++++++
 .../drm/panel/panel-panasonic-vvx10f034n00.c  | 14 ++++++++--
 include/drm/drm_mipi_dsi.h                    |  1 +
 3 files changed, 41 insertions(+), 2 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH v3 1/2 drm/mipi-dsi: add mipi_dsi_shutdown_peripheral_multi

Add mipi_dsi_shutdown_peripheral_multi function and mark mipi_dsi_shutdown_peripheral function as deprecated.

---
 drivers/gpu/drm/drm_mipi_dsi.c | 28 ++++++++++++++++++++++++++++
 include/drm/drm_mipi_dsi.h     |  1 +
 2 files changed, 29 insertions(+)
drivers/gpu/drm/drm_mipi_dsi.c +28 -0
index a712e177b350..2fed50172a44 100644
@@ -587,6 +587,9 @@ EXPORT_SYMBOL(mipi_dsi_create_packet);
  * mipi_dsi_shutdown_peripheral() - sends a Shutdown Peripheral command
  * @dsi: DSI peripheral device
  *
+ * This function is deprecated. Use mipi_dsi_shutdown_peripheral_multi()
+ * instead.
+ *
  * Return: 0 on success or a negative error code on failure.
  */
 int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi)
@@ -1980,6 +1983,31 @@ void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_dsi_multi_context *ctx,
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_scanline_multi);
 
+/**
+ * mipi_dsi_shutdown_peripheral_multi() - sends a Shutdown Peripheral command
+ * @ctx: Context for multiple DSI transactions
+ *
+ * Like mipi_dsi_shutdown_peripheral() but deals with errors in a way that
+ * makes it convenient to make several calls in a row.
+ */
+void mipi_dsi_shutdown_peripheral_multi(struct mipi_dsi_multi_context *ctx)
+{
+	struct mipi_dsi_device *dsi = ctx->dsi;
+	struct device *dev = &dsi->dev;
+	int ret;
+
+	if (ctx->accum_err)
+		return;
+
+	ret = mipi_dsi_shutdown_peripheral(dsi);
+	if (ret < 0) {
+		ctx->accum_err = ret;
+		dev_err(dev, "Failed to shutdown peripheral: %d\n",
+			ctx->accum_err);
+	}
+}
+EXPORT_SYMBOL(mipi_dsi_shutdown_peripheral_multi);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
 	struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
include/drm/drm_mipi_dsi.h +1 -0
index 3aba7b380c8d..19ccdf5eeb5f 100644
@@ -389,6 +389,7 @@ void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx,
 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);
+void mipi_dsi_shutdown_peripheral_multi(struct mipi_dsi_multi_context *ctx);
 
 /**
  * mipi_dsi_generic_write_seq_multi - transmit data using a generic write packet
Signature · 1 line
2.52.0
#2 lore raw

PATCH v3 2/2 drm/panel: panasonic-vvx10f034n00: transition to mipi_dsi wrapped functions

In reply to Avinal Kumar

Changes the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling.

---
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +12 -2
index 3c3308fc55df..73c5827a15a4 100644
@@ -44,14 +44,24 @@ static inline struct wuxga_nt_panel *to_wuxga_nt_panel(struct drm_panel *panel)
 
 static int wuxga_nt_panel_on(struct wuxga_nt_panel *wuxga_nt)
 {
-	return mipi_dsi_turn_on_peripheral(wuxga_nt->dsi);
+	struct mipi_dsi_multi_context dsi_ctx = {
+		.dsi = wuxga_nt->dsi
+	};
+
+	mipi_dsi_turn_on_peripheral_multi(&dsi_ctx);
+	return dsi_ctx.accum_err;
 }
 
 static int wuxga_nt_panel_disable(struct drm_panel *panel)
 {
 	struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 
-	return mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
+	struct mipi_dsi_multi_context dsi_ctx = {
+		.dsi = wuxga_nt->dsi
+	};
+
+	mipi_dsi_shutdown_peripheral_multi(&dsi_ctx);
+	return dsi_ctx.accum_err;
 }
 
 static int wuxga_nt_panel_unprepare(struct drm_panel *panel)
Signature · 1 line
2.52.0
#3 lore raw

Hello Neil,

Just checking if anything is remaining here?

Thanks,
Avinal

Quoted 45 lines · Avinal Kumar

Changes the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling.

---
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +12 -2
index 3c3308fc55df..73c5827a15a4 100644
@@ -44,14 +44,24 @@ static inline struct wuxga_nt_panel
 *to_wuxga_nt_panel(struct drm_panel *panel)
 
 static int wuxga_nt_panel_on(struct wuxga_nt_panel *wuxga_nt)
 {
-       return mipi_dsi_turn_on_peripheral(wuxga_nt->dsi);
+       struct mipi_dsi_multi_context dsi_ctx = {
+               .dsi = wuxga_nt->dsi
+       };
+
+       mipi_dsi_turn_on_peripheral_multi(&dsi_ctx);
+       return dsi_ctx.accum_err;
 }
 
 static int wuxga_nt_panel_disable(struct drm_panel *panel)
 {
        struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 
-       return mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
+       struct mipi_dsi_multi_context dsi_ctx = {
+               .dsi = wuxga_nt->dsi
+       };
+
+       mipi_dsi_shutdown_peripheral_multi(&dsi_ctx);
+       return dsi_ctx.accum_err;
 }
 

static int wuxga_nt_panel_unprepare(struct drm_panel *panel)
--
2.52.0

#4 lore raw
In reply to Avinal Kumar
Quoted 29 lines · Avinal Kumar

Changes the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling.

---
  .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +6 -1
index 3c3308fc55df..73c5827a15a4 100644
@@ -44,14 +44,24 @@ static inline struct wuxga_nt_panel *to_wuxga_nt_panel(struct drm_panel *panel)
 
  static int wuxga_nt_panel_on(struct wuxga_nt_panel *wuxga_nt)
  {
-	return mipi_dsi_turn_on_peripheral(wuxga_nt->dsi);
+	struct mipi_dsi_multi_context dsi_ctx = {
+		.dsi = wuxga_nt->dsi
+	};
+
+	mipi_dsi_turn_on_peripheral_multi(&dsi_ctx);
+	return dsi_ctx.accum_err;
  }
 
  static int wuxga_nt_panel_disable(struct drm_panel *panel)
  {
  	struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 

drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c static inline struct wuxga_nt_panel *to_wuxga_nt_panel(struct drm_panel *panel) · line 67

Quoted 10 lines
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +6 -1
-	return mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
+	struct mipi_dsi_multi_context dsi_ctx = {
+		.dsi = wuxga_nt->dsi
+	};
+
+	mipi_dsi_shutdown_peripheral_multi(&dsi_ctx);
+	return dsi_ctx.accum_err;
  }
 
  static int wuxga_nt_panel_unprepare(struct drm_panel *panel)

So yeah we want to use multi functions but in this case I don't think it's appropriate when a since dsi function is called in a callback.

Dmitry ? Doug ?

Neil

#5 lore raw

Hi,

Quoted 31 lines · On Mon, Apr 13, 2026 at 1:07 AM <[email protected]> wrote:
Quoted 29 lines · Avinal Kumar

Changes the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling.

---
  .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +6 -1
index 3c3308fc55df..73c5827a15a4 100644
@@ -44,14 +44,24 @@ static inline struct wuxga_nt_panel *to_wuxga_nt_panel(struct drm_panel *panel)
 
  static int wuxga_nt_panel_on(struct wuxga_nt_panel *wuxga_nt)
  {
-     return mipi_dsi_turn_on_peripheral(wuxga_nt->dsi);
+     struct mipi_dsi_multi_context dsi_ctx = {
+             .dsi = wuxga_nt->dsi
+     };
+
+     mipi_dsi_turn_on_peripheral_multi(&dsi_ctx);
+     return dsi_ctx.accum_err;
  }
 u
  static int wuxga_nt_panel_disable(struct drm_panel *panel)
  {
      struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 
Quoted 4 lines

drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c static inline struct wuxga_nt_panel *to_wuxga_nt_panel(struct drm_panel *panel) · line 61

Quoted 4 lines
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +3 -1
-     return mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
+     struct mipi_dsi_multi_context dsi_ctx = {
+             .dsi = wuxga_nt->dsi
+     };

nit: get rid of the blank line between the two variable declarations.

Quoted 11 lines

drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c static inline struct wuxga_nt_panel *to_wuxga_nt_panel(struct drm_panel *panel) · line 67

Quoted 6 lines
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +3 -0
+
+     mipi_dsi_shutdown_peripheral_multi(&dsi_ctx);
+     return dsi_ctx.accum_err;
  }
 
  static int wuxga_nt_panel_unprepare(struct drm_panel *panel)

So yeah we want to use multi functions but in this case I don't think it's appropriate when a since dsi function is called in a callback.

Dmitry ? Doug ?

It's a little weird, but I think the official stance is that we _do_ want to transition even when only a single DSI function is used, as this patch does. I can spend some time trying to find the original discussoins if need be, but as I recall:

* The "multi" functions do still have the advantage of giving you an error printout. Previously the "disable" function here wouldn't have printed an error. Speaking of which, we probably want a v2 of this patch that gets rid of the (now extra) "failed to set panel on: %d\n" error printout since we can now rely on the error printout in mipi_dsi_turn_on_peripheral_multi().

* We talked about having a variant function with the error printout but not the "multi" calling style, but I think we decided that it was better to have fewer functions to worry about.

-Doug