diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-10-13 11:22:17 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-14 11:51:33 -0400 |
commit | 3e96dbfd5899c562e08c7ff27e5d5b21bb218e8a (patch) | |
tree | 0845e1f97f131a5ad715701b7656b0adc31d4e6c /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | da146d3b5262c1866c868b9dec1bd0f834d6ded6 (diff) |
drm/amdgpu: disable smu hw first on tear down
Otherwise, you can't disable dpm.
Tested-by and Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index fda0e57c5e0f..c5e6fc580662 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1437,6 +1437,30 @@ static int amdgpu_fini(struct amdgpu_device *adev) | |||
1437 | { | 1437 | { |
1438 | int i, r; | 1438 | int i, r; |
1439 | 1439 | ||
1440 | /* need to disable SMC first */ | ||
1441 | for (i = 0; i < adev->num_ip_blocks; i++) { | ||
1442 | if (!adev->ip_block_status[i].hw) | ||
1443 | continue; | ||
1444 | if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_SMC) { | ||
1445 | /* ungate blocks before hw fini so that we can shutdown the blocks safely */ | ||
1446 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, | ||
1447 | AMD_CG_STATE_UNGATE); | ||
1448 | if (r) { | ||
1449 | DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n", | ||
1450 | adev->ip_blocks[i].funcs->name, r); | ||
1451 | return r; | ||
1452 | } | ||
1453 | r = adev->ip_blocks[i].funcs->hw_fini((void *)adev); | ||
1454 | /* XXX handle errors */ | ||
1455 | if (r) { | ||
1456 | DRM_DEBUG("hw_fini of IP block <%s> failed %d\n", | ||
1457 | adev->ip_blocks[i].funcs->name, r); | ||
1458 | } | ||
1459 | adev->ip_block_status[i].hw = false; | ||
1460 | break; | ||
1461 | } | ||
1462 | } | ||
1463 | |||
1440 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { | 1464 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { |
1441 | if (!adev->ip_block_status[i].hw) | 1465 | if (!adev->ip_block_status[i].hw) |
1442 | continue; | 1466 | continue; |