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: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
31af062acf
commit
b97e9d47e5
|
@ -1208,18 +1208,21 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
|
|||
return -EBUSY;
|
||||
}
|
||||
|
||||
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
|
||||
if (amdgpu_device_supports_boco(drm_dev))
|
||||
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
|
||||
drm_kms_helper_poll_disable(drm_dev);
|
||||
|
||||
ret = amdgpu_device_suspend(drm_dev, false, false);
|
||||
pci_save_state(pdev);
|
||||
pci_disable_device(pdev);
|
||||
pci_ignore_hotplug(pdev);
|
||||
if (amdgpu_is_atpx_hybrid())
|
||||
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;
|
||||
if (amdgpu_device_supports_boco(drm_dev)) {
|
||||
pci_save_state(pdev);
|
||||
pci_disable_device(pdev);
|
||||
pci_ignore_hotplug(pdev);
|
||||
if (amdgpu_is_atpx_hybrid())
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1233,20 +1236,22 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
|
|||
if (!amdgpu_device_supports_boco(drm_dev))
|
||||
return -EINVAL;
|
||||
|
||||
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
|
||||
|
||||
if (amdgpu_is_atpx_hybrid() ||
|
||||
!amdgpu_has_atpx_dgpu_power_cntl())
|
||||
pci_set_power_state(pdev, PCI_D0);
|
||||
pci_restore_state(pdev);
|
||||
ret = pci_enable_device(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
pci_set_master(pdev);
|
||||
if (amdgpu_device_supports_boco(drm_dev)) {
|
||||
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
|
||||
|
||||
if (amdgpu_is_atpx_hybrid() ||
|
||||
!amdgpu_has_atpx_dgpu_power_cntl())
|
||||
pci_set_power_state(pdev, PCI_D0);
|
||||
pci_restore_state(pdev);
|
||||
ret = pci_enable_device(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
pci_set_master(pdev);
|
||||
}
|
||||
ret = amdgpu_device_resume(drm_dev, false, false);
|
||||
drm_kms_helper_poll_enable(drm_dev);
|
||||
drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
|
||||
if (amdgpu_device_supports_boco(drm_dev))
|
||||
drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue