Skip to content

Commit

Permalink
drm/amd/pm: correct the pcie link state check for SMU13
Browse files Browse the repository at this point in the history
Update the driver implementations to fit those data exposed
by PMFW.

Signed-off-by: Evan Quan <[email protected]>
Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected] # 6.1.x
  • Loading branch information
Evan Quan authored and lutzbichler committed Jan 18, 2024
1 parent c3b7c6c commit 7711642
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
#define CTF_OFFSET_HOTSPOT 5
#define CTF_OFFSET_MEM 5

static const int pmfw_decoded_link_speed[5] = {1, 2, 3, 4, 5};
static const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16};

#define DECODE_GEN_SPEED(gen_speed_idx) (pmfw_decoded_link_speed[gen_speed_idx])
#define DECODE_LANE_WIDTH(lane_width_idx) (pmfw_decoded_link_width[lane_width_idx])

struct smu_13_0_max_sustainable_clocks {
uint32_t display_clock;
uint32_t phy_clock;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,8 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
(pcie_table->pcie_lane[i] == 5) ? "x12" :
(pcie_table->pcie_lane[i] == 6) ? "x16" : "",
pcie_table->clk_freq[i],
((gen_speed - 1) == pcie_table->pcie_gen[i]) &&
(lane_width == link_width[pcie_table->pcie_lane[i]]) ?
(gen_speed == DECODE_GEN_SPEED(pcie_table->pcie_gen[i])) &&
(lane_width == DECODE_LANE_WIDTH(link_width[pcie_table->pcie_lane[i]])) ?
"*" : "");
break;

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,8 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
(pcie_table->pcie_lane[i] == 5) ? "x12" :
(pcie_table->pcie_lane[i] == 6) ? "x16" : "",
pcie_table->clk_freq[i],
(gen_speed == pcie_table->pcie_gen[i]) &&
(lane_width == pcie_table->pcie_lane[i]) ?
(gen_speed == DECODE_GEN_SPEED(pcie_table->pcie_gen[i])) &&
(lane_width == DECODE_LANE_WIDTH(pcie_table->pcie_lane[i])) ?
"*" : "");
break;

Expand Down

0 comments on commit 7711642

Please sign in to comment.