Skip to content

Commit 9ad7353

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amd/pm: Get max/min frequency on aldebaran VF
PMFW interface to get max/min frequencies is not available on aldebaran VFs. Use data, if available, in DPM tables to get the max/min frequencies. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent ec8fbb4 commit 9ad7353

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

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

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,61 @@ static int aldebaran_get_allowed_feature_mask(struct smu_context *smu,
342342
return 0;
343343
}
344344

345+
static int aldebaran_get_dpm_ultimate_freq(struct smu_context *smu,
346+
enum smu_clk_type clk_type,
347+
uint32_t *min, uint32_t *max)
348+
{
349+
struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
350+
struct smu_13_0_dpm_table *dpm_table;
351+
uint32_t min_clk, max_clk;
352+
353+
if (amdgpu_sriov_vf(smu->adev)) {
354+
switch (clk_type) {
355+
case SMU_MCLK:
356+
case SMU_UCLK:
357+
dpm_table = &dpm_context->dpm_tables.uclk_table;
358+
break;
359+
case SMU_GFXCLK:
360+
case SMU_SCLK:
361+
dpm_table = &dpm_context->dpm_tables.gfx_table;
362+
break;
363+
case SMU_SOCCLK:
364+
dpm_table = &dpm_context->dpm_tables.soc_table;
365+
break;
366+
case SMU_FCLK:
367+
dpm_table = &dpm_context->dpm_tables.fclk_table;
368+
break;
369+
case SMU_VCLK:
370+
dpm_table = &dpm_context->dpm_tables.vclk_table;
371+
break;
372+
case SMU_DCLK:
373+
dpm_table = &dpm_context->dpm_tables.dclk_table;
374+
break;
375+
default:
376+
return -EINVAL;
377+
}
378+
379+
min_clk = dpm_table->min;
380+
max_clk = dpm_table->max;
381+
382+
if (min) {
383+
if (!min_clk)
384+
return -ENODATA;
385+
*min = min_clk;
386+
}
387+
if (max) {
388+
if (!max_clk)
389+
return -ENODATA;
390+
*max = max_clk;
391+
}
392+
393+
} else {
394+
return smu_v13_0_get_dpm_ultimate_freq(smu, clk_type, min, max);
395+
}
396+
397+
return 0;
398+
}
399+
345400
static int aldebaran_set_default_dpm_table(struct smu_context *smu)
346401
{
347402
struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
@@ -2081,7 +2136,7 @@ static const struct pptable_funcs aldebaran_ppt_funcs = {
20812136
.set_azalia_d3_pme = smu_v13_0_set_azalia_d3_pme,
20822137
.get_max_sustainable_clocks_by_dc = smu_v13_0_get_max_sustainable_clocks_by_dc,
20832138
.get_bamaco_support = aldebaran_get_bamaco_support,
2084-
.get_dpm_ultimate_freq = smu_v13_0_get_dpm_ultimate_freq,
2139+
.get_dpm_ultimate_freq = aldebaran_get_dpm_ultimate_freq,
20852140
.set_soft_freq_limited_range = aldebaran_set_soft_freq_limited_range,
20862141
.od_edit_dpm_table = aldebaran_usr_edit_dpm_table,
20872142
.set_df_cstate = aldebaran_set_df_cstate,

0 commit comments

Comments
 (0)