Skip to content

Commit c764b7a

Browse files
Yang Wangalexdeucher
authored andcommitted
drm/amd/pm: fix smu v13 soft clock frequency setting issue
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 6194f60) Cc: stable@vger.kernel.org
1 parent 63804fe commit c764b7a

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define SMUQ10_TO_UINT(x) ((x) >> 10)
5757
#define SMUQ10_FRAC(x) ((x) & 0x3ff)
5858
#define SMUQ10_ROUND(x) ((SMUQ10_TO_UINT(x)) + ((SMUQ10_FRAC(x)) >= 0x200))
59+
#define SMU_V13_SOFT_FREQ_ROUND(x) ((x) + 1)
5960

6061
extern const int pmfw_decoded_link_speed[5];
6162
extern const int pmfw_decoded_link_width[7];

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,7 @@ int smu_v13_0_set_soft_freq_limited_range(struct smu_context *smu,
15551555
return clk_id;
15561556

15571557
if (max > 0) {
1558+
max = SMU_V13_SOFT_FREQ_ROUND(max);
15581559
if (automatic)
15591560
param = (uint32_t)((clk_id << 16) | 0xffff);
15601561
else

0 commit comments

Comments
 (0)