drm/amdgpu/powerplay: using the FCLK DPM table to set the MCLK
authorYuxian Dai <Yuxian.Dai@amd.com>
Wed, 1 Apr 2020 11:26:26 +0000 (19:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2020 08:50:20 +0000 (10:50 +0200)
commit 022ac4c9c55be35a2d1f71019a931324c51b0dab upstream.

1.Using the FCLK DPM table to set the MCLK for DPM states consist of
three entities:
 FCLK
 UCLK
 MEMCLK
All these three clk change together, MEMCLK from FCLK, so use the fclk
frequency.
2.we should show the current working clock freqency from clock table metric

Signed-off-by: Yuxian Dai <Yuxian.Dai@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/powerplay/renoir_ppt.c
drivers/gpu/drm/amd/powerplay/renoir_ppt.h

index e5283dafc4148d86f7f5b7235b1c2aa5109cc8af..9a083cd80133202e84cb575a7a4f7c47c7f6efcb 100644 (file)
@@ -184,6 +184,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,
        uint32_t cur_value = 0, value = 0, count = 0, min = 0, max = 0;
        DpmClocks_t *clk_table = smu->smu_table.clocks_table;
        SmuMetrics_t metrics;
+       bool cur_value_match_level = false;
 
        if (!clk_table || clk_type >= SMU_CLK_COUNT)
                return -EINVAL;
@@ -243,8 +244,13 @@ static int renoir_print_clk_levels(struct smu_context *smu,
                GET_DPM_CUR_FREQ(clk_table, clk_type, i, value);
                size += sprintf(buf + size, "%d: %uMhz %s\n", i, value,
                                cur_value == value ? "*" : "");
+               if (cur_value == value)
+                       cur_value_match_level = true;
        }
 
+       if (!cur_value_match_level)
+               size += sprintf(buf + size, "   %uMhz *\n", cur_value);
+
        return size;
 }
 
index 2a390ddd37dd611541554c4600ae58344b3de371..89cd6da118a3866ae5c156810b9586f856d9f784 100644 (file)
@@ -37,7 +37,7 @@ extern void renoir_set_ppt_funcs(struct smu_context *smu);
                        freq = table->SocClocks[dpm_level].Freq;        \
                        break;                                          \
                case SMU_MCLK:                                          \
-                       freq = table->MemClocks[dpm_level].Freq;        \
+                       freq = table->FClocks[dpm_level].Freq;  \
                        break;                                          \
                case SMU_DCEFCLK:                                       \
                        freq = table->DcfClocks[dpm_level].Freq;        \