diff mbox series

[9/9] drm/tegra: sor: Make the +5V HDMI supply optional

Message ID 20191128153741.2380419-10-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/tegra: Miscellaneous fixes | expand

Commit Message

Thierry Reding Nov. 28, 2019, 3:37 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

The SOR supports multiple display modes, but only when driving an HDMI
monitor does it make sense to control the +5V power supply. eDP and DP
don't need this, so make it optional.

This fixes a crash observed during system suspend/resume.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/tegra/sor.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Daniel Vetter Nov. 29, 2019, 9:24 a.m. UTC | #1
On Thu, Nov 28, 2019 at 04:37:41PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> The SOR supports multiple display modes, but only when driving an HDMI
> monitor does it make sense to control the +5V power supply. eDP and DP
> don't need this, so make it optional.
> 
> This fixes a crash observed during system suspend/resume.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/tegra/sor.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 2200f4cd397a..a68d3b36b972 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -3970,15 +3970,29 @@ static int tegra_sor_runtime_resume(struct device *dev)
>  static int tegra_sor_suspend(struct device *dev)
>  {
>  	struct tegra_sor *sor = dev_get_drvdata(dev);
> +	int err;
> +
> +	if (sor->hdmi_supply) {
> +		err = regulator_disable(sor->hdmi_supply);
> +		if (err < 0)
> +			return err;
> +	}
>  
> -	return regulator_disable(sor->hdmi_supply);
> +	return 0;
>  }
>  
>  static int tegra_sor_resume(struct device *dev)
>  {
>  	struct tegra_sor *sor = dev_get_drvdata(dev);
> +	int err;
> +
> +	if (sor->hdmi_supply) {
> +		err = regulator_enable(sor->hdmi_supply);
> +		if (err < 0)
> +			return err;
> +	}
>  
> -	return regulator_enable(sor->hdmi_supply);
> +	return 0;
>  }
>  
>  static const struct dev_pm_ops tegra_sor_pm_ops = {
> -- 
> 2.23.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 2200f4cd397a..a68d3b36b972 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -3970,15 +3970,29 @@  static int tegra_sor_runtime_resume(struct device *dev)
 static int tegra_sor_suspend(struct device *dev)
 {
 	struct tegra_sor *sor = dev_get_drvdata(dev);
+	int err;
+
+	if (sor->hdmi_supply) {
+		err = regulator_disable(sor->hdmi_supply);
+		if (err < 0)
+			return err;
+	}
 
-	return regulator_disable(sor->hdmi_supply);
+	return 0;
 }
 
 static int tegra_sor_resume(struct device *dev)
 {
 	struct tegra_sor *sor = dev_get_drvdata(dev);
+	int err;
+
+	if (sor->hdmi_supply) {
+		err = regulator_enable(sor->hdmi_supply);
+		if (err < 0)
+			return err;
+	}
 
-	return regulator_enable(sor->hdmi_supply);
+	return 0;
 }
 
 static const struct dev_pm_ops tegra_sor_pm_ops = {