Skip to contentSkip to conversation

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

PATCH Applied Avinal Kumar 4 participants 9 messages Apr 17 – Apr 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

Changes from v4:
- simplified code after removing redundant error printout
- there was a branch mismatch on my local and that resulted in a typo, it was fixed in v3 but I had my v2 changes open and I mistook it as 'serial' rather than 'several'. Apologies, fixed it now :)
- updated commit body

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  | 24 ++++++++--------
 include/drm/drm_mipi_dsi.h                    |  1 +
 3 files changed, 42 insertions(+), 11 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v5 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 0390e14d3157..3ac1dd5ad640 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 2ab651a36115..b429acde4f71 100644
@@ -393,6 +393,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.53.0
Reviewed-by on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] drm/mipi-dsi: add mipi_dsi_shutdown_peripheral_multi

Hi,

Quoted 9 lines · Avinal Kumar

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(+)

If no other comments, I'll plan to apply to drm-misc-next in about a week.

maintainer Reviewed-by on v5 1/2
#3 lore raw

Re: [PATCH v5 1/2] drm/mipi-dsi: add mipi_dsi_shutdown_peripheral_multi

In reply to Avinal Kumar
Quoted 60 lines · Avinal Kumar

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 0390e14d3157..3ac1dd5ad640 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 +0 -0
index 2ab651a36115..b429acde4f71 100644

include/drm/drm_mipi_dsi.h void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx, · line 399

Quoted 7 lines
include/drm/drm_mipi_dsi.h +1 -0
@@ -393,6 +393,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

Thanks,
Neil

#4 lore raw

Re: [PATCH v5 1/2] drm/mipi-dsi: add mipi_dsi_shutdown_peripheral_multi

In reply to Avinal Kumar

Hi,

Quoted 9 lines · Avinal Kumar

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(+)

Pushed to drm-misc-next:

[1/2] drm/mipi-dsi: add mipi_dsi_shutdown_peripheral_multi

      commit: ac7e1a9819d6ada9a9800d6d26256e5258711b99
#5 lore raw

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

In reply to Avinal Kumar

Change the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling and
remove redundant error printout.

---
 .../drm/panel/panel-panasonic-vvx10f034n00.c  | 24 ++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +13 -11
index 3c3308fc55df..d21d93a0700e 100644
@@ -44,14 +44,23 @@ 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);
+	struct mipi_dsi_multi_context dsi_ctx = {
+		.dsi = wuxga_nt->dsi
+	};
 
-	return mipi_dsi_shutdown_peripheral(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)
@@ -94,15 +103,8 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel)
 	msleep(250);
 
 	ret = wuxga_nt_panel_on(wuxga_nt);
-	if (ret < 0) {
-		dev_err(panel->dev, "failed to set panel on: %d\n", ret);
-		goto poweroff;
-	}
-
-	return 0;
-
-poweroff:
-	regulator_disable(wuxga_nt->supply);
+	if (ret < 0)
+		regulator_disable(wuxga_nt->supply);
 
 	return ret;
 }
Signature · 1 line
2.53.0
Reviewed-by on v5 2/2
#6 lore raw

Hi,

Quoted 9 lines · Avinal Kumar

Change the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling and
remove redundant error printout.

---
 .../drm/panel/panel-panasonic-vvx10f034n00.c  | 24 ++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)

If no other comments, I'll plan to apply to drm-misc-next in about a week.

Reviewed-by on v5 2/2
#7 lore raw
In reply to Avinal Kumar
Quoted 9 lines · Avinal Kumar

Change the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling and
remove redundant error printout.

---
 .../drm/panel/panel-panasonic-vvx10f034n00.c  | 24 ++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
#8 lore raw
In reply to Avinal Kumar

Hi,

Quoted 9 lines · Avinal Kumar

Change the panasonic-vvx10f034n00 panel to multi
style functions for improved error handling and
remove redundant error printout.

---
 .../drm/panel/panel-panasonic-vvx10f034n00.c  | 24 ++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)

Pushed to drm-misc-next:

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

      commit: 03af6c3afc4893988ceed54531f5dde4bebd6024