drm/amdgpu: add flag for runtime suspend
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 7 Feb 2020 14:46:23 +0000 (09:46 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 11 Feb 2020 16:51:52 +0000 (11:51 -0500)
So we know whether we in are in runtime suspend or
system suspend.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index da3bcff..7c740e3 100644 (file)
@@ -969,6 +969,7 @@ struct amdgpu_device {
        int                             pstate;
        /* enable runtime pm on the device */
        bool                            runpm;
+       bool                            in_runpm;
 
        bool                            pm_sysfs_en;
        bool                            ucode_sysfs_en;
index a9c4edc..9043fb7 100644 (file)
@@ -1220,6 +1220,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
                }
        }
 
+       adev->in_runpm = true;
        if (amdgpu_device_supports_boco(drm_dev))
                drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
        drm_kms_helper_poll_disable(drm_dev);
@@ -1278,6 +1279,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
        drm_kms_helper_poll_enable(drm_dev);
        if (amdgpu_device_supports_boco(drm_dev))
                drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
+       adev->in_runpm = false;
        return 0;
 }