Skip to content

Commit 2d99a7e

Browse files
Swapnil Patelalexdeucher
authored andcommitted
drm/amd/display: Update clock table to include highest clock setting
[Why] Currently, the clk manager matches SocVoltage with voltage from fused settings (dfPstate clock table). And then corresponding clocks are selected. However in certain situations, this leads to clk manager not including at least one entry with highest supported clock setting. [How] Update the clk manager to include at least one entry with highest supported clock setting. Reviewed-by: Pavle Kotarac <[email protected]> Acked-by: Qingqing Zhuo <[email protected]> Signed-off-by: Swapnil Patel <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent c538991 commit 2d99a7e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,19 @@ static struct clk_bw_params vg_bw_params = {
529529

530530
};
531531

532+
static uint32_t find_max_clk_value(const uint32_t clocks[], uint32_t num_clocks)
533+
{
534+
uint32_t max = 0;
535+
int i;
536+
537+
for (i = 0; i < num_clocks; ++i) {
538+
if (clocks[i] > max)
539+
max = clocks[i];
540+
}
541+
542+
return max;
543+
}
544+
532545
static unsigned int find_dcfclk_for_voltage(const struct vg_dpm_clocks *clock_table,
533546
unsigned int voltage)
534547
{
@@ -572,12 +585,16 @@ static void vg_clk_mgr_helper_populate_bw_params(
572585

573586
bw_params->clk_table.num_entries = j + 1;
574587

575-
for (i = 0; i < bw_params->clk_table.num_entries; i++, j--) {
588+
for (i = 0; i < bw_params->clk_table.num_entries - 1; i++, j--) {
576589
bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].fclk;
577590
bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].memclk;
578591
bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].voltage;
579592
bw_params->clk_table.entries[i].dcfclk_mhz = find_dcfclk_for_voltage(clock_table, clock_table->DfPstateTable[j].voltage);
580593
}
594+
bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].fclk;
595+
bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].memclk;
596+
bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].voltage;
597+
bw_params->clk_table.entries[i].dcfclk_mhz = find_max_clk_value(clock_table->DcfClocks, VG_NUM_DCFCLK_DPM_LEVELS);
581598

582599
bw_params->vram_type = bios_info->memory_type;
583600
bw_params->num_channels = bios_info->ma_channel_number;

0 commit comments

Comments
 (0)