Skip to contentSkip to conversation

drm/msm: Remove clock and bandwidth votes in mdss pm suspend

PATCH In review Jayant Shekhar 2 participants 2 messages Jan 23, 2019 – Feb 17, 2019

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

PATCH 1/1 drm/msm: Remove clock and bandwidth votes in mdss pm suspend

MDSS PM suspend is dependent on runtime suspend for disabling clocks and removing bandwidth votes. In case of pm_suspend triggered, dpm_prepare hold a refcount on power usage of device and hence runtime suspend is never triggered during pm_suspend. As runtime suspend is not triggered, clocks and bandwidth votes remain. Hence explicitly trigger mdss disable in msm_pm_suspend to disable clocks and remove the votes.

---
 drivers/gpu/drm/msm/msm_drv.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +8 -0
index 5c60bb3..ffe3a25 100644
@@ -1068,12 +1068,16 @@ static int msm_pm_suspend(struct device *dev)
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct msm_drm_private *priv = ddev->dev_private;
+	struct msm_mdss *mdss = priv->mdss;
 
 	if (!IS_ERR_OR_NULL(priv->pm_state))
 		return 0;
 
 	priv->pm_state = drm_atomic_helper_suspend(ddev);
 
+	if (mdss && mdss->funcs)
+		mdss->funcs->disable(mdss);
+
 	return IS_ERR(priv->pm_state) ? PTR_ERR(priv->pm_state) : 0;
 }
 
@@ -1081,11 +1085,15 @@ static int msm_pm_resume(struct device *dev)
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct msm_drm_private *priv = ddev->dev_private;
+	struct msm_mdss *mdss = priv->mdss;
 	int ret;
 
 	if (IS_ERR_OR_NULL(priv->pm_state))
 		return 0;
 
+	if (mdss && mdss->funcs)
+		mdss->funcs->enable(mdss);
+
 	ret = drm_atomic_helper_resume(ddev, priv->pm_state);
 	if (ret == 0)
 		priv->pm_state = NULL;
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 22 lines · Jayant Shekhar

MDSS PM suspend is dependent on runtime suspend for disabling clocks and removing bandwidth votes. In case of pm_suspend triggered, dpm_prepare hold a refcount on power usage of device and hence runtime suspend is never triggered during pm_suspend. As runtime suspend is not triggered, clocks and bandwidth votes remain. Hence explicitly trigger mdss disable in msm_pm_suspend to disable clocks and remove the votes.

---
 drivers/gpu/drm/msm/msm_drv.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +0 -0
index 5c60bb3..ffe3a25 100644
@@ -1068,12 +1068,16 @@ static int msm_pm_suspend(struct device *dev)
 {
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct msm_drm_private *priv = ddev->dev_private;

drivers/gpu/drm/msm/msm_drv.c static int msm_pm_suspend(struct device *dev) · line 1080

Quoted 10 lines
drivers/gpu/drm/msm/msm_drv.c +4 -0
+       struct msm_mdss *mdss = priv->mdss;
 
        if (!IS_ERR_OR_NULL(priv->pm_state))
                return 0;
 
        priv->pm_state = drm_atomic_helper_suspend(ddev);
 
+       if (mdss && mdss->funcs)
+               mdss->funcs->disable(mdss);
+

This patch doesn't actually seem to apply, I guess it has a dependency on some other missing patch?

That said, shouldn't the refcount aquired in _prepare() be dropped somewhere? It seems like if all planes/crtcs/etc are disabled, we should also disable power (or at least as much as we can while still having hotplug work), so ideally drm_atomic_helper_suspend() should be enough.

BR.
-R

Quoted 20 lines
drivers/gpu/drm/msm/msm_drv.c +4 -1
        return IS_ERR(priv->pm_state) ? PTR_ERR(priv->pm_state) : 0;
 }
 
@@ -1081,11 +1085,15 @@ static int msm_pm_resume(struct device *dev)
 {
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct msm_drm_private *priv = ddev->dev_private;
+       struct msm_mdss *mdss = priv->mdss;
        int ret;
 
        if (IS_ERR_OR_NULL(priv->pm_state))
                return 0;
 
+       if (mdss && mdss->funcs)
+               mdss->funcs->enable(mdss);
+
        ret = drm_atomic_helper_resume(ddev, priv->pm_state);
        if (ret == 0)
                priv->pm_state = NULL;
--
Quoted 3 lines

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno