drm/amd/pm: reverse mclk and fclk clocks levels for SMU v13.0.4
authorjsg <jsg@openbsd.org>
Mon, 19 Jun 2023 00:39:44 +0000 (00:39 +0000)
committerjsg <jsg@openbsd.org>
Mon, 19 Jun 2023 00:39:44 +0000 (00:39 +0000)
From Tim Huang
00abb872ef0f82dde131b9bd12096100bb24d9ba in linux-6.1.y/6.1.33
6a07826f2057b5fa1c479ba56460195882464270 in mainline linux

sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c

index 8fa9a36..6d9760e 100644 (file)
@@ -478,7 +478,7 @@ static int smu_v13_0_4_get_dpm_level_count(struct smu_context *smu,
 static int smu_v13_0_4_print_clk_levels(struct smu_context *smu,
                                        enum smu_clk_type clk_type, char *buf)
 {
-       int i, size = 0, ret = 0;
+       int i, idx, size = 0, ret = 0;
        uint32_t cur_value = 0, value = 0, count = 0;
        uint32_t min, max;
 
@@ -512,7 +512,8 @@ static int smu_v13_0_4_print_clk_levels(struct smu_context *smu,
                        break;
 
                for (i = 0; i < count; i++) {
-                       ret = smu_v13_0_4_get_dpm_freq_by_index(smu, clk_type, i, &value);
+                       idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i;
+                       ret = smu_v13_0_4_get_dpm_freq_by_index(smu, clk_type, idx, &value);
                        if (ret)
                                break;