[PATCH] drm/omap: force runtime PM suspend on system suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use suspend_late and resume_early callbacks in DSS submodules to force
runtime PM suspend and resume.

We use suspend_late callback so that omapdrm's system suspend callback
is called first, as that will disable all the display outputs after
which it's safe to force DSS into suspend.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
---

Not fully tested, as I haven't been able to get AM4's system suspend to
work. Works with pm_test.

 drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 16 ++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/dss.c   | 16 ++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/venc.c  | 16 ++++++++++++++++
 4 files changed, 64 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index dbb90f2d2ccd..1c9057d7db7b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -4933,9 +4933,25 @@ static int dispc_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int dispc_suspend_late(struct device *dev)
+{
+	pm_runtime_force_suspend(dev);
+
+	return 0;
+}
+
+static int dispc_resume_early(struct device *dev)
+{
+	pm_runtime_force_resume(dev);
+
+	return 0;
+}
+
 static const struct dev_pm_ops dispc_pm_ops = {
 	.runtime_suspend = dispc_runtime_suspend,
 	.runtime_resume = dispc_runtime_resume,
+	.suspend_late = dispc_suspend_late,
+	.resume_early = dispc_resume_early,
 };
 
 struct platform_driver omap_dispchw_driver = {
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 79ddfbfd1b58..bae954dc8a5b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5464,9 +5464,25 @@ static int dsi_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int dsi_suspend_late(struct device *dev)
+{
+	pm_runtime_force_suspend(dev);
+
+	return 0;
+}
+
+static int dsi_resume_early(struct device *dev)
+{
+	pm_runtime_force_resume(dev);
+
+	return 0;
+}
+
 static const struct dev_pm_ops dsi_pm_ops = {
 	.runtime_suspend = dsi_runtime_suspend,
 	.runtime_resume = dsi_runtime_resume,
+	.suspend_late = dsi_suspend_late,
+	.resume_early = dsi_resume_early,
 };
 
 struct platform_driver omap_dsihw_driver = {
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 4d5739fa4a5d..65be4918db0c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1611,9 +1611,25 @@ static int dss_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int dss_suspend_late(struct device *dev)
+{
+	pm_runtime_force_suspend(dev);
+
+	return 0;
+}
+
+static int dss_resume_early(struct device *dev)
+{
+	pm_runtime_force_resume(dev);
+
+	return 0;
+}
+
 static const struct dev_pm_ops dss_pm_ops = {
 	.runtime_suspend = dss_runtime_suspend,
 	.runtime_resume = dss_runtime_resume,
+	.suspend_late = dss_suspend_late,
+	.resume_early = dss_resume_early,
 };
 
 struct platform_driver omap_dsshw_driver = {
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 766553bb2f87..3abc7e329121 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -942,9 +942,25 @@ static int venc_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int venc_suspend_late(struct device *dev)
+{
+	pm_runtime_force_suspend(dev);
+
+	return 0;
+}
+
+static int venc_resume_early(struct device *dev)
+{
+	pm_runtime_force_resume(dev);
+
+	return 0;
+}
+
 static const struct dev_pm_ops venc_pm_ops = {
 	.runtime_suspend = venc_runtime_suspend,
 	.runtime_resume = venc_runtime_resume,
+	.suspend_late = venc_suspend_late,
+	.resume_early = venc_resume_early,
 };
 
 static const struct of_device_id venc_of_match[] = {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux