Skip to contentSkip to conversation

Elida KD35T133 Panel Improvements

PATCH Superseded Chris Morgan 2 participants 11 messages Nov 15, 2023 – Nov 16, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/4 drm/panel-elida-kd35t133: trival: update panel size from 5.5 to 3.5

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

The comments at the top of the driver state the panel size incorrectly as 5.5" instead of 3.5".

---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +1 -1
index e7be15b68102..6cd8536c09ff 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Elida kd35t133 5.5" MIPI-DSI panel driver
+ * Elida kd35t133 3.5" MIPI-DSI panel driver
  * Copyright (C) 2020 Theobroma Systems Design und Consulting GmbH
  *
  * based on
Signature · 1 line
2.34.1
#0 lore raw

cover Elida KD35T133 Panel Improvements

From: Chris Morgan <[email protected]>

Fix a few bugs and clean up no longer needed code on the Elida KD35T133 DSI panel, as used in devices such as the Odroid Go Advance and the Anbernic RG351M.

Chris Morgan (4):
drm/panel-elida-kd35t133: trival: update panel size from 5.5 to 3.5 drm/panel-elida-kd35t133: hold panel in reset for unprepare drm/panel-elida-kd35t133: drop
drm_connector_set_orientation_from_panel
drm/panel-elida-kd35t133: Drop prepare/unprepare logic

 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 37 ++------------------
 1 file changed, 3 insertions(+), 34 deletions(-)
Signature · 1 line
2.34.1
#7 lore raw

PATCH 3/4 drm/panel-elida-kd35t133: drop drm_connector_set_orientation_from_panel

From: Chris Morgan <[email protected]>

Stop calling drm_connector_set_orientation_from_panel() as its now called by the panel bridge directly when it is initialized.

---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +0 -5
index f1fc4a26f447..29b4ee63d83b 100644
@@ -211,11 +211,6 @@ static int kd35t133_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 	drm_mode_probed_add(connector, mode);
-	/*
-	 * TODO: Remove once all drm drivers call
-	 * drm_connector_set_orientation_from_panel()
-	 */
-	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/4 drm/panel-elida-kd35t133: hold panel in reset for unprepare

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

For devices like the Anbernic RG351M and RG351P the panel is wired to an always on regulator. When the device suspends and wakes up, there are some slight artifacts on the screen that go away over time. If instead we hold the panel in reset status after it is unprepared, this does not happen.

---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +2 -0
index 6cd8536c09ff..f1fc4a26f447 100644
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
 		return ret;
 	}
 
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
 	regulator_disable(ctx->iovcc);
 	regulator_disable(ctx->vdd);
 
Signature · 1 line
2.34.1
#9 lore raw

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

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

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.

---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 28 --------------------
 1 file changed, 28 deletions(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +0 -28
index 29b4ee63d83b..00791ea81e90 100644
@@ -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);
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] drm/panel-elida-kd35t133: trival: update panel size from 5.5 to 3.5

In reply to Chris Morgan
Quoted 6 lines · Chris Morgan

From: Chris Morgan <[email protected]>

The comments at the top of the driver state the panel size incorrectly as 5.5" instead of 3.5".

Quoted 19 lines
---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +1 -1
index e7be15b68102..6cd8536c09ff 100644
@@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0
  /*
- * Elida kd35t133 5.5" MIPI-DSI panel driver
+ * Elida kd35t133 3.5" MIPI-DSI panel driver
   * Copyright (C) 2020 Theobroma Systems Design und Consulting GmbH
   *
   * based on
Signature · 1 line
2.34.1
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] drm/panel-elida-kd35t133: hold panel in reset for unprepare

In reply to Chris Morgan
Quoted 7 lines · Chris Morgan

From: Chris Morgan <[email protected]>

For devices like the Anbernic RG351M and RG351P the panel is wired to an always on regulator. When the device suspends and wakes up, there are some slight artifacts on the screen that go away over time. If instead we hold the panel in reset status after it is unprepared, this does not happen.

Hi Chris,

LGTM, though if this is fixing something maybe we can add

Fixes 5b6603360c12 ("drm/panel: add panel driver for Elida KD35T133 panels")
Quoted 2 lines

Thanks,

Jessica Zhang

Quoted 20 lines
---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +2 -0
index 6cd8536c09ff..f1fc4a26f447 100644
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
  		return ret;
  	}
 
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
  	regulator_disable(ctx->iovcc);
  	regulator_disable(ctx->vdd);
 
Signature · 1 line
2.34.1
Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] drm/panel-elida-kd35t133: drop drm_connector_set_orientation_from_panel

In reply to Chris Morgan
Quoted 6 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Stop calling drm_connector_set_orientation_from_panel() as its now called by the panel bridge directly when it is initialized.

Quoted 23 lines
---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 5 -----
  1 file changed, 5 deletions(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +0 -5
index f1fc4a26f447..29b4ee63d83b 100644
@@ -211,11 +211,6 @@ static int kd35t133_get_modes(struct drm_panel *panel,
  	connector->display_info.width_mm = mode->width_mm;
  	connector->display_info.height_mm = mode->height_mm;
  	drm_mode_probed_add(connector, mode);
-	/*
-	 * TODO: Remove once all drm drivers call
-	 * drm_connector_set_orientation_from_panel()
-	 */
-	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
  	return 1;
  }
Signature · 1 line
2.34.1
#10 lore raw

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

In reply to Chris Morgan
Quoted 6 lines · Chris Morgan

From: Chris Morgan <[email protected]>

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")

Quoted 95 lines
---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 28 --------------------
  1 file changed, 28 deletions(-)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +0 -28
index 29b4ee63d83b..00791ea81e90 100644
@@ -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);
 
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH 2/4] drm/panel-elida-kd35t133: hold panel in reset for unprepare

In reply to Jessica Zhang
Quoted 11 lines · Jessica Zhang
Quoted 7 lines · Chris Morgan

From: Chris Morgan <[email protected]>

For devices like the Anbernic RG351M and RG351P the panel is wired to an always on regulator. When the device suspends and wakes up, there are some slight artifacts on the screen that go away over time. If instead we hold the panel in reset status after it is unprepared, this does not happen.

Quoted 6 lines

Hi Chris,

LGTM, though if this is fixing something maybe we can add

Fixes 5b6603360c12 ("drm/panel: add panel driver for Elida KD35T133

panels")

It *may* fix an intermittent issue with the panel resuming from suspend, but it really more solves an issue with devices for which we're still adding support.

Should I still tag it as a "fixes" then?

Thank you.

Quoted 28 lines
Quoted 3 lines

Thanks,

Jessica Zhang

Quoted 18 lines
---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +2 -0
index 6cd8536c09ff..f1fc4a26f447 100644
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
  		return ret;
  	}
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
  	regulator_disable(ctx->iovcc);
  	regulator_disable(ctx->vdd);
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH 2/4] drm/panel-elida-kd35t133: hold panel in reset for unprepare

Quoted 16 lines · Chris Morgan
Quoted 15 lines · Jessica Zhang
Quoted 7 lines · Chris Morgan

From: Chris Morgan <[email protected]>

For devices like the Anbernic RG351M and RG351P the panel is wired to an always on regulator. When the device suspends and wakes up, there are some slight artifacts on the screen that go away over time. If instead we hold the panel in reset status after it is unprepared, this does not happen.

Hi Chris,

LGTM, though if this is fixing something maybe we can add

Quoted 8 lines
Quoted 2 lines
Fixes 5b6603360c12 ("drm/panel: add panel driver for Elida KD35T133

panels")

It *may* fix an intermittent issue with the panel resuming from suspend, but it really more solves an issue with devices for which we're still adding support.

Should I still tag it as a "fixes" then?

From my understanding of the submitting patches docs [1], I think this warrants a "Fixes" since it's fixing an issue you're seeing with the original driver.

Thanks,

Jessica Zhang

[1] https://docs.kernel.org/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes

Quoted 31 lines

Thank you.

Quoted 28 lines
Quoted 3 lines

Thanks,

Jessica Zhang

Quoted 18 lines
---
   drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
   1 file changed, 2 insertions(+)
drivers/gpu/drm/panel/panel-elida-kd35t133.c +2 -0
index 6cd8536c09ff..f1fc4a26f447 100644
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
   		return ret;
   	}
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
   	regulator_disable(ctx->iovcc);
   	regulator_disable(ctx->vdd);
Signature · 1 line
2.34.1