drm/amdgpu: add baco support to runtime suspend/resume
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 4 Oct 2019 17:54:12 +0000 (12:54 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Nov 2019 21:42:52 +0000 (16:42 -0500)
BACO - Bus Active, Chip Off

This adds the necessary support to the runtime suspend
and resume functions to handle boards that support
baco.

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

index 47b51588c762d9c4ee1266779f4cd5413cca3f24..43070973d6a6707044a8f0b1ee20011423ebbd2d 100644 (file)
@@ -1155,7 +1155,8 @@ static int amdgpu_pmops_resume(struct device *dev)
        struct drm_device *drm_dev = dev_get_drvdata(dev);
 
        /* GPU comes up enabled by the bios on resume */
-       if (amdgpu_device_supports_boco(drm_dev)) {
+       if (amdgpu_device_supports_boco(drm_dev) ||
+           amdgpu_device_supports_baco(drm_dev)) {
                pm_runtime_disable(dev);
                pm_runtime_set_active(dev);
                pm_runtime_enable(dev);
@@ -1222,6 +1223,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
                else if (!amdgpu_has_atpx_dgpu_power_cntl())
                        pci_set_power_state(pdev, PCI_D3hot);
                drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
+       } else if (amdgpu_device_supports_baco(drm_dev)) {
+               amdgpu_device_baco_enter(drm_dev);
        }
 
        return 0;
@@ -1247,6 +1250,8 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
                if (ret)
                        return ret;
                pci_set_master(pdev);
+       } else if (amdgpu_device_supports_baco(drm_dev)) {
+               amdgpu_device_baco_exit(drm_dev);
        }
        ret = amdgpu_device_resume(drm_dev, false, false);
        drm_kms_helper_poll_enable(drm_dev);