Skip to contentSkip to conversation

drm/msm: call drm_atomic_helper_suspend() and drm_atomic_helper_resume()

PATCH Superseded Daniel Mack 1 participant 2 messages May 16, 2018

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

PATCH 1/2 drm/msm: call drm_atomic_helper_suspend() and drm_atomic_helper_resume()

To make suspend and resume work on msm8916 platforms, call into the generic helpers and preserve the state across suspends.

---
 drivers/gpu/drm/msm/msm_drv.c | 9 +++++++++
 drivers/gpu/drm/msm/msm_drv.h | 1 +
 2 files changed, 10 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +9 -0
index 0a3ea3034e39..cdbe9249bff2 100644
@@ -907,16 +907,25 @@ static struct drm_driver msm_driver = {
 static int msm_pm_suspend(struct device *dev)
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
+	struct msm_drm_private *priv = ddev->dev_private;
 
 	drm_kms_helper_poll_disable(ddev);
 
+	priv->pm_state = drm_atomic_helper_suspend(ddev);
+	if (IS_ERR(priv->pm_state)) {
+		drm_kms_helper_poll_enable(ddev);
+		return PTR_ERR(priv->pm_state);
+	}
+
 	return 0;
 }
 
 static int msm_pm_resume(struct device *dev)
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
+	struct msm_drm_private *priv = ddev->dev_private;
 
+	drm_atomic_helper_resume(ddev, priv->pm_state);
 	drm_kms_helper_poll_enable(ddev);
 
 	return 0;
drivers/gpu/drm/msm/msm_drv.h +1 -0
index 0a653dd2e618..459d06a1ab9f 100644
@@ -155,6 +155,7 @@ struct msm_drm_private {
 	struct shrinker shrinker;
 
 	struct msm_vblank_ctrl vblank_ctrl;
+	struct drm_atomic_state *pm_state;
 };
 
 struct msm_format {
Signature · 6 lines
2.14.3

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

PATCH 2/2 drm/msm/adreno: Add power management functions for system sleep

When a msm8016 based system is woken up from suspend, the firmware in the adreno device hangs.

[   83.903416] qcom-iommu-ctx 1f09000.iommu-ctx: Unhandled context fault: fsr=0x202, iova=0x0000000000000000, fsynr=0x2, cb=1
[   85.853633] msm 1a00000.mdss: A306: hangcheck detected gpu lockup rb 0!
[   85.853661] msm 1a00000.mdss: A306:     completed fence: 370
[   85.859073] msm 1a00000.mdss: A306:     submitted fence: 372
[   85.865113] msm 1a00000.mdss: A306: hangcheck recover!

Fix this by adding pm_runtime_force_suspend/pm_runtime_force_resume as sleep ops.

---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/adreno/adreno_device.c +1 -0
index 05022ea2a007..12d87ccdec53 100644
@@ -357,6 +357,7 @@ static int adreno_suspend(struct device *dev)
 #endif
 
 static const struct dev_pm_ops adreno_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 	SET_RUNTIME_PM_OPS(adreno_suspend, adreno_resume, NULL)
 };
 
Signature · 6 lines
2.14.3

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