]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/pm: print pp_dpm_mclk in ascending order on SMU v14.0.0
authorTim Huang <tim.huang@amd.com>
Mon, 28 Oct 2024 05:51:50 +0000 (13:51 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 11 Nov 2024 19:05:39 +0000 (14:05 -0500)
Currently, the pp_dpm_mclk values are reported in descending order
on SMU IP v14.0.0/1/4. Adjust to ascending order for consistency
with other clock interfaces.

Signed-off-by: Tim Huang <tim.huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit d4be16ccfd5bf822176740a51ff2306679a2247e)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c

index 8798ebfcea8328a424c873e7c91dca7308cbf1bf..84f9b007b59f2eab19604f1204d6cd9d8f9e656f 100644 (file)
@@ -1132,7 +1132,7 @@ static int smu_v14_0_common_get_dpm_level_count(struct smu_context *smu,
 static int smu_v14_0_0_print_clk_levels(struct smu_context *smu,
                                        enum smu_clk_type clk_type, char *buf)
 {
-       int i, size = 0, ret = 0;
+       int i, idx, ret = 0, size = 0;
        uint32_t cur_value = 0, value = 0, count = 0;
        uint32_t min, max;
 
@@ -1168,7 +1168,8 @@ static int smu_v14_0_0_print_clk_levels(struct smu_context *smu,
                        break;
 
                for (i = 0; i < count; i++) {
-                       ret = smu_v14_0_common_get_dpm_freq_by_index(smu, clk_type, i, &value);
+                       idx = (clk_type == SMU_MCLK) ? (count - i - 1) : i;
+                       ret = smu_v14_0_common_get_dpm_freq_by_index(smu, clk_type, idx, &value);
                        if (ret)
                                break;