diff mbox series

[4/4] drm/panel-elida-kd35t133: Drop prepare/unprepare logic

Message ID 20231115152647.2303283-5-macroalpha82@gmail.com (mailing list archive)
State New, archived
Headers show
Series Elida KD35T133 Panel Improvements | expand

Commit Message

Chris Morgan Nov. 15, 2023, 3:26 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

Drop the prepare/unprepare logic, as this is now tracked elsewhere.
Additionally, the driver shutdown is also duplicate as it calls
drm_unprepare and drm_disable which are called anyway when
associated drivers are shutdown/removed.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 28 --------------------
 1 file changed, 28 deletions(-)

Comments

Jessica Zhang Nov. 15, 2023, 10:30 p.m. UTC | #1
On 11/15/2023 7:26 AM, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Drop the prepare/unprepare logic, as this is now tracked elsewhere.
> Additionally, the driver shutdown is also duplicate as it calls
> drm_unprepare and drm_disable which are called anyway when
> associated drivers are shutdown/removed.

Hi Chris,

In the commit message, can you mention that this [1] was the change that 
made tracking the prepared flag common?

Also, it seems to me that this patch squashes 2 different changes 
together. Maybe we can split this into 2 patches -- one to drop the 
prepared flag checks and another to drop shutdown().

Thanks,

Jessica Zhang

[1] d2aacaf07395 ("drm/panel: Check for already prepared/enabled in 
drm_panel")

> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>   drivers/gpu/drm/panel/panel-elida-kd35t133.c | 28 --------------------
>   1 file changed, 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
> index 29b4ee63d83b..00791ea81e90 100644
> --- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
> +++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
> @@ -43,7 +43,6 @@ struct kd35t133 {
>   	struct regulator *vdd;
>   	struct regulator *iovcc;
>   	enum drm_panel_orientation orientation;
> -	bool prepared;
>   };
>   
>   static inline struct kd35t133 *panel_to_kd35t133(struct drm_panel *panel)
> @@ -91,9 +90,6 @@ static int kd35t133_unprepare(struct drm_panel *panel)
>   	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
>   	int ret;
>   
> -	if (!ctx->prepared)
> -		return 0;
> -
>   	ret = mipi_dsi_dcs_set_display_off(dsi);
>   	if (ret < 0)
>   		dev_err(ctx->dev, "failed to set display off: %d\n", ret);
> @@ -109,8 +105,6 @@ static int kd35t133_unprepare(struct drm_panel *panel)
>   	regulator_disable(ctx->iovcc);
>   	regulator_disable(ctx->vdd);
>   
> -	ctx->prepared = false;
> -
>   	return 0;
>   }
>   
> @@ -120,9 +114,6 @@ static int kd35t133_prepare(struct drm_panel *panel)
>   	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
>   	int ret;
>   
> -	if (ctx->prepared)
> -		return 0;
> -
>   	dev_dbg(ctx->dev, "Resetting the panel\n");
>   	ret = regulator_enable(ctx->vdd);
>   	if (ret < 0) {
> @@ -166,8 +157,6 @@ static int kd35t133_prepare(struct drm_panel *panel)
>   
>   	msleep(50);
>   
> -	ctx->prepared = true;
> -
>   	return 0;
>   
>   disable_iovcc:
> @@ -296,27 +285,11 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
>   	return 0;
>   }
>   
> -static void kd35t133_shutdown(struct mipi_dsi_device *dsi)
> -{
> -	struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
> -	int ret;
> -
> -	ret = drm_panel_unprepare(&ctx->panel);
> -	if (ret < 0)
> -		dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret);
> -
> -	ret = drm_panel_disable(&ctx->panel);
> -	if (ret < 0)
> -		dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret);
> -}
> -
>   static void kd35t133_remove(struct mipi_dsi_device *dsi)
>   {
>   	struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
>   	int ret;
>   
> -	kd35t133_shutdown(dsi);
> -
>   	ret = mipi_dsi_detach(dsi);
>   	if (ret < 0)
>   		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
> @@ -337,7 +310,6 @@ static struct mipi_dsi_driver kd35t133_driver = {
>   	},
>   	.probe	= kd35t133_probe,
>   	.remove = kd35t133_remove,
> -	.shutdown = kd35t133_shutdown,
>   };
>   module_mipi_dsi_driver(kd35t133_driver);
>   
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 29b4ee63d83b..00791ea81e90 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -43,7 +43,6 @@  struct kd35t133 {
 	struct regulator *vdd;
 	struct regulator *iovcc;
 	enum drm_panel_orientation orientation;
-	bool prepared;
 };
 
 static inline struct kd35t133 *panel_to_kd35t133(struct drm_panel *panel)
@@ -91,9 +90,6 @@  static int kd35t133_unprepare(struct drm_panel *panel)
 	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
 	int ret;
 
-	if (!ctx->prepared)
-		return 0;
-
 	ret = mipi_dsi_dcs_set_display_off(dsi);
 	if (ret < 0)
 		dev_err(ctx->dev, "failed to set display off: %d\n", ret);
@@ -109,8 +105,6 @@  static int kd35t133_unprepare(struct drm_panel *panel)
 	regulator_disable(ctx->iovcc);
 	regulator_disable(ctx->vdd);
 
-	ctx->prepared = false;
-
 	return 0;
 }
 
@@ -120,9 +114,6 @@  static int kd35t133_prepare(struct drm_panel *panel)
 	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
 	int ret;
 
-	if (ctx->prepared)
-		return 0;
-
 	dev_dbg(ctx->dev, "Resetting the panel\n");
 	ret = regulator_enable(ctx->vdd);
 	if (ret < 0) {
@@ -166,8 +157,6 @@  static int kd35t133_prepare(struct drm_panel *panel)
 
 	msleep(50);
 
-	ctx->prepared = true;
-
 	return 0;
 
 disable_iovcc:
@@ -296,27 +285,11 @@  static int kd35t133_probe(struct mipi_dsi_device *dsi)
 	return 0;
 }
 
-static void kd35t133_shutdown(struct mipi_dsi_device *dsi)
-{
-	struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = drm_panel_unprepare(&ctx->panel);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret);
-
-	ret = drm_panel_disable(&ctx->panel);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret);
-}
-
 static void kd35t133_remove(struct mipi_dsi_device *dsi)
 {
 	struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
 	int ret;
 
-	kd35t133_shutdown(dsi);
-
 	ret = mipi_dsi_detach(dsi);
 	if (ret < 0)
 		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
@@ -337,7 +310,6 @@  static struct mipi_dsi_driver kd35t133_driver = {
 	},
 	.probe	= kd35t133_probe,
 	.remove = kd35t133_remove,
-	.shutdown = kd35t133_shutdown,
 };
 module_mipi_dsi_driver(kd35t133_driver);