Commit 4d60173f authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms/pm: track current voltage (v2)

track the current voltage level and avoid setting it
if the requested voltage is already set.

v2: check voltage type before checking current voltage
Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent aa1df0f2
...@@ -45,8 +45,12 @@ void evergreen_pm_misc(struct radeon_device *rdev) ...@@ -45,8 +45,12 @@ void evergreen_pm_misc(struct radeon_device *rdev)
struct radeon_power_state *ps = &rdev->pm.power_state[requested_index]; struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
struct radeon_voltage *voltage = &ps->clock_info[0].voltage; struct radeon_voltage *voltage = &ps->clock_info[0].voltage;
if ((voltage->type == VOLTAGE_SW) && voltage->voltage) if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
radeon_atom_set_voltage(rdev, voltage->voltage); if (voltage->voltage != rdev->pm.current_vddc) {
radeon_atom_set_voltage(rdev, voltage->voltage);
rdev->pm.current_vddc = voltage->voltage;
}
}
} }
void evergreen_pm_prepare(struct radeon_device *rdev) void evergreen_pm_prepare(struct radeon_device *rdev)
......
...@@ -561,9 +561,12 @@ void r600_pm_misc(struct radeon_device *rdev) ...@@ -561,9 +561,12 @@ void r600_pm_misc(struct radeon_device *rdev)
struct radeon_power_state *ps = &rdev->pm.power_state[requested_index]; struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
struct radeon_voltage *voltage = &ps->clock_info[0].voltage; struct radeon_voltage *voltage = &ps->clock_info[0].voltage;
if ((voltage->type == VOLTAGE_SW) && voltage->voltage) if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
radeon_atom_set_voltage(rdev, voltage->voltage); if (voltage->voltage != rdev->pm.current_vddc) {
radeon_atom_set_voltage(rdev, voltage->voltage);
rdev->pm.current_vddc = voltage->voltage;
}
}
} }
bool r600_gui_idle(struct radeon_device *rdev) bool r600_gui_idle(struct radeon_device *rdev)
......
...@@ -748,6 +748,7 @@ struct radeon_pm { ...@@ -748,6 +748,7 @@ struct radeon_pm {
int default_power_state_index; int default_power_state_index;
u32 current_sclk; u32 current_sclk;
u32 current_mclk; u32 current_mclk;
u32 current_vddc;
struct radeon_i2c_chan *i2c_bus; struct radeon_i2c_chan *i2c_bus;
/* selected pm method */ /* selected pm method */
enum radeon_pm_method pm_method; enum radeon_pm_method pm_method;
......
...@@ -1966,6 +1966,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1966,6 +1966,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; rdev->pm.current_power_state_index = rdev->pm.default_power_state_index;
rdev->pm.current_clock_mode_index = 0; rdev->pm.current_clock_mode_index = 0;
rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
} }
void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable) void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable)
......
...@@ -387,6 +387,7 @@ void radeon_pm_resume(struct radeon_device *rdev) ...@@ -387,6 +387,7 @@ void radeon_pm_resume(struct radeon_device *rdev)
rdev->pm.current_clock_mode_index = 0; rdev->pm.current_clock_mode_index = 0;
rdev->pm.current_sclk = rdev->clock.default_sclk; rdev->pm.current_sclk = rdev->clock.default_sclk;
rdev->pm.current_mclk = rdev->clock.default_mclk; rdev->pm.current_mclk = rdev->clock.default_mclk;
rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
mutex_unlock(&rdev->pm.mutex); mutex_unlock(&rdev->pm.mutex);
radeon_pm_compute_clocks(rdev); radeon_pm_compute_clocks(rdev);
} }
......
...@@ -48,8 +48,13 @@ void rv770_pm_misc(struct radeon_device *rdev) ...@@ -48,8 +48,13 @@ void rv770_pm_misc(struct radeon_device *rdev)
struct radeon_power_state *ps = &rdev->pm.power_state[requested_index]; struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
struct radeon_voltage *voltage = &ps->clock_info[0].voltage; struct radeon_voltage *voltage = &ps->clock_info[0].voltage;
if ((voltage->type == VOLTAGE_SW) && voltage->voltage)
radeon_atom_set_voltage(rdev, voltage->voltage); if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
if (voltage->voltage != rdev->pm.current_vddc) {
radeon_atom_set_voltage(rdev, voltage->voltage);
rdev->pm.current_vddc = voltage->voltage;
}
}
} }
/* /*
......
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