diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-07-19 12:48:36 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-27 12:09:42 -0400 |
commit | be2d6aa51e66625f93d3ba1eb817cd33d8136c60 (patch) | |
tree | 58e889b6e51dfbeda6d2da62ada972b0eb2f5587 /drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | |
parent | 982976d92f17aa8ff5d7a4d09fab4608795d12f3 (diff) |
drm/amdgpu: Power down acp if board uses AZ (v2)
if board uses AZ rather than ACP, we power down acp
through smu to save power.
v2: handle S3/S4 and hw_fini (Alex)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-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_acp.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index 71efcf38f11b..d4d1738da3b6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | |||
@@ -289,10 +289,12 @@ static int acp_hw_init(void *handle) | |||
289 | r = amd_acp_hw_init(adev->acp.cgs_device, | 289 | r = amd_acp_hw_init(adev->acp.cgs_device, |
290 | ip_block->version->major, ip_block->version->minor); | 290 | ip_block->version->major, ip_block->version->minor); |
291 | /* -ENODEV means board uses AZ rather than ACP */ | 291 | /* -ENODEV means board uses AZ rather than ACP */ |
292 | if (r == -ENODEV) | 292 | if (r == -ENODEV) { |
293 | amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true); | ||
293 | return 0; | 294 | return 0; |
294 | else if (r) | 295 | } else if (r) { |
295 | return r; | 296 | return r; |
297 | } | ||
296 | 298 | ||
297 | if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289) | 299 | if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289) |
298 | return -EINVAL; | 300 | return -EINVAL; |
@@ -497,8 +499,10 @@ static int acp_hw_fini(void *handle) | |||
497 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 499 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
498 | 500 | ||
499 | /* return early if no ACP */ | 501 | /* return early if no ACP */ |
500 | if (!adev->acp.acp_cell) | 502 | if (!adev->acp.acp_cell) { |
503 | amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false); | ||
501 | return 0; | 504 | return 0; |
505 | } | ||
502 | 506 | ||
503 | /* Assert Soft reset of ACP */ | 507 | /* Assert Soft reset of ACP */ |
504 | val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET); | 508 | val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET); |
@@ -556,11 +560,21 @@ static int acp_hw_fini(void *handle) | |||
556 | 560 | ||
557 | static int acp_suspend(void *handle) | 561 | static int acp_suspend(void *handle) |
558 | { | 562 | { |
563 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | ||
564 | |||
565 | /* power up on suspend */ | ||
566 | if (!adev->acp.acp_cell) | ||
567 | amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false); | ||
559 | return 0; | 568 | return 0; |
560 | } | 569 | } |
561 | 570 | ||
562 | static int acp_resume(void *handle) | 571 | static int acp_resume(void *handle) |
563 | { | 572 | { |
573 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | ||
574 | |||
575 | /* power down again on resume */ | ||
576 | if (!adev->acp.acp_cell) | ||
577 | amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true); | ||
564 | return 0; | 578 | return 0; |
565 | } | 579 | } |
566 | 580 | ||