[2/2] drm/tegra: Allow runtime suspend on system sleep
diff mbox series

Message ID 20191128160314.2381249-3-thierry.reding@gmail.com
State Rejected
Headers show
  • PM / runtime: Allow drivers to override runtime PM behaviour on sleep
Related show

Commit Message

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

By default the PM core prevents devices from being runtime suspended
during system sleep. This is needed to avoid some common cases where
devices cannot be properly resumed because their parents are runtime
suspended at an unfortunate point in time.

However, there are cases where suspend/resume works in a way that it
becomes possible for devices to be runtime suspended at system sleep
time. In fact, for some devices runtime suspension can be equivalent
to their state in system sleep.

Typically this would be solved by making the runtime suspend/resume
callbacks the same as the system suspend/resume callbacks. For some
subsystems it isn't quite that simple, unfortunately.

For example, the DRM subsystem has subsystem-level suspend/resume
helpers that control how display pipelines are shut down on suspend
and brought up again on resume. This procedure is the same as their
operation under normal circumstances (when the user switches on/off
a subset of the displays in their configuration). These helpers are
carefully ordering the operations to make sure the right sequences
between connectors, encoders and display controllers are respected.

In order for suspend/resume to not get in the way of the sequencing
that's already happening at the subsystem level, allow the devices
involved in the display pipelines to runtime suspend during system

Signed-off-by: Thierry Reding <treding@nvidia.com>
 drivers/gpu/drm/tegra/dc.c   | 1 +
 drivers/gpu/drm/tegra/dsi.c  | 1 +
 drivers/gpu/drm/tegra/hdmi.c | 1 +
 drivers/gpu/drm/tegra/hub.c  | 1 +
 drivers/gpu/drm/tegra/sor.c  | 1 +
 5 files changed, 5 insertions(+)

diff mbox series

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 2b9a25c977c0..386819b4662b 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2506,6 +2506,7 @@  static int tegra_dc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, dc);
+	pm_runtime_always_allow(&pdev->dev);
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index a5d47e301c5f..683a27f9ba52 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1552,6 +1552,7 @@  static int tegra_dsi_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, dsi);
+	pm_runtime_always_allow(&pdev->dev);
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 50269ffbcb6b..2562bf607be1 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1664,6 +1664,7 @@  static int tegra_hdmi_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, hdmi);
+	pm_runtime_always_allow(&pdev->dev);
diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
index e56c0f7d3a13..aced537ac990 100644
--- a/drivers/gpu/drm/tegra/hub.c
+++ b/drivers/gpu/drm/tegra/hub.c
@@ -844,6 +844,7 @@  static int tegra_display_hub_probe(struct platform_device *pdev)
 		return err;
 	platform_set_drvdata(pdev, hub);
+	pm_runtime_always_allow(&pdev->dev);
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index a68d3b36b972..20058f11bf81 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -3833,6 +3833,7 @@  static int tegra_sor_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, sor);
+	pm_runtime_always_allow(&pdev->dev);