drm/amd/display: Fix DC definition of PMFW Pstate table for DCN316
Subsystems (3)
[email protected]
maintainerPATCH 1/1 drm/amd/display: Fix DC definition of PMFW Pstate table for DCN316
From: Leo Li <[email protected]>
[Why]
During DC init, we read power management tables from PMFW. This info is exchanged in the form of a binary blob inside gpu memory. In order to parse the binary blob, the correct struct needs to be used.
[How]
Fix dcn316's definition of the DfPstateTable_t struct to align with PMFW
--- .../amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 11 ++++++++++- .../drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +10 -1
@@ -530,7 +530,16 @@ static void dcn316_clk_mgr_helper_populate_bw_params( bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].FClk; bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].MemClk; bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].Voltage; - bw_params->clk_table.entries[i].wck_ratio =1 ; +switch (clock_table->DfPstateTable[j].WckRatio) { +case WCK_RATIO_1_2 : + bw_params->clk_table.entries[i].wck_ratio =2 ; +break ; +case WCK_RATIO_1_4 : + bw_params->clk_table.entries[i].wck_ratio =4 ; +break ; +default : + bw_params->clk_table.entries[i].wck_ratio =1 ; + } temp =find_clk_for_voltage (clock_table, clock_table->DcfClocks, clock_table->DfPstateTable[j].Voltage);if (temp) bw_params->clk_table.entries[i].dcfclk_mhz = temp;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h +9 -0
@@ -57,10 +57,19 @@ typedef enum {WM_COUNT , } WM_CLOCK_e; +typedef enum { +WCK_RATIO_1_1 =0 ,// DDR5, Wck:ck is always 1:1; +WCK_RATIO_1_2 , +WCK_RATIO_1_4 , +WCK_RATIO_MAX +}WCK_RATIO_e ; +typedef struct {uint32_t FClk;uint32_t MemClk;uint32_t Voltage; +uint8_t WckRatio; +uint8_t Spare[3 ]; }DfPstateTable_t ;//Freq in MHz
Signature · 1 line
2.35.1
Quoted 68 lines · On Thu, Feb 24, 2022 at 1:24 PM <[email protected]> wrote:
From: Leo Li <[email protected]>
[Why]
During DC init, we read power management tables from PMFW. This info is exchanged in the form of a binary blob inside gpu memory. In order to parse the binary blob, the correct struct needs to be used.
[How]
Fix dcn316's definition of the
DfPstateTable_tstruct to align with PMFWSigned-off-by Leo Li <[email protected]>--- .../amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 11 ++++++++++- .../drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +10
-1@@ -530,7 +530,16 @@ static void dcn316_clk_mgr_helper_populate_bw_params( bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].FClk; bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].MemClk; bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].Voltage; - bw_params->clk_table.entries[i].wck_ratio =1 ; +switch (clock_table->DfPstateTable[j].WckRatio) { +case WCK_RATIO_1_2 : + bw_params->clk_table.entries[i].wck_ratio =2 ; +break ; +case WCK_RATIO_1_4 : + bw_params->clk_table.entries[i].wck_ratio =4 ; +break ; +default : + bw_params->clk_table.entries[i].wck_ratio =1 ; + } temp =find_clk_for_voltage (clock_table, clock_table->DcfClocks, clock_table->DfPstateTable[j].Voltage);if (temp) bw_params->clk_table.entries[i].dcfclk_mhz = temp;drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h +9
-1@@ -57,10 +57,19 @@ typedef enum {WM_COUNT , } WM_CLOCK_e; +typedef enum { +WCK_RATIO_1_1 =0 ,// DDR5, Wck:ck is always 1:1; +WCK_RATIO_1_2 , +WCK_RATIO_1_4 , +WCK_RATIO_MAX +}WCK_RATIO_e ; +typedef struct {uint32_t FClk;uint32_t MemClk;uint32_t Voltage; +uint8_t WckRatio; +uint8_t Spare[3 ]; }DfPstateTable_t ;//Freq in MHz --2.35.1
Quoted 8 lines · On 2022-02-24 13:24, [email protected] wrote:
From: Leo Li <[email protected]>
[Why]
During DC init, we read power management tables from PMFW. This info is exchanged in the form of a binary blob inside gpu memory. In order to parse the binary blob, the correct struct needs to be used.
Quoted 5 lines
[How]
Fix dcn316's definition of the
DfPstateTable_tstruct to align with PMFWSigned-off-by Leo Li <[email protected]>
Harry
Quoted 51 lines
--- .../amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 11 ++++++++++- .../drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +10
-1@@ -530,7 +530,16 @@ static void dcn316_clk_mgr_helper_populate_bw_params( bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].FClk; bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].MemClk; bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].Voltage; - bw_params->clk_table.entries[i].wck_ratio =1 ; +switch (clock_table->DfPstateTable[j].WckRatio) { +case WCK_RATIO_1_2 : + bw_params->clk_table.entries[i].wck_ratio =2 ; +break ; +case WCK_RATIO_1_4 : + bw_params->clk_table.entries[i].wck_ratio =4 ; +break ; +default : + bw_params->clk_table.entries[i].wck_ratio =1 ; + } temp =find_clk_for_voltage (clock_table, clock_table->DcfClocks, clock_table->DfPstateTable[j].Voltage);if (temp) bw_params->clk_table.entries[i].dcfclk_mhz = temp;drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h +9
-0@@ -57,10 +57,19 @@ typedef enum {WM_COUNT , } WM_CLOCK_e; +typedef enum { +WCK_RATIO_1_1 =0 ,// DDR5, Wck:ck is always 1:1; +WCK_RATIO_1_2 , +WCK_RATIO_1_4 , +WCK_RATIO_MAX +}WCK_RATIO_e ; +typedef struct {uint32_t FClk;uint32_t MemClk;uint32_t Voltage; +uint8_t WckRatio; +uint8_t Spare[3 ]; }DfPstateTable_t ;//Freq in MHz