All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	dri-devel@lists.freedesktop.org, Pavel Machek <pavel@ucw.cz>,
	linux-tegra@vger.kernel.org, Dmitry Osipenko <digetx@gmail.com>
Subject: [PATCH 2/2] drm/tegra: Allow runtime suspend on system sleep
Date: Thu, 28 Nov 2019 17:03:14 +0100	[thread overview]
Message-ID: <20191128160314.2381249-3-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191128160314.2381249-1-thierry.reding@gmail.com>

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
sleep.

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 --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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&dc->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&dsi->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&hdmi->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&hub->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	/*
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dmitry Osipenko <digetx@gmail.com>,
	linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-tegra@vger.kernel.org
Subject: [PATCH 2/2] drm/tegra: Allow runtime suspend on system sleep
Date: Thu, 28 Nov 2019 17:03:14 +0100	[thread overview]
Message-ID: <20191128160314.2381249-3-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191128160314.2381249-1-thierry.reding@gmail.com>

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
sleep.

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 --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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&dc->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&dsi->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&hdmi->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	INIT_LIST_HEAD(&hub->client.list);
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);
 	pm_runtime_enable(&pdev->dev);
 
 	/*
-- 
2.23.0


  parent reply	other threads:[~2019-11-28 16:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 16:03 [PATCH 0/2] PM / runtime: Allow drivers to override runtime PM behaviour on sleep Thierry Reding
2019-11-28 16:03 ` Thierry Reding
2019-11-28 16:03 ` [PATCH 1/2] " Thierry Reding
2019-11-28 16:03   ` Thierry Reding
2019-11-28 16:14   ` Rafael J. Wysocki
2019-11-28 16:14     ` Rafael J. Wysocki
2019-11-28 16:50     ` Thierry Reding
2019-11-28 16:50       ` Thierry Reding
2019-11-28 22:03       ` Rafael J. Wysocki
2019-11-28 22:03         ` Rafael J. Wysocki
2019-11-28 22:20         ` Rafael J. Wysocki
2019-11-28 22:20           ` Rafael J. Wysocki
2019-11-29 10:08           ` Thierry Reding
2019-11-29 10:08             ` Thierry Reding
2019-11-29 10:22             ` Rafael J. Wysocki
2019-11-29 10:22               ` Rafael J. Wysocki
2019-11-29 12:07               ` Thierry Reding
2019-11-29 12:07                 ` Thierry Reding
2019-11-29 20:27                 ` Daniel Vetter
2019-11-29 20:27                   ` Daniel Vetter
2019-12-04  0:02                 ` Rafael J. Wysocki
2019-12-04  0:02                   ` Rafael J. Wysocki
2019-11-29  9:33         ` Thierry Reding
2019-11-29  9:33           ` Thierry Reding
2019-11-29 10:09           ` Rafael J. Wysocki
2019-11-29 10:09             ` Rafael J. Wysocki
2019-11-29 11:44             ` Thierry Reding
2019-11-29 11:44               ` Thierry Reding
2019-11-28 16:03 ` Thierry Reding [this message]
2019-11-28 16:03   ` [PATCH 2/2] drm/tegra: Allow runtime suspend on system sleep Thierry Reding
2019-11-28 16:47 ` [PATCH 0/2] PM / runtime: Allow drivers to override runtime PM behaviour on sleep Daniel Vetter
2019-11-28 16:47   ` Daniel Vetter
2019-11-28 17:04   ` Thierry Reding
2019-11-28 17:04     ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191128160314.2381249-3-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=digetx@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.