Skip to content

Commit 7f3353f

Browse files
mcoffinalexdeucher
authored andcommitted
drm/amdgpu/navi10: Implement od clk printing
[Why] Before this patch, navi10 overdrive settings could not be printed via pp_od_clk_voltage [How] Implement printing for the overdrive settings for the following clocks in navi10's ppt print_clk_levels implementation: * SMU_OD_SCLK * SMU_OD_MCLK * SMU_OD_VDDC_CURVE Reviewed-by: Evan Quan <[email protected]> Signed-off-by: Matt Coffin <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6610713 commit 7f3353f

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed

drivers/gpu/drm/amd/powerplay/navi10_ppt.c

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,13 +691,25 @@ static bool navi10_is_support_fine_grained_dpm(struct smu_context *smu, enum smu
691691
return dpm_desc->SnapToDiscrete == 0 ? true : false;
692692
}
693693

694+
static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODFEATURE_ID feature)
695+
{
696+
return od_table->cap[feature];
697+
}
698+
699+
694700
static int navi10_print_clk_levels(struct smu_context *smu,
695701
enum smu_clk_type clk_type, char *buf)
696702
{
703+
OverDriveTable_t *od_table;
704+
struct smu_11_0_overdrive_table *od_settings;
705+
uint16_t *curve_settings;
697706
int i, size = 0, ret = 0;
698707
uint32_t cur_value = 0, value = 0, count = 0;
699708
uint32_t freq_values[3] = {0};
700709
uint32_t mark_index = 0;
710+
struct smu_table_context *table_context = &smu->smu_table;
711+
od_table = (OverDriveTable_t *)table_context->overdrive_table;
712+
od_settings = smu->od_settings;
701713

702714
switch (clk_type) {
703715
case SMU_GFXCLK:
@@ -748,6 +760,45 @@ static int navi10_print_clk_levels(struct smu_context *smu,
748760

749761
}
750762
break;
763+
case SMU_OD_SCLK:
764+
if (!smu->od_enabled || !od_table || !od_settings)
765+
break;
766+
if (!navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_GFXCLK_LIMITS))
767+
break;
768+
size += sprintf(buf + size, "OD_SCLK:\n");
769+
size += sprintf(buf + size, "0: %uMhz\n1: %uMhz\n", od_table->GfxclkFmin, od_table->GfxclkFmax);
770+
break;
771+
case SMU_OD_MCLK:
772+
if (!smu->od_enabled || !od_table || !od_settings)
773+
break;
774+
if (!navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_UCLK_MAX))
775+
break;
776+
size += sprintf(buf + size, "OD_MCLK:\n");
777+
size += sprintf(buf + size, "0: %uMHz\n", od_table->UclkFmax);
778+
break;
779+
case SMU_OD_VDDC_CURVE:
780+
if (!smu->od_enabled || !od_table || !od_settings)
781+
break;
782+
if (!navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_GFXCLK_CURVE))
783+
break;
784+
size += sprintf(buf + size, "OD_VDDC_CURVE:\n");
785+
for (i = 0; i < 3; i++) {
786+
switch (i) {
787+
case 0:
788+
curve_settings = &od_table->GfxclkFreq1;
789+
break;
790+
case 1:
791+
curve_settings = &od_table->GfxclkFreq2;
792+
break;
793+
case 2:
794+
curve_settings = &od_table->GfxclkFreq3;
795+
break;
796+
default:
797+
break;
798+
}
799+
size += sprintf(buf + size, "%d: %uMHz @ %umV\n", i, curve_settings[0], curve_settings[1] / NAVI10_VOLTAGE_SCALE);
800+
}
801+
break;
751802
default:
752803
break;
753804
}
@@ -1661,11 +1712,6 @@ static inline void navi10_dump_od_table(OverDriveTable_t *od_table) {
16611712
pr_debug("OD: OverDrivePct: %d\n", od_table->OverDrivePct);
16621713
}
16631714

1664-
static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODFEATURE_ID feature)
1665-
{
1666-
return od_table->cap[feature];
1667-
}
1668-
16691715
static int navi10_od_setting_check_range(struct smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODSETTING_ID setting, uint32_t value)
16701716
{
16711717
if (value < od_table->min[setting]) {

0 commit comments

Comments
 (0)