Commit d22b7e40 authored by Alex Deucher's avatar Alex Deucher

drm/radeon/dpm: fixup dynamic state adjust for btc (v2)

Use a dedicated copy of the current power state since
we may have to adjust it on the fly.

v2: fix up redundant state sets
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a8dbaeff
This diff is collapsed.
...@@ -33,4 +33,6 @@ ...@@ -33,4 +33,6 @@
#define BTC_CGULVPARAMETER_DFLT 0x00040035 #define BTC_CGULVPARAMETER_DFLT 0x00040035
#define BTC_CGULVCONTROL_DFLT 0x00001450 #define BTC_CGULVCONTROL_DFLT 0x00001450
extern u32 btc_valid_sclk[];
#endif #endif
...@@ -88,6 +88,7 @@ struct evergreen_power_info { ...@@ -88,6 +88,7 @@ struct evergreen_power_info {
struct at ats[2]; struct at ats[2];
/* smc offsets */ /* smc offsets */
u16 mc_reg_table_start; u16 mc_reg_table_start;
struct rv7xx_ps hw_ps;
}; };
#define CYPRESS_HASI_DFLT 400000 #define CYPRESS_HASI_DFLT 400000
......
...@@ -1217,6 +1217,19 @@ struct radeon_dpm_thermal { ...@@ -1217,6 +1217,19 @@ struct radeon_dpm_thermal {
bool high_to_low; bool high_to_low;
}; };
enum radeon_clk_action
{
RADEON_SCLK_UP = 1,
RADEON_SCLK_DOWN
};
struct radeon_blacklist_clocks
{
u32 sclk;
u32 mclk;
enum radeon_clk_action action;
};
struct radeon_clock_and_voltage_limits { struct radeon_clock_and_voltage_limits {
u32 sclk; u32 sclk;
u32 mclk; u32 mclk;
......
...@@ -719,17 +719,42 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) ...@@ -719,17 +719,42 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
else else
return; return;
/* no need to reprogram if nothing changed */ /* no need to reprogram if nothing changed unless we are on BTC+ */
if (rdev->pm.dpm.current_ps == rdev->pm.dpm.requested_ps) { if (rdev->pm.dpm.current_ps == rdev->pm.dpm.requested_ps) {
/* update display watermarks based on new power state */ if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) {
if (rdev->pm.dpm.new_active_crtcs != rdev->pm.dpm.current_active_crtcs) { /* for pre-BTC and APUs if the num crtcs changed but state is the same,
radeon_bandwidth_update(rdev); * all we need to do is update the display configuration.
/* update displays */ */
radeon_dpm_display_configuration_changed(rdev); if (rdev->pm.dpm.new_active_crtcs != rdev->pm.dpm.current_active_crtcs) {
rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; /* update display watermarks based on new power state */
rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; radeon_bandwidth_update(rdev);
/* update displays */
radeon_dpm_display_configuration_changed(rdev);
rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs;
rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count;
}
return;
} else {
/* for BTC+ if the num crtcs hasn't changed and state is the same,
* nothing to do, if the num crtcs is > 1 and state is the same,
* update display configuration.
*/
if (rdev->pm.dpm.new_active_crtcs ==
rdev->pm.dpm.current_active_crtcs) {
return;
} else {
if ((rdev->pm.dpm.current_active_crtc_count > 1) &&
(rdev->pm.dpm.new_active_crtc_count > 1)) {
/* update display watermarks based on new power state */
radeon_bandwidth_update(rdev);
/* update displays */
radeon_dpm_display_configuration_changed(rdev);
rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs;
rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count;
return;
}
}
} }
return;
} }
printk("switching from power state:\n"); printk("switching from power state:\n");
......
...@@ -2177,6 +2177,16 @@ static void rv7xx_parse_pplib_clock_info(struct radeon_device *rdev, ...@@ -2177,6 +2177,16 @@ static void rv7xx_parse_pplib_clock_info(struct radeon_device *rdev,
pl->vddc = vddc; pl->vddc = vddc;
pl->vddci = vddci; pl->vddci = vddci;
} }
if (rdev->family >= CHIP_BARTS) {
if ((rps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) ==
ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE) {
rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.sclk = pl->sclk;
rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.mclk = pl->mclk;
rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddc = pl->vddc;
rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddci = pl->vddci;
}
}
} }
int rv7xx_parse_power_table(struct radeon_device *rdev) int rv7xx_parse_power_table(struct radeon_device *rdev)
......
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