]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: add supports_baco callback for soc15 asics. (v2)
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Oct 2019 20:23:31 +0000 (16:23 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Nov 2019 21:42:46 +0000 (16:42 -0500)
BACO - Bus Active, Chip Off

Check the BACO capabilities from the powerplay table.

v2: drop unrelated struct cleanup

Reviewed-by: Evan Quan <evan.quan@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/soc15.c

index 1d19812a5c389c7448a40b9a7c4ab8c99969a096..36aa400de7745472e4e943c99fbb0aa3db92f857 100644 (file)
@@ -602,6 +602,28 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
        }
 }
 
+static bool soc15_supports_baco(struct amdgpu_device *adev)
+{
+       bool baco_support;
+
+       switch (adev->asic_type) {
+       case CHIP_VEGA10:
+       case CHIP_VEGA12:
+               soc15_asic_get_baco_capability(adev, &baco_support);
+               break;
+       case CHIP_VEGA20:
+               if (adev->psp.sos_fw_version >= 0x80067)
+                       soc15_asic_get_baco_capability(adev, &baco_support);
+               else
+                       baco_support = false;
+               break;
+       default:
+               return false;
+       }
+
+       return baco_support;
+}
+
 /*static int soc15_set_uvd_clock(struct amdgpu_device *adev, u32 clock,
                        u32 cntl_reg, u32 status_reg)
 {
@@ -1004,6 +1026,7 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs =
        .get_pcie_usage = &soc15_get_pcie_usage,
        .need_reset_on_init = &soc15_need_reset_on_init,
        .get_pcie_replay_count = &soc15_get_pcie_replay_count,
+       .supports_baco = &soc15_supports_baco,
 };
 
 static const struct amdgpu_asic_funcs vega20_asic_funcs =
@@ -1025,6 +1048,7 @@ static const struct amdgpu_asic_funcs vega20_asic_funcs =
        .get_pcie_usage = &vega20_get_pcie_usage,
        .need_reset_on_init = &soc15_need_reset_on_init,
        .get_pcie_replay_count = &soc15_get_pcie_replay_count,
+       .supports_baco = &soc15_supports_baco,
 };
 
 static int soc15_common_early_init(void *handle)