Commit b97e9d47 authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu: add additional boco checks to runtime suspend/resume (v2)

BACO - Bus Active, Chip Off
BOCO - Bus Off, Chip Off

We will take slightly different paths for boco and baco.

v2: fold together two consecutive if clauses

Reviewed-by: Evan Quan <evan.quan@amd.com> (v1)
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 31af062a
...@@ -1208,10 +1208,12 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) ...@@ -1208,10 +1208,12 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
return -EBUSY; return -EBUSY;
} }
if (amdgpu_device_supports_boco(drm_dev))
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
drm_kms_helper_poll_disable(drm_dev); drm_kms_helper_poll_disable(drm_dev);
ret = amdgpu_device_suspend(drm_dev, false, false); ret = amdgpu_device_suspend(drm_dev, false, false);
if (amdgpu_device_supports_boco(drm_dev)) {
pci_save_state(pdev); pci_save_state(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_ignore_hotplug(pdev); pci_ignore_hotplug(pdev);
...@@ -1220,6 +1222,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) ...@@ -1220,6 +1222,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
else if (!amdgpu_has_atpx_dgpu_power_cntl()) else if (!amdgpu_has_atpx_dgpu_power_cntl())
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
}
return 0; return 0;
} }
...@@ -1233,6 +1236,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) ...@@ -1233,6 +1236,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
if (!amdgpu_device_supports_boco(drm_dev)) if (!amdgpu_device_supports_boco(drm_dev))
return -EINVAL; return -EINVAL;
if (amdgpu_device_supports_boco(drm_dev)) {
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
if (amdgpu_is_atpx_hybrid() || if (amdgpu_is_atpx_hybrid() ||
...@@ -1243,9 +1247,10 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) ...@@ -1243,9 +1247,10 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
if (ret) if (ret)
return ret; return ret;
pci_set_master(pdev); pci_set_master(pdev);
}
ret = amdgpu_device_resume(drm_dev, false, false); ret = amdgpu_device_resume(drm_dev, false, false);
drm_kms_helper_poll_enable(drm_dev); drm_kms_helper_poll_enable(drm_dev);
if (amdgpu_device_supports_boco(drm_dev))
drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment