Re: [RFC PATCH 01/10] drm/panel: Don't store+check prepared/enabled for simple cases

2023-09-13 Thread Doug Anderson
Hi,

On Fri, Aug 4, 2023 at 2:07 PM Douglas Anderson  wrote:
>
> As talked about in commit d2aacaf07395 ("drm/panel: Check for already
> prepared/enabled in drm_panel"), we want to remove needless code from
> panel drivers that was storing and double-checking the
> prepared/enabled state. Even if someone was relying on the
> double-check before, that double-check is now in the core and not
> needed in individual drivers.
>
> This pile of panel drivers appears to be simple to handle. Based on
> code inspection they seemed to be using the prepared/enabled state
> simply for double-checking that nothing else in the kernel called them
> inconsistently. Now that the core drm_panel is doing the double
> checking (and warning) it should be very clear that these devices
> don't need their own double-check.
>
> Signed-off-by: Douglas Anderson 
> ---
>
>  .../drm/panel/panel-asus-z00t-tm5p5-n35596.c  |  9 -
>  .../gpu/drm/panel/panel-boe-bf060y8m-aj0.c|  9 -
>  drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c  |  9 -
>  drivers/gpu/drm/panel/panel-novatek-nt35950.c |  9 -
>  drivers/gpu/drm/panel/panel-novatek-nt36523.c | 12 --
>  drivers/gpu/drm/panel/panel-raydium-rm68200.c | 38 ---
>  .../panel/panel-samsung-s6e88a0-ams452ef01.c  | 10 -
>  drivers/gpu/drm/panel/panel-samsung-sofef00.c |  9 -
>  .../gpu/drm/panel/panel-sharp-ls060t1sx01.c   | 10 -
>  drivers/gpu/drm/panel/panel-sony-td4353-jdi.c |  9 -
>  .../panel/panel-sony-tulip-truly-nt35521.c| 18 -
>  .../drm/panel/panel-startek-kd070fhfid015.c   | 11 --
>  drivers/gpu/drm/panel/panel-truly-nt35597.c   | 20 --
>  drivers/gpu/drm/panel/panel-visionox-r66451.c | 16 
>  .../gpu/drm/panel/panel-visionox-rm69299.c|  8 
>  .../gpu/drm/panel/panel-visionox-vtdr6130.c   |  9 -
>  16 files changed, 206 deletions(-)

In response to the cover letter [1], I proposed landing patches #1-#3
directly from here while we resolve the issues talked about in
response to patch #4 [2]. I didn't hear any complaints, so I took
Linus W's review tag from the cover letter and pushed this to
drm-misc-next.

f8c37b88092e drm/panel: Don't store+check prepared/enabled for simple cases

[1] 
https://lore.kernel.org/r/CAD=FV=ufuusrrzmkl8_rl5wlvkjrydwrsay_pwta-hx_p0d...@mail.gmail.com
[2] 
https://lore.kernel.org/r/20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid/


[RFC PATCH 01/10] drm/panel: Don't store+check prepared/enabled for simple cases

2023-08-04 Thread Douglas Anderson
As talked about in commit d2aacaf07395 ("drm/panel: Check for already
prepared/enabled in drm_panel"), we want to remove needless code from
panel drivers that was storing and double-checking the
prepared/enabled state. Even if someone was relying on the
double-check before, that double-check is now in the core and not
needed in individual drivers.

This pile of panel drivers appears to be simple to handle. Based on
code inspection they seemed to be using the prepared/enabled state
simply for double-checking that nothing else in the kernel called them
inconsistently. Now that the core drm_panel is doing the double
checking (and warning) it should be very clear that these devices
don't need their own double-check.

Signed-off-by: Douglas Anderson 
---

 .../drm/panel/panel-asus-z00t-tm5p5-n35596.c  |  9 -
 .../gpu/drm/panel/panel-boe-bf060y8m-aj0.c|  9 -
 drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c  |  9 -
 drivers/gpu/drm/panel/panel-novatek-nt35950.c |  9 -
 drivers/gpu/drm/panel/panel-novatek-nt36523.c | 12 --
 drivers/gpu/drm/panel/panel-raydium-rm68200.c | 38 ---
 .../panel/panel-samsung-s6e88a0-ams452ef01.c  | 10 -
 drivers/gpu/drm/panel/panel-samsung-sofef00.c |  9 -
 .../gpu/drm/panel/panel-sharp-ls060t1sx01.c   | 10 -
 drivers/gpu/drm/panel/panel-sony-td4353-jdi.c |  9 -
 .../panel/panel-sony-tulip-truly-nt35521.c| 18 -
 .../drm/panel/panel-startek-kd070fhfid015.c   | 11 --
 drivers/gpu/drm/panel/panel-truly-nt35597.c   | 20 --
 drivers/gpu/drm/panel/panel-visionox-r66451.c | 16 
 .../gpu/drm/panel/panel-visionox-rm69299.c|  8 
 .../gpu/drm/panel/panel-visionox-vtdr6130.c   |  9 -
 16 files changed, 206 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c 
b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
index 075a7af81eff..bcaa63d1955f 100644
--- a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
+++ b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
@@ -16,7 +16,6 @@ struct tm5p5_nt35596 {
struct mipi_dsi_device *dsi;
struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio;
-   bool prepared;
 };
 
 static inline struct tm5p5_nt35596 *to_tm5p5_nt35596(struct drm_panel *panel)
@@ -112,9 +111,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel)
struct device *dev = >dsi->dev;
int ret;
 
-   if (ctx->prepared)
-   return 0;
-
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
if (ret < 0) {
dev_err(dev, "Failed to enable regulators: %d\n", ret);
@@ -132,7 +128,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel)
return ret;
}
 
-   ctx->prepared = true;
return 0;
 }
 
@@ -142,9 +137,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
struct device *dev = >dsi->dev;
int ret;
 
-   if (!ctx->prepared)
-   return 0;
-
ret = tm5p5_nt35596_off(ctx);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
@@ -153,7 +145,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies),
   ctx->supplies);
 
-   ctx->prepared = false;
return 0;
 }
 
diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c 
b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
index 90098b753e3b..e77db8597eb7 100644
--- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
+++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
@@ -34,7 +34,6 @@ struct boe_bf060y8m_aj0 {
struct mipi_dsi_device *dsi;
struct regulator_bulk_data vregs[BF060Y8M_VREG_MAX];
struct gpio_desc *reset_gpio;
-   bool prepared;
 };
 
 static inline
@@ -129,9 +128,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
struct device *dev = >dsi->dev;
int ret;
 
-   if (boe->prepared)
-   return 0;
-
/*
 * Enable EL Driving Voltage first - doing that at the beginning
 * or at the end of the power sequence doesn't matter, so enable
@@ -166,7 +162,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
return ret;
}
 
-   boe->prepared = true;
return 0;
 
 err_vci:
@@ -186,9 +181,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel 
*panel)
struct device *dev = >dsi->dev;
int ret;
 
-   if (!boe->prepared)
-   return 0;
-
ret = boe_bf060y8m_aj0_off(boe);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
@@ -196,7 +188,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel 
*panel)
gpiod_set_value_cansleep(boe->reset_gpio, 1);
ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs);
 
-   boe->prepared =