Commit b97e9d47 authored by Alex Deucher's avatar Alex Deucher
Browse files

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
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
@@ -1208,10 +1208,12 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
		return -EBUSY;
	}

	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);
	if (amdgpu_device_supports_boco(drm_dev)) {
		pci_save_state(pdev);
		pci_disable_device(pdev);
		pci_ignore_hotplug(pdev);
@@ -1220,6 +1222,7 @@ 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;
	}

	return 0;
}
@@ -1233,6 +1236,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
	if (!amdgpu_device_supports_boco(drm_dev))
		return -EINVAL;

	if (amdgpu_device_supports_boco(drm_dev)) {
		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;

		if (amdgpu_is_atpx_hybrid() ||
@@ -1243,9 +1247,10 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
		if (ret)
			return ret;
		pci_set_master(pdev);

	}
	ret = amdgpu_device_resume(drm_dev, false, false);
	drm_kms_helper_poll_enable(drm_dev);
	if (amdgpu_device_supports_boco(drm_dev))
		drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
	return 0;
}