Commit f02c7336 authored by Xiaojian Du's avatar Xiaojian Du Committed by Alex Deucher

drm/amd/pm: enable the "fetch" function of pp_dpm_vclk/dclk for vangogh

This patch is to enable the "fetch" function of pp_dpm_vclk and
pp_dpm_dclk.
It allows to fetch the current frequency of vcn and dcn and their
DPM levels for vangogh.
Signed-off-by: default avatarXiaojian Du <Xiaojian.Du@amd.com>
Acked-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9577b0ec
...@@ -141,7 +141,6 @@ typedef struct { ...@@ -141,7 +141,6 @@ typedef struct {
uint32_t MaxGfxClk; uint32_t MaxGfxClk;
uint8_t NumDfPstatesEnabled; uint8_t NumDfPstatesEnabled;
uint8_t NumDpmLevelsEnabled;
uint8_t NumDcfclkLevelsEnabled; uint8_t NumDcfclkLevelsEnabled;
uint8_t NumDispClkLevelsEnabled; //applies to both dispclk and dppclk uint8_t NumDispClkLevelsEnabled; //applies to both dispclk and dppclk
uint8_t NumSocClkLevelsEnabled; uint8_t NumSocClkLevelsEnabled;
......
...@@ -249,6 +249,12 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu, ...@@ -249,6 +249,12 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu,
case METRICS_AVERAGE_SOCCLK: case METRICS_AVERAGE_SOCCLK:
*value = metrics->SocclkFrequency; *value = metrics->SocclkFrequency;
break; break;
case METRICS_AVERAGE_VCLK:
*value = metrics->VclkFrequency;
break;
case METRICS_AVERAGE_DCLK:
*value = metrics->DclkFrequency;
break;
case METRICS_AVERAGE_UCLK: case METRICS_AVERAGE_UCLK:
*value = metrics->MemclkFrequency; *value = metrics->MemclkFrequency;
break; break;
...@@ -434,6 +440,16 @@ static int vangogh_get_dpm_clk_limited(struct smu_context *smu, enum smu_clk_typ ...@@ -434,6 +440,16 @@ static int vangogh_get_dpm_clk_limited(struct smu_context *smu, enum smu_clk_typ
return -EINVAL; return -EINVAL;
*freq = clk_table->SocClocks[dpm_level]; *freq = clk_table->SocClocks[dpm_level];
break; break;
case SMU_VCLK:
if (dpm_level >= clk_table->VcnClkLevelsEnabled)
return -EINVAL;
*freq = clk_table->VcnClocks[dpm_level].vclk;
break;
case SMU_DCLK:
if (dpm_level >= clk_table->VcnClkLevelsEnabled)
return -EINVAL;
*freq = clk_table->VcnClocks[dpm_level].dclk;
break;
case SMU_UCLK: case SMU_UCLK:
case SMU_MCLK: case SMU_MCLK:
if (dpm_level >= clk_table->NumDfPstatesEnabled) if (dpm_level >= clk_table->NumDfPstatesEnabled)
...@@ -486,10 +502,18 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu, ...@@ -486,10 +502,18 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu,
} }
break; break;
case SMU_SOCCLK: case SMU_SOCCLK:
/* the level 3 ~ 6 of socclk use the same frequency for vangogh */ /* the level 3 ~ 6 of socclk use the same frequency for vangogh */
count = clk_table->NumSocClkLevelsEnabled; count = clk_table->NumSocClkLevelsEnabled;
cur_value = metrics.SocclkFrequency; cur_value = metrics.SocclkFrequency;
break; break;
case SMU_VCLK:
count = clk_table->VcnClkLevelsEnabled;
cur_value = metrics.VclkFrequency;
break;
case SMU_DCLK:
count = clk_table->VcnClkLevelsEnabled;
cur_value = metrics.DclkFrequency;
break;
case SMU_MCLK: case SMU_MCLK:
count = clk_table->NumDfPstatesEnabled; count = clk_table->NumDfPstatesEnabled;
cur_value = metrics.MemclkFrequency; cur_value = metrics.MemclkFrequency;
...@@ -506,6 +530,8 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu, ...@@ -506,6 +530,8 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu,
switch (clk_type) { switch (clk_type) {
case SMU_SOCCLK: case SMU_SOCCLK:
case SMU_VCLK:
case SMU_DCLK:
case SMU_MCLK: case SMU_MCLK:
case SMU_FCLK: case SMU_FCLK:
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment