Created
November 10, 2023 01:29
-
-
Save macromorgan/4bfa8bc6f95ed023a441f0c96bca81ea to your computer and use it in GitHub Desktop.
Elida KD35T133 Panel Improvements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d89363f8476e71d4dce9891fc7ab55db04530c02 Mon Sep 17 00:00:00 2001 | |
From: Chris Morgan <[email protected]> | |
Date: Thu, 9 Nov 2023 16:42:27 -0600 | |
Subject: [PATCH 0/4] Elida KD35T133 Panel Improvements | |
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(-) | |
-- | |
2.34.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2fb2cf01d53101cadf531577ce01deac83d0e2bf Mon Sep 17 00:00:00 2001 | |
From: Chris Morgan <[email protected]> | |
Date: Thu, 9 Nov 2023 15:56:28 -0600 | |
Subject: [PATCH 1/4] drm/panel-elida-kd35t133: trival: update panel size from | |
5.5 to 3.5 | |
The comments at the top of the driver state the panel size incorrectly | |
as 5.5" instead of 3.5". | |
Signed-off-by: Chris Morgan <[email protected]> | |
--- | |
drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
index e7be15b68102..6cd8536c09ff 100644 | |
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
@@ -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 | |
-- | |
2.34.1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 22b571a3aff7aaba3007844aa79ea9efa943c73a Mon Sep 17 00:00:00 2001 | |
From: Chris Morgan <[email protected]> | |
Date: Thu, 9 Nov 2023 16:07:30 -0600 | |
Subject: [PATCH 2/4] drm/panel-elida-kd35t133: hold panel in reset for | |
unprepare | |
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. | |
Signed-off-by: Chris Morgan <[email protected]> | |
--- | |
drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++ | |
1 file changed, 2 insertions(+) | |
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
index 6cd8536c09ff..f1fc4a26f447 100644 | |
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
@@ -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); | |
-- | |
2.34.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 42438341f8e88d6a96cbd07babe515d672b1715d Mon Sep 17 00:00:00 2001 | |
From: Chris Morgan <[email protected]> | |
Date: Thu, 9 Nov 2023 16:30:12 -0600 | |
Subject: [PATCH 3/4] drm/panel-elida-kd35t133: drop | |
drm_connector_set_orientation_from_panel | |
Stop calling drm_connector_set_orientation_from_panel() as its now | |
called by the panel bridge directly when it is initalized. | |
Signed-off-by: Chris Morgan <[email protected]> | |
--- | |
drivers/gpu/drm/panel/panel-elida-kd35t133.c | 5 ----- | |
1 file changed, 5 deletions(-) | |
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
index f1fc4a26f447..29b4ee63d83b 100644 | |
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c | |
@@ -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; | |
} | |
-- | |
2.34.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d89363f8476e71d4dce9891fc7ab55db04530c02 Mon Sep 17 00:00:00 2001 | |
From: Chris Morgan <[email protected]> | |
Date: Thu, 9 Nov 2023 16:38:53 -0600 | |
Subject: [PATCH 4/4] drm/panel-elida-kd35t133: Drop prepare/unprepare logic | |
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 <[email protected]> | |
--- | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment