Commit 32ce4652 authored by Alex Deucher's avatar Alex Deucher

drm/radeon/dpm: add an enum for pcie gen selection

This makes it easier the understand what the code is
doing.
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f8f84ac5
...@@ -344,7 +344,7 @@ void cypress_advertise_gen2_capability(struct radeon_device *rdev) ...@@ -344,7 +344,7 @@ void cypress_advertise_gen2_capability(struct radeon_device *rdev)
} }
static u32 cypress_get_maximum_link_speed(struct radeon_ps *radeon_state) static enum radeon_pcie_gen cypress_get_maximum_link_speed(struct radeon_ps *radeon_state)
{ {
struct rv7xx_ps *state = rv770_get_ps(radeon_state); struct rv7xx_ps *state = rv770_get_ps(radeon_state);
...@@ -357,14 +357,16 @@ void cypress_notify_link_speed_change_after_state_change(struct radeon_device *r ...@@ -357,14 +357,16 @@ void cypress_notify_link_speed_change_after_state_change(struct radeon_device *r
struct radeon_ps *radeon_new_state, struct radeon_ps *radeon_new_state,
struct radeon_ps *radeon_current_state) struct radeon_ps *radeon_current_state)
{ {
u32 pcie_link_speed_target = cypress_get_maximum_link_speed(radeon_new_state); enum radeon_pcie_gen pcie_link_speed_target =
u32 pcie_link_speed_current = cypress_get_maximum_link_speed(radeon_current_state); cypress_get_maximum_link_speed(radeon_new_state);
enum radeon_pcie_gen pcie_link_speed_current =
cypress_get_maximum_link_speed(radeon_current_state);
u8 request; u8 request;
if (pcie_link_speed_target < pcie_link_speed_current) { if (pcie_link_speed_target < pcie_link_speed_current) {
if (pcie_link_speed_target == 0) if (pcie_link_speed_target == RADEON_PCIE_GEN1)
request = PCIE_PERF_REQ_PECI_GEN1; request = PCIE_PERF_REQ_PECI_GEN1;
else if (pcie_link_speed_target == 1) else if (pcie_link_speed_target == RADEON_PCIE_GEN2)
request = PCIE_PERF_REQ_PECI_GEN2; request = PCIE_PERF_REQ_PECI_GEN2;
else else
request = PCIE_PERF_REQ_PECI_GEN3; request = PCIE_PERF_REQ_PECI_GEN3;
...@@ -377,14 +379,16 @@ void cypress_notify_link_speed_change_before_state_change(struct radeon_device * ...@@ -377,14 +379,16 @@ void cypress_notify_link_speed_change_before_state_change(struct radeon_device *
struct radeon_ps *radeon_new_state, struct radeon_ps *radeon_new_state,
struct radeon_ps *radeon_current_state) struct radeon_ps *radeon_current_state)
{ {
u32 pcie_link_speed_target = cypress_get_maximum_link_speed(radeon_new_state); enum radeon_pcie_gen pcie_link_speed_target =
u32 pcie_link_speed_current = cypress_get_maximum_link_speed(radeon_current_state); cypress_get_maximum_link_speed(radeon_new_state);
enum radeon_pcie_gen pcie_link_speed_current =
cypress_get_maximum_link_speed(radeon_current_state);
u8 request; u8 request;
if (pcie_link_speed_target > pcie_link_speed_current) { if (pcie_link_speed_target > pcie_link_speed_current) {
if (pcie_link_speed_target == 0) if (pcie_link_speed_target == RADEON_PCIE_GEN1)
request = PCIE_PERF_REQ_PECI_GEN1; request = PCIE_PERF_REQ_PECI_GEN1;
else if (pcie_link_speed_target == 1) else if (pcie_link_speed_target == RADEON_PCIE_GEN2)
request = PCIE_PERF_REQ_PECI_GEN2; request = PCIE_PERF_REQ_PECI_GEN2;
else else
request = PCIE_PERF_REQ_PECI_GEN3; request = PCIE_PERF_REQ_PECI_GEN3;
......
...@@ -1298,6 +1298,13 @@ struct radeon_dpm_fan { ...@@ -1298,6 +1298,13 @@ struct radeon_dpm_fan {
bool ucode_fan_control; bool ucode_fan_control;
}; };
enum radeon_pcie_gen {
RADEON_PCIE_GEN1 = 0,
RADEON_PCIE_GEN2 = 1,
RADEON_PCIE_GEN3 = 2,
RADEON_PCIE_GEN_INVALID = 0xffff
};
struct radeon_dpm { struct radeon_dpm {
struct radeon_ps *ps; struct radeon_ps *ps;
/* number of valid power states */ /* number of valid power states */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment