]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: fix smu v13 soft clock frequency setting issue
authorYang Wang <kevinyang.wang@amd.com>
Wed, 21 Jan 2026 03:04:06 +0000 (11:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 27 Jan 2026 23:08:44 +0000 (18:08 -0500)
v1:
resolve the issue where some freq frequencies cannot be set correctly
due to insufficient floating-point precision.

v2:
patch this convert on 'max' value only.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@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.c

index efeaa3d577123a8e07f236903a529334fcb10b69..b0d6b7b0946d858ed44198795f60b7d5ab7edb7a 100644 (file)
@@ -55,6 +55,7 @@
 #define SMUQ10_TO_UINT(x) ((x) >> 10)
 #define SMUQ10_FRAC(x) ((x) & 0x3ff)
 #define SMUQ10_ROUND(x) ((SMUQ10_TO_UINT(x)) + ((SMUQ10_FRAC(x)) >= 0x200))
+#define SMU_V13_SOFT_FREQ_ROUND(x)     ((x) + 1)
 
 extern const int pmfw_decoded_link_speed[5];
 extern const int pmfw_decoded_link_width[7];
index 51f96fdcec24b59610989c197bbde622d8afff20..70581326dc368f0bc5b9f9db51b74e9a421fbd58 100644 (file)
@@ -1554,6 +1554,7 @@ int smu_v13_0_set_soft_freq_limited_range(struct smu_context *smu,
                return clk_id;
 
        if (max > 0) {
+               max = SMU_V13_SOFT_FREQ_ROUND(max);
                if (automatic)
                        param = (uint32_t)((clk_id << 16) | 0xffff);
                else