mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it
@ 2025-04-19  4:12 Tejas Vipin
  2025-04-19  4:12 ` [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions Tejas Vipin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tejas Vipin @ 2025-04-19  4:12 UTC (permalink / raw)
  To: neil.armstrong, maarten.lankhorst, mripard, tzimmermann, airlied, simona
  Cc: quic_jesszhan, dianders, dri-devel, linux-kernel, asrivats, 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

 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 70 ++++++-------------
 include/drm/drm_mipi_dsi.h                    | 22 ------
 2 files changed, 21 insertions(+), 71 deletions(-)

-- 
2.49.0


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

* [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions
  2025-04-19  4:12 [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Tejas Vipin
@ 2025-04-19  4:12 ` Tejas Vipin
  2025-04-21  8:27   ` Dmitry Baryshkov
  2025-04-19  4:12 ` [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq Tejas Vipin
  2025-04-22  7:38 ` [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Neil Armstrong
  2 siblings, 1 reply; 6+ messages in thread
From: Tejas Vipin @ 2025-04-19  4:12 UTC (permalink / raw)
  To: neil.armstrong, maarten.lankhorst, mripard, tzimmermann, airlied, simona
  Cc: quic_jesszhan, dianders, dri-devel, linux-kernel, asrivats, Tejas Vipin

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

Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 70 ++++++-------------
 1 file changed, 21 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
index 04ce925b3d9d..e20c85d5d9e1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -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;
-- 
2.49.0


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

* [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq
  2025-04-19  4:12 [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Tejas Vipin
  2025-04-19  4:12 ` [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions Tejas Vipin
@ 2025-04-19  4:12 ` Tejas Vipin
  2025-04-21  8:27   ` Dmitry Baryshkov
  2025-04-22  7:38 ` [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Neil Armstrong
  2 siblings, 1 reply; 6+ messages in thread
From: Tejas Vipin @ 2025-04-19  4:12 UTC (permalink / raw)
  To: neil.armstrong, maarten.lankhorst, mripard, tzimmermann, airlied, simona
  Cc: quic_jesszhan, dianders, dri-devel, linux-kernel, asrivats, 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.

Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
---
 include/drm/drm_mipi_dsi.h | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index bd40a443385c..0d6e0d03d802 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -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
  *
-- 
2.49.0


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

* Re: [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions
  2025-04-19  4:12 ` [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions Tejas Vipin
@ 2025-04-21  8:27   ` Dmitry Baryshkov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2025-04-21  8:27 UTC (permalink / raw)
  To: Tejas Vipin
  Cc: neil.armstrong, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, quic_jesszhan, dianders, dri-devel, linux-kernel,
	asrivats

On Sat, Apr 19, 2025 at 09:42:09AM +0530, Tejas Vipin wrote:
> Changes the samsung-sofef00 panel to use multi style functions for
> improved error handling.
> 
> Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
> ---
>  drivers/gpu/drm/panel/panel-samsung-sofef00.c | 70 ++++++-------------
>  1 file changed, 21 insertions(+), 49 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

-- 
With best wishes
Dmitry

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

* Re: [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq
  2025-04-19  4:12 ` [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq Tejas Vipin
@ 2025-04-21  8:27   ` Dmitry Baryshkov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2025-04-21  8:27 UTC (permalink / raw)
  To: Tejas Vipin
  Cc: neil.armstrong, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, quic_jesszhan, dianders, dri-devel, linux-kernel,
	asrivats

On Sat, Apr 19, 2025 at 09:42:10AM +0530, Tejas Vipin wrote:
> 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.
> 
> Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
> ---
>  include/drm/drm_mipi_dsi.h | 22 ----------------------
>  1 file changed, 22 deletions(-)
> 

Nice!

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

-- 
With best wishes
Dmitry

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

* Re: [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it
  2025-04-19  4:12 [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Tejas Vipin
  2025-04-19  4:12 ` [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions Tejas Vipin
  2025-04-19  4:12 ` [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq Tejas Vipin
@ 2025-04-22  7:38 ` Neil Armstrong
  2 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2025-04-22  7:38 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann, airlied, simona, Tejas Vipin
  Cc: quic_jesszhan, dianders, dri-devel, linux-kernel, asrivats

Hi,

On Sat, 19 Apr 2025 09:42:08 +0530, Tejas Vipin wrote:
> 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

-- 
Neil


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

end of thread, other threads:[~2025-04-22  7:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-19  4:12 [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Tejas Vipin
2025-04-19  4:12 ` [PATCH 1/2] drm/panel: panel-samsung-sofef00: transition to mipi_dsi wrapped functions Tejas Vipin
2025-04-21  8:27   ` Dmitry Baryshkov
2025-04-19  4:12 ` [PATCH 2/2] drm/mipi-dsi: Remove mipi_dsi_dcs_write_seq Tejas Vipin
2025-04-21  8:27   ` Dmitry Baryshkov
2025-04-22  7:38 ` [PATCH 0/2] Transition remaining mipi_dsi_dcs_write_seq commands and remove it Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®