drm/amdgpu: Power down acp if board uses AZ (v2)
[sfrench/cifs-2.6.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_acp.c
index 71efcf38f11beb2c628cee39ff4bae7fa50bedbd..d4d1738da3b66a2722b4e21672a511ba22b45846 100644 (file)
@@ -289,10 +289,12 @@ static int acp_hw_init(void *handle)
        r = amd_acp_hw_init(adev->acp.cgs_device,
                            ip_block->version->major, ip_block->version->minor);
        /* -ENODEV means board uses AZ rather than ACP */
-       if (r == -ENODEV)
+       if (r == -ENODEV) {
+               amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true);
                return 0;
-       else if (r)
+       } else if (r) {
                return r;
+       }
 
        if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289)
                return -EINVAL;
@@ -497,8 +499,10 @@ static int acp_hw_fini(void *handle)
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
        /* return early if no ACP */
-       if (!adev->acp.acp_cell)
+       if (!adev->acp.acp_cell) {
+               amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false);
                return 0;
+       }
 
        /* Assert Soft reset of ACP */
        val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
@@ -556,11 +560,21 @@ static int acp_hw_fini(void *handle)
 
 static int acp_suspend(void *handle)
 {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+       /* power up on suspend */
+       if (!adev->acp.acp_cell)
+               amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false);
        return 0;
 }
 
 static int acp_resume(void *handle)
 {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+       /* power down again on resume */
+       if (!adev->acp.acp_cell)
+               amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true);
        return 0;
 }