On X1E80100 (Dell XPS 13 9345), commit d9108bfdb746 ("drm/msm/a6xx: Fix
stale rpmh votes after suspend") appears to turn poweroff into a reboot.
It seems to happen when the GPU RSC/PDC is asleep at system off, i.e.
when the GPU was idle before shutdown. Keeping the GPU awake until
shutdown avoids it.

Resume the GPU in adreno_shutdown() and skip the RSC sleep in the final
stop. Suspend and runtime suspend are unchanged.

Tested on X1E80100 only: poweroff and reboot on AC and battery, and
deep suspend still drops the GPU votes.

Fixes: d9108bfdb746 ("drm/msm/a6xx: Fix stale rpmh votes after suspend")
Signed-off-by: Michael Burch <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c      | 4 ++++
 drivers/gpu/drm/msm/adreno/adreno_device.c | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 6d49c51df1a2..42a96ff51e5e 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -645,6 +645,10 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
        if (!test_and_clear_bit(GMU_STATUS_FW_START, &gmu->status))
                return;
 
+       /* Some platforms reboot instead of powering off if the GPU PDC is 
asleep */
+       if (system_state == SYSTEM_POWER_OFF || system_state == SYSTEM_HALT)
+               return;
+
        if (adreno_is_a840(adreno_gpu))
                bitmask = BIT(30);
 
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 05c77fe27e62..224ab3fd14bd 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -290,6 +290,11 @@ static void adreno_remove(struct platform_device *pdev)
 
 static void adreno_shutdown(struct platform_device *pdev)
 {
+       /* Resuming wakes the GMU RSC/PDC; the final stop then leaves it awake 
*/
+       if (dev_to_gpu(&pdev->dev) &&
+           (system_state == SYSTEM_POWER_OFF || system_state == SYSTEM_HALT))
+               pm_runtime_get_sync(&pdev->dev);
+
        WARN_ON_ONCE(adreno_system_suspend(&pdev->dev));
 }
 

base-commit: 3f2425f5b5bbbdd991ca9cdfd5502e68d8895998
-- 
2.55.0

Reply via email to