Add ip version check to use smu_v13_0_12 specific functions

Signed-off-by: Asad Kamal <asad.ka...@amd.com>
Reviewed-by: Lijo Lazar <lijo.la...@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index 8d845b5912c5..96fb6c111ea5 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -748,7 +748,8 @@ static int smu_v13_0_6_setup_driver_pptable(struct 
smu_context *smu)
        int ret, i, retry = 100;
        uint32_t table_version;
 
-       if (smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
+       if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12) 
&&
+           smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
                return smu_v13_0_12_setup_driver_pptable(smu);
 
        /* Store one-time values in driver PPTable */
@@ -1131,7 +1132,8 @@ static int smu_v13_0_6_get_smu_metrics_data(struct 
smu_context *smu,
        if (ret)
                return ret;
 
-       if (smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
+       if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12) 
&&
+           smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
                return smu_v13_0_12_get_smu_metrics_data(smu, member, value);
 
        /* For clocks with multiple instances, only report the first one */
@@ -2496,7 +2498,8 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct 
smu_context *smu, void **table
                return ret;
        }
 
-       if (smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
+       if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12) 
&&
+           smu_v13_0_6_cap_supported(smu, SMU_CAP(STATIC_METRICS)))
                return smu_v13_0_12_get_gpu_metrics(smu, table);
 
        metrics_v1 = (MetricsTableV1_t *)metrics_v0;
-- 
2.46.0

Reply via email to