Commit 562b49fc authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu: simplify runtime suspend

In the standard _PR3 case, the pci core handles the pci state.
The driver only needs to handle it in the legacy ATPX case.

This may fix issues with runtime suspend/resume on certain
hybrid graphics laptops.
Acked-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7633c5e0
...@@ -1216,13 +1216,17 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) ...@@ -1216,13 +1216,17 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
ret = amdgpu_device_suspend(drm_dev, false, false); ret = amdgpu_device_suspend(drm_dev, false, false);
if (amdgpu_device_supports_boco(drm_dev)) { if (amdgpu_device_supports_boco(drm_dev)) {
pci_save_state(pdev); /* Only need to handle PCI state in the driver for ATPX
pci_disable_device(pdev); * PCI core handles it for _PR3.
pci_ignore_hotplug(pdev); */
if (amdgpu_is_atpx_hybrid()) if (amdgpu_is_atpx_hybrid()) {
pci_ignore_hotplug(pdev);
} else {
pci_save_state(pdev);
pci_disable_device(pdev);
pci_ignore_hotplug(pdev);
pci_set_power_state(pdev, PCI_D3cold); pci_set_power_state(pdev, PCI_D3cold);
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; drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
} else if (amdgpu_device_supports_baco(drm_dev)) { } else if (amdgpu_device_supports_baco(drm_dev)) {
amdgpu_device_baco_enter(drm_dev); amdgpu_device_baco_enter(drm_dev);
...@@ -1244,14 +1248,19 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) ...@@ -1244,14 +1248,19 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
if (amdgpu_device_supports_boco(drm_dev)) { 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() || /* Only need to handle PCI state in the driver for ATPX
!amdgpu_has_atpx_dgpu_power_cntl()) * PCI core handles it for _PR3.
*/
if (amdgpu_is_atpx_hybrid()) {
pci_set_master(pdev);
} else {
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev); pci_restore_state(pdev);
ret = pci_enable_device(pdev); ret = pci_enable_device(pdev);
if (ret) if (ret)
return ret; return ret;
pci_set_master(pdev); pci_set_master(pdev);
}
} else if (amdgpu_device_supports_baco(drm_dev)) { } else if (amdgpu_device_supports_baco(drm_dev)) {
amdgpu_device_baco_exit(drm_dev); amdgpu_device_baco_exit(drm_dev);
} }
......
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