Skip to contentSkip to conversation

drm/tegra: output: Implement system suspend/resume

PATCH New Thierry Reding 1 participant 1 message Dec 3, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tegra: output: Implement system suspend/resume

From: Thierry Reding <[email protected]>

Implement generic system suspend/resume functions that can be used with any output type. Currently this only implements disabling and enabling of the IRQ functionality across system suspend/resume. This prevents an interrupt from happening before the display driver has fully resumed.

---
 drivers/gpu/drm/tegra/output.c | 16 ++++++++++++++++
 drivers/gpu/drm/tegra/sor.c    | 17 +++++++++++++++++
 2 files changed, 33 insertions(+)
drivers/gpu/drm/tegra/output.c +16 -0
index 34373734ff68..57203030dd02 100644
@@ -250,3 +250,19 @@ void tegra_output_find_possible_crtcs(struct tegra_output *output,
 
 	output->encoder.possible_crtcs = mask;
 }
+
+int tegra_output_suspend(struct tegra_output *output)
+{
+	if (output->hpd_irq)
+		disable_irq(output->hpd_irq);
+
+	return 0;
+}
+
+int tegra_output_resume(struct tegra_output *output)
+{
+	if (output->hpd_irq)
+		enable_irq(output->hpd_irq);
+
+	return 0;
+}
drivers/gpu/drm/tegra/sor.c +17 -0
index 200d99e17afe..572e18545505 100644
@@ -3995,9 +3995,16 @@ static int tegra_sor_suspend(struct device *dev)
 	struct tegra_sor *sor = dev_get_drvdata(dev);
 	int err;
 
+	err = tegra_output_suspend(&sor->output);
+	if (err < 0) {
+		dev_err(dev, "failed to suspend output: %d\n", err);
+		return err;
+	}
+
 	if (sor->hdmi_supply) {
 		err = regulator_disable(sor->hdmi_supply);
 		if (err < 0) {
+			tegra_output_resume(&sor->output);
 			return err;
 		}
 	}
@@ -4016,6 +4023,16 @@ static int tegra_sor_resume(struct device *dev)
 			return err;
 	}
 
+	err = tegra_output_resume(&sor->output);
+	if (err < 0) {
+		dev_err(dev, "failed to resume output: %d\n", err);
+
+		if (sor->hdmi_supply)
+			regulator_disable(sor->hdmi_supply);
+
+		return err;
+	}
+
 	return 0;
 }
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel