drm/amdgpu: Ctrl gfx off via amdgpu_gfx_off_ctrl
authorRex Zhu <Rex.Zhu@amd.com>
Fri, 27 Jul 2018 06:55:09 +0000 (14:55 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 16:09:52 +0000 (11:09 -0500)
use amdgpu_gfx_off_ctrl function so driver can arbitrate
whether the gfx ip can be power off or power on.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index 82bc329919fecd4b8347448f07cdc80d4ef8fefb..6d0ffbf5b3377253e5bb4830f9baba09a180fef7 100644 (file)
@@ -1828,8 +1828,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
                                          adev->ip_blocks[i].version->funcs->name, r);
                                return r;
                        }
-                       if (adev->powerplay.pp_funcs->set_powergating_by_smu)
-                               amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false);
+                       amdgpu_gfx_off_ctrl(adev, false);
                        r = adev->ip_blocks[i].version->funcs->hw_fini((void *)adev);
                        /* XXX handle errors */
                        if (r) {
@@ -2012,8 +2011,7 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
        }
 
        /* call smu to disable gfx off feature first when suspend */
-       if (adev->powerplay.pp_funcs->set_powergating_by_smu)
-               amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false);
+       amdgpu_gfx_off_ctrl(adev, false);
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
                if (!adev->ip_blocks[i].status.valid)
index ef00d14f86453bb1e0c4fd3653be6bb144e412f1..fd31d3b27819c2c0028793661c33dc14a4f8eac0 100644 (file)
@@ -3783,13 +3783,11 @@ static int gfx_v9_0_set_powergating_state(void *handle,
                gfx_v9_0_update_gfx_mg_power_gating(adev, enable);
 
                /* set gfx off through smu */
-               if (enable && adev->powerplay.pp_funcs->set_powergating_by_smu)
-                       amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true);
+               amdgpu_gfx_off_ctrl(adev, true);
                break;
        case CHIP_VEGA12:
                /* set gfx off through smu */
-               if (enable && adev->powerplay.pp_funcs->set_powergating_by_smu)
-                       amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true);
+               amdgpu_gfx_off_ctrl(adev, true);
                break;
        default:
                break;