]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: fix smu v14 soft clock frequency setting issue
authorYang Wang <kevinyang.wang@amd.com>
Wed, 21 Jan 2026 03:06:29 +0000 (11:06 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 27 Jan 2026 23:24:21 +0000 (18:24 -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>
(cherry picked from commit 53868dd8774344051999c880115740da92f97feb)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v14_0.h
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c

index 29a4583db8734bf6ce57c72d2d2c4e3a7da62166..0b1e6f25e61129e23d35f25000f1e8686c747e03 100644 (file)
@@ -57,6 +57,7 @@ extern const int decoded_link_width[8];
 
 #define DECODE_GEN_SPEED(gen_speed_idx)                (decoded_link_speed[gen_speed_idx])
 #define DECODE_LANE_WIDTH(lane_width_idx)      (decoded_link_width[lane_width_idx])
+#define SMU_V14_SOFT_FREQ_ROUND(x)     ((x) + 1)
 
 struct smu_14_0_max_sustainable_clocks {
        uint32_t display_clock;
index f2a16dfee5998106c04bd403f5cc3ab7157a4bcd..06a81533759cda0c3fad408a7c6ce0a7472d8638 100644 (file)
@@ -1178,6 +1178,7 @@ int smu_v14_0_set_soft_freq_limited_range(struct smu_context *smu,
                return clk_id;
 
        if (max > 0) {
+               max = SMU_V14_SOFT_FREQ_ROUND(max);
                if (automatic)
                        param = (uint32_t)((clk_id << 16) | 0xffff);
                else