linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions
@ 2025-01-06  4:11 Tejas Vipin
  2025-01-06 17:25 ` neil.armstrong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tejas Vipin @ 2025-01-06  4:11 UTC (permalink / raw)
  To: jo, neil.armstrong, maarten.lankhorst, mripard, tzimmermann,
	airlied, simona
  Cc: quic_jesszhan, dianders, dri-devel, linux-kernel, Tejas Vipin

Changes the ebbg-ft8719 panel to use multi style functions for
improved error handling.

Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
---
 drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 67 ++++++-----------------
 1 file changed, 16 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
index e85d63a176d0..0bfed0ec0bbc 100644
--- a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
+++ b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
@@ -57,65 +57,39 @@ static void ebbg_ft8719_reset(struct ebbg_ft8719 *ctx)
 static int ebbg_ft8719_on(struct ebbg_ft8719 *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_brightness(dsi, 0x00ff);
-	if (ret < 0) {
-		dev_err(dev, "Failed to set display brightness: %d\n", ret);
-		return ret;
-	}
+	mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x00ff);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24);
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
 
-	mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24);
-	mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
+	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
+	mipi_dsi_msleep(&dsi_ctx, 90);
+	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
 
-	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
-		return ret;
-	}
-	msleep(90);
-
-	ret = mipi_dsi_dcs_set_display_on(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to set display on: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
+	return dsi_ctx.accum_err;
 }
 
 static int ebbg_ft8719_off(struct ebbg_ft8719 *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;
-	}
-	usleep_range(10000, 11000);
-
-	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(90);
+	mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
+	mipi_dsi_usleep_range(&dsi_ctx, 10000, 11000);
+	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
+	mipi_dsi_msleep(&dsi_ctx, 90);
 
-	return 0;
+	return dsi_ctx.accum_err;
 }
 
 static int ebbg_ft8719_prepare(struct drm_panel *panel)
 {
 	struct ebbg_ft8719 *ctx = to_ebbg_ft8719(panel);
-	struct device *dev = &ctx->dsi->dev;
 	int ret;
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
@@ -126,7 +100,6 @@ static int ebbg_ft8719_prepare(struct drm_panel *panel)
 
 	ret = ebbg_ft8719_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;
 	}
@@ -137,18 +110,10 @@ static int ebbg_ft8719_prepare(struct drm_panel *panel)
 static int ebbg_ft8719_unprepare(struct drm_panel *panel)
 {
 	struct ebbg_ft8719 *ctx = to_ebbg_ft8719(panel);
-	struct device *dev = &ctx->dsi->dev;
-	int ret;
-
-	ret = ebbg_ft8719_off(ctx);
-	if (ret < 0)
-		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
 
+	ebbg_ft8719_off(ctx);
 	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
-
-	ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
-	if (ret)
-		dev_err(panel->dev, "Failed to disable regulators: %d\n", ret);
+	regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
 
 	return 0;
 }
-- 
2.47.1


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

* Re: [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions
  2025-01-06  4:11 [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions Tejas Vipin
@ 2025-01-06 17:25 ` neil.armstrong
  2025-01-07  0:54 ` Doug Anderson
  2025-01-13 16:34 ` Doug Anderson
  2 siblings, 0 replies; 4+ messages in thread
From: neil.armstrong @ 2025-01-06 17:25 UTC (permalink / raw)
  To: Tejas Vipin, jo, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona
  Cc: quic_jesszhan, dianders, dri-devel, linux-kernel

On 06/01/2025 05:11, Tejas Vipin wrote:
> Changes the ebbg-ft8719 panel to use multi style functions for
> improved error handling.
> 
> Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
> ---
>   drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 67 ++++++-----------------
>   1 file changed, 16 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
> index e85d63a176d0..0bfed0ec0bbc 100644
> --- a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
> +++ b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
> @@ -57,65 +57,39 @@ static void ebbg_ft8719_reset(struct ebbg_ft8719 *ctx)
>   static int ebbg_ft8719_on(struct ebbg_ft8719 *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_brightness(dsi, 0x00ff);
> -	if (ret < 0) {
> -		dev_err(dev, "Failed to set display brightness: %d\n", ret);
> -		return ret;
> -	}
> +	mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x00ff);
> +	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24);
> +	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
>   
> -	mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24);
> -	mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
> +	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
> +	mipi_dsi_msleep(&dsi_ctx, 90);
> +	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
>   
> -	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> -	if (ret < 0) {
> -		dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
> -		return ret;
> -	}
> -	msleep(90);
> -
> -	ret = mipi_dsi_dcs_set_display_on(dsi);
> -	if (ret < 0) {
> -		dev_err(dev, "Failed to set display on: %d\n", ret);
> -		return ret;
> -	}
> -
> -	return 0;
> +	return dsi_ctx.accum_err;
>   }
>   
>   static int ebbg_ft8719_off(struct ebbg_ft8719 *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;
> -	}
> -	usleep_range(10000, 11000);
> -
> -	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(90);
> +	mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
> +	mipi_dsi_usleep_range(&dsi_ctx, 10000, 11000);
> +	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
> +	mipi_dsi_msleep(&dsi_ctx, 90);
>   
> -	return 0;
> +	return dsi_ctx.accum_err;
>   }
>   
>   static int ebbg_ft8719_prepare(struct drm_panel *panel)
>   {
>   	struct ebbg_ft8719 *ctx = to_ebbg_ft8719(panel);
> -	struct device *dev = &ctx->dsi->dev;
>   	int ret;
>   
>   	ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
> @@ -126,7 +100,6 @@ static int ebbg_ft8719_prepare(struct drm_panel *panel)
>   
>   	ret = ebbg_ft8719_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;
>   	}
> @@ -137,18 +110,10 @@ static int ebbg_ft8719_prepare(struct drm_panel *panel)
>   static int ebbg_ft8719_unprepare(struct drm_panel *panel)
>   {
>   	struct ebbg_ft8719 *ctx = to_ebbg_ft8719(panel);
> -	struct device *dev = &ctx->dsi->dev;
> -	int ret;
> -
> -	ret = ebbg_ft8719_off(ctx);
> -	if (ret < 0)
> -		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
>   
> +	ebbg_ft8719_off(ctx);
>   	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> -
> -	ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
> -	if (ret)
> -		dev_err(panel->dev, "Failed to disable regulators: %d\n", ret);
> +	regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
>   
>   	return 0;
>   }

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

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

* Re: [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions
  2025-01-06  4:11 [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions Tejas Vipin
  2025-01-06 17:25 ` neil.armstrong
@ 2025-01-07  0:54 ` Doug Anderson
  2025-01-13 16:34 ` Doug Anderson
  2 siblings, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2025-01-07  0:54 UTC (permalink / raw)
  To: Tejas Vipin
  Cc: jo, neil.armstrong, maarten.lankhorst, mripard, tzimmermann,
	airlied, simona, quic_jesszhan, dri-devel, linux-kernel

Hi,

On Sun, Jan 5, 2025 at 8:11 PM Tejas Vipin <tejasvipin76@gmail.com> wrote:
>
> Changes the ebbg-ft8719 panel to use multi style functions for
> improved error handling.
>
> Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
> ---
>  drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 67 ++++++-----------------
>  1 file changed, 16 insertions(+), 51 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

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

* Re: [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions
  2025-01-06  4:11 [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions Tejas Vipin
  2025-01-06 17:25 ` neil.armstrong
  2025-01-07  0:54 ` Doug Anderson
@ 2025-01-13 16:34 ` Doug Anderson
  2 siblings, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2025-01-13 16:34 UTC (permalink / raw)
  To: Tejas Vipin
  Cc: jo, neil.armstrong, maarten.lankhorst, mripard, tzimmermann,
	airlied, simona, quic_jesszhan, dri-devel, linux-kernel

Hi,

On Sun, Jan 5, 2025 at 8:11 PM Tejas Vipin <tejasvipin76@gmail.com> wrote:
>
> Changes the ebbg-ft8719 panel to use multi style functions for
> improved error handling.
>
> Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
> ---
>  drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 67 ++++++-----------------
>  1 file changed, 16 insertions(+), 51 deletions(-)

Pushed to drm-misc-next:

[1/1] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions
      commit: 0d6c9edf9e5b25361bb23a151ad162878ecd81a5

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

end of thread, other threads:[~2025-01-13 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06  4:11 [PATCH] drm/panel: ebbg-ft8719: transition to mipi_dsi wrapped functions Tejas Vipin
2025-01-06 17:25 ` neil.armstrong
2025-01-07  0:54 ` Doug Anderson
2025-01-13 16:34 ` Doug Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).