]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/amd/pm: fix vclk setting failed for SMU v13.0.4
authorTim Huang <Tim.Huang@amd.com>
Wed, 7 Jun 2023 03:24:48 +0000 (11:24 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 16:47:37 +0000 (12:47 -0400)
PMFW use the left-shifted 16 bits argument to set the VCLK
DPM frequency for SMU v13.0.4.

Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c

index 5a99a091965e35af5a49750010f37a18a6375aa0..6a0ac0bbaace995764351cd19add1b25367cfa7d 100644 (file)
@@ -51,6 +51,8 @@
 #define CTF_OFFSET_HOTSPOT             5
 #define CTF_OFFSET_MEM                 5
 
+#define SMU_13_VCLK_SHIFT              16
+
 extern const int pmfw_decoded_link_speed[5];
 extern const int pmfw_decoded_link_width[7];
 
index 46a8a366f2879fcb13f38cf0b8faab237ebe102f..999b07db862e510fb32c3e5d3556a26753eeca68 100644 (file)
@@ -831,6 +831,8 @@ static int smu_v13_0_4_set_soft_freq_limited_range(struct smu_context *smu,
                                                   uint32_t max)
 {
        enum smu_message_type msg_set_min, msg_set_max;
+       uint32_t min_clk = min;
+       uint32_t max_clk = max;
        int ret = 0;
 
        if (!smu_v13_0_4_clk_dpm_is_enabled(smu, clk_type))
@@ -859,12 +861,17 @@ static int smu_v13_0_4_set_soft_freq_limited_range(struct smu_context *smu,
                return -EINVAL;
        }
 
-       ret = smu_cmn_send_smc_msg_with_param(smu, msg_set_min, min, NULL);
+       if (clk_type == SMU_VCLK) {
+               min_clk = min << SMU_13_VCLK_SHIFT;
+               max_clk = max << SMU_13_VCLK_SHIFT;
+       }
+
+       ret = smu_cmn_send_smc_msg_with_param(smu, msg_set_min, min_clk, NULL);
        if (ret)
                return ret;
 
        return smu_cmn_send_smc_msg_with_param(smu, msg_set_max,
-                                              max, NULL);
+                                              max_clk, NULL);
 }
 
 static int smu_v13_0_4_force_clk_levels(struct smu_context *smu,