diff mbox series

[v6,15/18] video: tegra20: dsi: add reset support

Message ID 20240123171633.246057-16-clamor95@gmail.com
State Accepted
Commit 6c4dc8965959c17c314c4b1519aa999ae0651467
Delegated to: Anatolij Gustschin
Headers show
Series Add T114 video support | expand

Commit Message

Svyatoslav Ryhel Jan. 23, 2024, 5:16 p.m. UTC
Implement reset use to discard any changes which could have been
applied to DSI before and can interfere with current configuration.

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-dsi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Thierry Reding April 19, 2024, 4:52 p.m. UTC | #1
On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> Implement reset use to discard any changes which could have been
> applied to DSI before and can interfere with current configuration.
>
> 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-dsi.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/video/tegra20/tegra-dsi.c b/drivers/video/tegra20/tegra-dsi.c
> index 25a629535e..fc9ca1310a 100644
> --- a/drivers/video/tegra20/tegra-dsi.c
> +++ b/drivers/video/tegra20/tegra-dsi.c
> @@ -12,6 +12,7 @@
>  #include <mipi_dsi.h>
>  #include <backlight.h>
>  #include <panel.h>
> +#include <reset.h>
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/time.h>
> @@ -863,6 +864,7 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
>  	struct tegra_dsi_priv *priv = dev_get_priv(dev);
>  	struct mipi_dsi_device *device = &priv->device;
>  	struct mipi_dsi_panel_plat *mipi_plat;
> +	struct reset_ctl reset_ctl;
>  	int ret;
>  
>  	priv->version = dev_get_driver_data(dev);
> @@ -876,6 +878,13 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
>  	priv->video_fifo_depth = 480;
>  	priv->host_fifo_depth = 64;
>  
> +	ret = reset_get_by_name(dev, "dsi", &reset_ctl);
> +	if (ret) {
> +		log_debug("%s: reset_get_by_name() failed: %d\n",
> +			  __func__, ret);
> +		return ret;
> +	}
> +
>  	ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
>  					   "avdd-dsi-csi-supply", &priv->avdd);
>  	if (ret)
> @@ -914,12 +923,17 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
>  
>  	tegra_dsi_get_format(device->format, &priv->format);
>  
> +	reset_assert(&reset_ctl);
> +
>  	ret = regulator_set_enable_if_allowed(priv->avdd, true);
>  	if (ret && ret != -ENOSYS)
>  		return ret;
>  
>  	tegra_dsi_init_clocks(dev);
>  
> +	mdelay(2);
> +	reset_deassert(&reset_ctl);
> +
>  	return 0;
>  }

Looks like tegra_dsi_init_clocks() already does the mdelay() and
reset_deassert()? Or perhaps I'm again looking at things in the wrong
order?

Thierry
diff mbox series

Patch

diff --git a/drivers/video/tegra20/tegra-dsi.c b/drivers/video/tegra20/tegra-dsi.c
index 25a629535e..fc9ca1310a 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -12,6 +12,7 @@ 
 #include <mipi_dsi.h>
 #include <backlight.h>
 #include <panel.h>
+#include <reset.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/time.h>
@@ -863,6 +864,7 @@  static int tegra_dsi_bridge_probe(struct udevice *dev)
 	struct tegra_dsi_priv *priv = dev_get_priv(dev);
 	struct mipi_dsi_device *device = &priv->device;
 	struct mipi_dsi_panel_plat *mipi_plat;
+	struct reset_ctl reset_ctl;
 	int ret;
 
 	priv->version = dev_get_driver_data(dev);
@@ -876,6 +878,13 @@  static int tegra_dsi_bridge_probe(struct udevice *dev)
 	priv->video_fifo_depth = 480;
 	priv->host_fifo_depth = 64;
 
+	ret = reset_get_by_name(dev, "dsi", &reset_ctl);
+	if (ret) {
+		log_debug("%s: reset_get_by_name() failed: %d\n",
+			  __func__, ret);
+		return ret;
+	}
+
 	ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
 					   "avdd-dsi-csi-supply", &priv->avdd);
 	if (ret)
@@ -914,12 +923,17 @@  static int tegra_dsi_bridge_probe(struct udevice *dev)
 
 	tegra_dsi_get_format(device->format, &priv->format);
 
+	reset_assert(&reset_ctl);
+
 	ret = regulator_set_enable_if_allowed(priv->avdd, true);
 	if (ret && ret != -ENOSYS)
 		return ret;
 
 	tegra_dsi_init_clocks(dev);
 
+	mdelay(2);
+	reset_deassert(&reset_ctl);
+
 	return 0;
 }