Skip to contentSkip to conversation

Transition remaining mipi_dsi_dcs_write_seq commands and remove it

PATCH Applied Tejas Vipin 3 participants 6 messages Apr 19, 2025 – Apr 22, 2025

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

cover Transition remaining mipi_dsi_dcs_write_seq commands and remove it

panel-samsung-sofef00 is the last remaining user of mipi_dsi_dcs_write_seq, so mipi_dsi_dcs_write_seq can be removed after the panel has been changed to use mipi_dsi_*_multi functions.

Tejas Vipin (2):
drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped
functions
drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq

 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 70 ++++++-------------
 include/drm/drm_mipi_dsi.h                    | 22 ------
 2 files changed, 21 insertions(+), 71 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/2 drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions

Changes the samsung-sofef00 panel to use multi style functions for improved error handling.

---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 70 ++++++-------------
 1 file changed, 21 insertions(+), 49 deletions(-)
drivers/gpu/drm/panel/panel-samsung-sofef00.c +21 -49
index 04ce925b3d9d..e20c85d5d9e1 100644
@@ -44,66 +44,44 @@ static void sofef00_panel_reset(struct sofef00_panel *ctx)
 static int sofef00_panel_on(struct sofef00_panel *ctx)
 {
 	struct mipi_dsi_device *dsi = ctx->dsi;
-	struct device *dev = &dsi->dev;
-	int ret;
+	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
 
 	dsi->mode_flags |= MIPI_DSI_MODE_LPM;
 
-	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
-		return ret;
-	}
-	usleep_range(10000, 11000);
+	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
+	mipi_dsi_usleep_range(&dsi_ctx, 10000, 11000);
 
-	mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a);
 
-	ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
-	if (ret < 0) {
-		dev_err(dev, "Failed to set tear on: %d\n", ret);
-		return ret;
-	}
+	mipi_dsi_dcs_set_tear_on_multi(&dsi_ctx, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
 
-	mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5);
-	mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a);
-	mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x07);
-	mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x12);
-	mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5);
-	mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20);
-	mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0x07);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb6, 0x12);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
 
-	ret = mipi_dsi_dcs_set_display_on(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to set display on: %d\n", ret);
-		return ret;
-	}
+	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
 
-	return 0;
+	return dsi_ctx.accum_err;
 }
 
 static int sofef00_panel_off(struct sofef00_panel *ctx)
 {
 	struct mipi_dsi_device *dsi = ctx->dsi;
-	struct device *dev = &dsi->dev;
-	int ret;
+	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
 
 	dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
-	ret = mipi_dsi_dcs_set_display_off(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to set display off: %d\n", ret);
-		return ret;
-	}
-	msleep(40);
+	mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
+	mipi_dsi_msleep(&dsi_ctx, 40);
 
-	ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
-		return ret;
-	}
-	msleep(160);
+	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
+	mipi_dsi_msleep(&dsi_ctx, 160);
 
-	return 0;
+	return dsi_ctx.accum_err;
 }
 
 static int sofef00_panel_prepare(struct drm_panel *panel)
@@ -122,7 +100,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
 
 	ret = sofef00_panel_on(ctx);
 	if (ret < 0) {
-		dev_err(dev, "Failed to initialize panel: %d\n", ret);
 		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 		return ret;
 	}
@@ -133,13 +110,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
 static int sofef00_panel_unprepare(struct drm_panel *panel)
 {
 	struct sofef00_panel *ctx = to_sofef00_panel(panel);
-	struct device *dev = &ctx->dsi->dev;
-	int ret;
-
-	ret = sofef00_panel_off(ctx);
-	if (ret < 0)
-		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
 
+	sofef00_panel_off(ctx);
 	regulator_disable(ctx->supply);
 
 	return 0;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions

Quoted 7 lines · Tejas Vipin

Changes the samsung-sofef00 panel to use multi style functions for improved error handling.

---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 70 ++++++-------------
 1 file changed, 21 insertions(+), 49 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

PATCH 2/2 drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq

In reply to Tejas Vipin

There are no remaining users of mipi_dsi_dcs_write_seq and it can be removed in favor of mipi_dsi_dcs_write_seq_multi.

---
 include/drm/drm_mipi_dsi.h | 22 ----------------------
 1 file changed, 22 deletions(-)
include/drm/drm_mipi_dsi.h +0 -22
index bd40a443385c..0d6e0d03d802 100644
@@ -416,28 +416,6 @@ void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_multi_context *ctx);
 		mipi_dsi_generic_write_multi(ctx, d, ARRAY_SIZE(d)); \
 	} while (0)
 
-/**
- * mipi_dsi_dcs_write_seq - transmit a DCS command with payload
- *
- * 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_dcs_write_seq_multi().
- *
- * @dsi: DSI peripheral device
- * @cmd: Command
- * @seq: buffer containing data to be transmitted
- */
-#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...)                               \
-	do {                                                                   \
-		static const u8 d[] = { cmd, seq };                            \
-		int ret;                                                       \
-		ret = mipi_dsi_dcs_write_buffer_chatty(dsi, d, ARRAY_SIZE(d)); \
-		if (ret < 0)                                                   \
-			return ret;                                            \
-	} while (0)
-
 /**
  * mipi_dsi_dcs_write_seq_multi - transmit a DCS command with payload
  *
Signature · 1 line
2.49.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq

Quoted 8 lines · Tejas Vipin

There are no remaining users of mipi_dsi_dcs_write_seq and it can be removed in favor of mipi_dsi_dcs_write_seq_multi.

---
 include/drm/drm_mipi_dsi.h | 22 ----------------------
 1 file changed, 22 deletions(-)

Nice!

Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#5 lore raw
In reply to Tejas Vipin

Hi,

Quoted 10 lines · Tejas Vipin

panel-samsung-sofef00 is the last remaining user of mipi_dsi_dcs_write_seq, so mipi_dsi_dcs_write_seq can be removed after the panel has been changed to use mipi_dsi_*_multi functions.

Tejas Vipin (2):
drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped
functions
drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq

[...]

Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next)

[1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions

      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/d6a4da523deba1814a45a593c271c32efedc39f3
[2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq
      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/61a0fc33b8538169eb30365b1598eaf33895c34f
Signature · 1 line
Neil