[PATCH v6 06/18] video: tegra20: dc: add reset support

Svyatoslav Ryhel
2024-01-23T17:18:32Z

Implement reset use to discard any changes which could have been
applied to DC before and can interfere with current configuration.

Tested-by: Agneli <poczt@protonmail.ch> # Toshiba AC100 T20
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101
Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS Grouper E1565
Tested-by: Ion Agorria <ion@agorria.com> # HTC One X
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # Nvidia Tegratab T114
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/video/tegra20/tegra-dc.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c
index 56a23b3c97..35abb6fe46 100644
--- a/drivers/video/tegra20/tegra-dc.c
+++ b/drivers/video/tegra20/tegra-dc.c
@@ -10,7 +10,9 @@
#include <panel.h>
#include <part.h>
#include <pwm.h>
+#include <reset.h>
#include <video.h>
+#include <linux/delay.h>
#include <asm/cache.h>
#include <asm/global_data.h>
#include <asm/system.h>
@@ -342,6 +344,7 @@ static int tegra_lcd_probe(struct udevice *dev)
struct video_uc_plat *plat = dev_get_uclass_plat(dev);
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
struct tegra_lcd_priv *priv = dev_get_priv(dev);
+ struct reset_ctl reset_ctl;
int ret;

/* Initialize the Tegra display controller */
@@ -349,6 +352,20 @@ static int tegra_lcd_probe(struct udevice *dev)
funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT);
#endif

+ ret = reset_get_by_name(dev, "dc", &reset_ctl);
+ if (ret) {
+ log_err("reset_get_by_name() failed: %d\n", ret);
+ return ret;
+ }
+
+ clock_disable(priv->dc_clk[0]);
+
+ /* Reset everything set before */
+ reset_assert(&reset_ctl);
+ mdelay(4);
+ reset_deassert(&reset_ctl);
+ mdelay(4);
+
if (tegra_display_probe(priv, (void *)plat->base)) {
debug("%s: Failed to probe display driver\n", __func__);
return -1;
--
2.40.1