Skip to content

Commit 86e14a7

Browse files
Ma Junalexdeucher
authored andcommitted
drm/amdgpu: Use rpm_mode flag instead of checking it again for rpm
Because the rpm_mode flag is already set when the driver is initialized, we use it directly for runtime suspend/resume instead of checking it again Signed-off-by: Ma Jun <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent f317c5e commit 86e14a7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
26932693
}
26942694

26952695
adev->in_runpm = true;
2696-
if (amdgpu_device_supports_px(drm_dev))
2696+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
26972697
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
26982698

26992699
/*
@@ -2703,7 +2703,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
27032703
* platforms.
27042704
* TODO: this may be also needed for PX capable platform.
27052705
*/
2706-
if (amdgpu_device_supports_boco(drm_dev))
2706+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO)
27072707
adev->mp1_state = PP_MP1_STATE_UNLOAD;
27082708

27092709
ret = amdgpu_device_prepare(drm_dev);
@@ -2712,15 +2712,15 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
27122712
ret = amdgpu_device_suspend(drm_dev, false);
27132713
if (ret) {
27142714
adev->in_runpm = false;
2715-
if (amdgpu_device_supports_boco(drm_dev))
2715+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO)
27162716
adev->mp1_state = PP_MP1_STATE_NONE;
27172717
return ret;
27182718
}
27192719

2720-
if (amdgpu_device_supports_boco(drm_dev))
2720+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO)
27212721
adev->mp1_state = PP_MP1_STATE_NONE;
27222722

2723-
if (amdgpu_device_supports_px(drm_dev)) {
2723+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX) {
27242724
/* Only need to handle PCI state in the driver for ATPX
27252725
* PCI core handles it for _PR3.
27262726
*/
@@ -2729,9 +2729,9 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
27292729
pci_ignore_hotplug(pdev);
27302730
pci_set_power_state(pdev, PCI_D3cold);
27312731
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
2732-
} else if (amdgpu_device_supports_boco(drm_dev)) {
2732+
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO) {
27332733
/* nothing to do */
2734-
} else if (amdgpu_device_supports_baco(drm_dev)) {
2734+
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) {
27352735
amdgpu_device_baco_enter(drm_dev);
27362736
}
27372737

@@ -2754,7 +2754,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
27542754
if (!pci_device_is_present(adev->pdev))
27552755
adev->no_hw_access = true;
27562756

2757-
if (amdgpu_device_supports_px(drm_dev)) {
2757+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX) {
27582758
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
27592759

27602760
/* Only need to handle PCI state in the driver for ATPX
@@ -2766,22 +2766,22 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
27662766
if (ret)
27672767
return ret;
27682768
pci_set_master(pdev);
2769-
} else if (amdgpu_device_supports_boco(drm_dev)) {
2769+
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO) {
27702770
/* Only need to handle PCI state in the driver for ATPX
27712771
* PCI core handles it for _PR3.
27722772
*/
27732773
pci_set_master(pdev);
2774-
} else if (amdgpu_device_supports_baco(drm_dev)) {
2774+
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) {
27752775
amdgpu_device_baco_exit(drm_dev);
27762776
}
27772777
ret = amdgpu_device_resume(drm_dev, false);
27782778
if (ret) {
2779-
if (amdgpu_device_supports_px(drm_dev))
2779+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
27802780
pci_disable_device(pdev);
27812781
return ret;
27822782
}
27832783

2784-
if (amdgpu_device_supports_px(drm_dev))
2784+
if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
27852785
drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
27862786
adev->in_runpm = false;
27872787
return 0;

0 commit comments

Comments
 (0)