mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 18:24:14 +08:00
drm/radeon/dpm: switch on new late_enable callback
Right now it's called right after enable, but after reworking the dpm init order, it will get called later to accomodate loading the smc early, but enabling thermal interrupts and block powergating later after the ring tests are complete. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
d8852c3446
commit
e14cd2bbcb
@ -2510,21 +2510,6 @@ int btc_dpm_enable(struct radeon_device *rdev)
|
||||
if (eg_pi->ls_clock_gating)
|
||||
btc_ls_clock_gating_enable(rdev, true);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
PPSMC_Result result;
|
||||
|
||||
ret = rv770_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
|
||||
|
||||
if (result != PPSMC_Result_OK)
|
||||
DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
|
||||
}
|
||||
|
||||
rv770_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
btc_init_stutter_mode(rdev);
|
||||
|
@ -4656,30 +4656,9 @@ int ci_dpm_enable(struct radeon_device *rdev)
|
||||
DRM_ERROR("ci_enable_power_containment failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
#if 0
|
||||
PPSMC_Result result;
|
||||
#endif
|
||||
ret = ci_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret) {
|
||||
DRM_ERROR("ci_set_thermal_temperature_range failed\n");
|
||||
return ret;
|
||||
}
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
#if 0
|
||||
result = ci_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
|
||||
|
||||
if (result != PPSMC_Result_OK)
|
||||
DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
ci_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
ci_dpm_powergate_uvd(rdev, true);
|
||||
|
||||
ci_update_current_ps(rdev, boot_ps);
|
||||
|
||||
return 0;
|
||||
|
@ -1905,21 +1905,6 @@ int cypress_dpm_enable(struct radeon_device *rdev)
|
||||
if (pi->mg_clock_gating)
|
||||
cypress_mg_clock_gating_enable(rdev, true);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
PPSMC_Result result;
|
||||
|
||||
ret = rv770_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
|
||||
|
||||
if (result != PPSMC_Result_OK)
|
||||
DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
|
||||
}
|
||||
|
||||
rv770_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
return 0;
|
||||
|
@ -1210,29 +1210,12 @@ int kv_dpm_enable(struct radeon_device *rdev)
|
||||
|
||||
kv_reset_acp_boot_level(rdev);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
ret = kv_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret) {
|
||||
DRM_ERROR("kv_set_thermal_temperature_range failed\n");
|
||||
return ret;
|
||||
}
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
}
|
||||
|
||||
ret = kv_smc_bapm_enable(rdev, false);
|
||||
if (ret) {
|
||||
DRM_ERROR("kv_smc_bapm_enable failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* powerdown unused blocks for now */
|
||||
kv_dpm_powergate_acp(rdev, true);
|
||||
kv_dpm_powergate_samu(rdev, true);
|
||||
kv_dpm_powergate_vce(rdev, true);
|
||||
kv_dpm_powergate_uvd(rdev, true);
|
||||
|
||||
kv_update_current_ps(rdev, rdev->pm.dpm.boot_ps);
|
||||
|
||||
return ret;
|
||||
|
@ -3710,21 +3710,6 @@ int ni_dpm_enable(struct radeon_device *rdev)
|
||||
if (eg_pi->ls_clock_gating)
|
||||
ni_ls_clockgating_enable(rdev, true);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
PPSMC_Result result;
|
||||
|
||||
ret = rv770_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, 0xff * 1000);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
|
||||
|
||||
if (result != PPSMC_Result_OK)
|
||||
DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
|
||||
}
|
||||
|
||||
rv770_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
ni_update_current_ps(rdev, boot_ps);
|
||||
|
@ -729,8 +729,8 @@ bool r600_is_uvd_state(u32 class, u32 class2)
|
||||
return false;
|
||||
}
|
||||
|
||||
int r600_set_thermal_temperature_range(struct radeon_device *rdev,
|
||||
int min_temp, int max_temp)
|
||||
static int r600_set_thermal_temperature_range(struct radeon_device *rdev,
|
||||
int min_temp, int max_temp)
|
||||
{
|
||||
int low_temp = 0 * 1000;
|
||||
int high_temp = 255 * 1000;
|
||||
|
@ -213,8 +213,6 @@ void r600_wait_for_power_level(struct radeon_device *rdev,
|
||||
void r600_start_dpm(struct radeon_device *rdev);
|
||||
void r600_stop_dpm(struct radeon_device *rdev);
|
||||
|
||||
int r600_set_thermal_temperature_range(struct radeon_device *rdev,
|
||||
int min_temp, int max_temp);
|
||||
bool r600_is_internal_thermal_sensor(enum radeon_int_thermal_type sensor);
|
||||
|
||||
int r600_parse_extended_power_table(struct radeon_device *rdev);
|
||||
|
@ -1032,25 +1032,31 @@ static void radeon_pm_resume_dpm(struct radeon_device *rdev)
|
||||
radeon_dpm_setup_asic(rdev);
|
||||
ret = radeon_dpm_enable(rdev);
|
||||
mutex_unlock(&rdev->pm.mutex);
|
||||
if (ret) {
|
||||
DRM_ERROR("radeon: dpm resume failed\n");
|
||||
if ((rdev->family >= CHIP_BARTS) &&
|
||||
(rdev->family <= CHIP_CAYMAN) &&
|
||||
rdev->mc_fw) {
|
||||
if (rdev->pm.default_vddc)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDC);
|
||||
if (rdev->pm.default_vddci)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddci,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDCI);
|
||||
if (rdev->pm.default_sclk)
|
||||
radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
|
||||
if (rdev->pm.default_mclk)
|
||||
radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
|
||||
}
|
||||
} else {
|
||||
rdev->pm.dpm_enabled = true;
|
||||
radeon_pm_compute_clocks(rdev);
|
||||
if (ret)
|
||||
goto dpm_resume_fail;
|
||||
ret = radeon_pm_late_init(rdev);
|
||||
if (ret)
|
||||
goto dpm_resume_fail;
|
||||
|
||||
rdev->pm.dpm_enabled = true;
|
||||
radeon_pm_compute_clocks(rdev);
|
||||
return;
|
||||
|
||||
dpm_resume_fail:
|
||||
DRM_ERROR("radeon: dpm resume failed\n");
|
||||
if ((rdev->family >= CHIP_BARTS) &&
|
||||
(rdev->family <= CHIP_CAYMAN) &&
|
||||
rdev->mc_fw) {
|
||||
if (rdev->pm.default_vddc)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDC);
|
||||
if (rdev->pm.default_vddci)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddci,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDCI);
|
||||
if (rdev->pm.default_sclk)
|
||||
radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
|
||||
if (rdev->pm.default_mclk)
|
||||
radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1170,25 +1176,11 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
|
||||
radeon_dpm_setup_asic(rdev);
|
||||
ret = radeon_dpm_enable(rdev);
|
||||
mutex_unlock(&rdev->pm.mutex);
|
||||
if (ret) {
|
||||
rdev->pm.dpm_enabled = false;
|
||||
if ((rdev->family >= CHIP_BARTS) &&
|
||||
(rdev->family <= CHIP_CAYMAN) &&
|
||||
rdev->mc_fw) {
|
||||
if (rdev->pm.default_vddc)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDC);
|
||||
if (rdev->pm.default_vddci)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddci,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDCI);
|
||||
if (rdev->pm.default_sclk)
|
||||
radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
|
||||
if (rdev->pm.default_mclk)
|
||||
radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
|
||||
}
|
||||
DRM_ERROR("radeon: dpm initialization failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
goto dpm_failed;
|
||||
ret = radeon_pm_late_init(rdev);
|
||||
if (ret)
|
||||
goto dpm_failed;
|
||||
rdev->pm.dpm_enabled = true;
|
||||
radeon_pm_compute_clocks(rdev);
|
||||
|
||||
@ -1213,6 +1205,25 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
|
||||
DRM_INFO("radeon: dpm initialized\n");
|
||||
|
||||
return 0;
|
||||
|
||||
dpm_failed:
|
||||
rdev->pm.dpm_enabled = false;
|
||||
if ((rdev->family >= CHIP_BARTS) &&
|
||||
(rdev->family <= CHIP_CAYMAN) &&
|
||||
rdev->mc_fw) {
|
||||
if (rdev->pm.default_vddc)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDC);
|
||||
if (rdev->pm.default_vddci)
|
||||
radeon_atom_set_voltage(rdev, rdev->pm.default_vddci,
|
||||
SET_VOLTAGE_TYPE_ASIC_VDDCI);
|
||||
if (rdev->pm.default_sclk)
|
||||
radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
|
||||
if (rdev->pm.default_mclk)
|
||||
radeon_set_memory_clock(rdev, rdev->pm.default_mclk);
|
||||
}
|
||||
DRM_ERROR("radeon: dpm initialization failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int radeon_pm_init(struct radeon_device *rdev)
|
||||
|
@ -623,14 +623,6 @@ int rs780_dpm_enable(struct radeon_device *rdev)
|
||||
if (pi->gfx_clock_gating)
|
||||
r600_gfx_clockgating_enable(rdev, true);
|
||||
|
||||
if (rdev->irq.installed && (rdev->pm.int_thermal_type == THERMAL_TYPE_RV6XX)) {
|
||||
ret = r600_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1546,7 +1546,6 @@ int rv6xx_dpm_enable(struct radeon_device *rdev)
|
||||
{
|
||||
struct rv6xx_power_info *pi = rv6xx_get_pi(rdev);
|
||||
struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps;
|
||||
int ret;
|
||||
|
||||
if (r600_dynamicpm_enabled(rdev))
|
||||
return -EINVAL;
|
||||
@ -1594,15 +1593,6 @@ int rv6xx_dpm_enable(struct radeon_device *rdev)
|
||||
r600_power_level_enable(rdev, R600_POWER_LEVEL_MEDIUM, true);
|
||||
r600_power_level_enable(rdev, R600_POWER_LEVEL_HIGH, true);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
ret = r600_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
}
|
||||
|
||||
rv6xx_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
r600_start_dpm(rdev);
|
||||
|
@ -1863,8 +1863,8 @@ void rv770_enable_auto_throttle_source(struct radeon_device *rdev,
|
||||
}
|
||||
}
|
||||
|
||||
int rv770_set_thermal_temperature_range(struct radeon_device *rdev,
|
||||
int min_temp, int max_temp)
|
||||
static int rv770_set_thermal_temperature_range(struct radeon_device *rdev,
|
||||
int min_temp, int max_temp)
|
||||
{
|
||||
int low_temp = 0 * 1000;
|
||||
int high_temp = 255 * 1000;
|
||||
@ -1966,21 +1966,6 @@ int rv770_dpm_enable(struct radeon_device *rdev)
|
||||
if (pi->mg_clock_gating)
|
||||
rv770_mg_clock_gating_enable(rdev, true);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
PPSMC_Result result;
|
||||
|
||||
ret = rv770_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
|
||||
|
||||
if (result != PPSMC_Result_OK)
|
||||
DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
|
||||
}
|
||||
|
||||
rv770_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
return 0;
|
||||
|
@ -283,8 +283,4 @@ int rv770_read_smc_soft_register(struct radeon_device *rdev,
|
||||
int rv770_write_smc_soft_register(struct radeon_device *rdev,
|
||||
u16 reg_offset, u32 value);
|
||||
|
||||
/* thermal */
|
||||
int rv770_set_thermal_temperature_range(struct radeon_device *rdev,
|
||||
int min_temp, int max_temp);
|
||||
|
||||
#endif
|
||||
|
@ -5890,21 +5890,6 @@ int si_dpm_enable(struct radeon_device *rdev)
|
||||
si_enable_sclk_control(rdev, true);
|
||||
si_start_dpm(rdev);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
PPSMC_Result result;
|
||||
|
||||
ret = si_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
result = si_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
|
||||
|
||||
if (result != PPSMC_Result_OK)
|
||||
DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
|
||||
}
|
||||
|
||||
si_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
|
||||
|
||||
ni_update_current_ps(rdev, boot_ps);
|
||||
|
@ -1202,14 +1202,10 @@ static void sumo_update_requested_ps(struct radeon_device *rdev,
|
||||
int sumo_dpm_enable(struct radeon_device *rdev)
|
||||
{
|
||||
struct sumo_power_info *pi = sumo_get_pi(rdev);
|
||||
int ret;
|
||||
|
||||
if (sumo_dpm_enabled(rdev))
|
||||
return -EINVAL;
|
||||
|
||||
ret = sumo_enable_clock_power_gating(rdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
sumo_program_bootup_state(rdev);
|
||||
sumo_init_bsp(rdev);
|
||||
sumo_reset_am(rdev);
|
||||
@ -1233,15 +1229,6 @@ int sumo_dpm_enable(struct radeon_device *rdev)
|
||||
if (pi->enable_boost)
|
||||
sumo_enable_boost_timer(rdev);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
ret = sumo_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret)
|
||||
return ret;
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
}
|
||||
|
||||
sumo_update_current_ps(rdev, rdev->pm.dpm.boot_ps);
|
||||
|
||||
return 0;
|
||||
|
@ -1082,7 +1082,6 @@ void trinity_dpm_enable_bapm(struct radeon_device *rdev, bool enable)
|
||||
int trinity_dpm_enable(struct radeon_device *rdev)
|
||||
{
|
||||
struct trinity_power_info *pi = trinity_get_pi(rdev);
|
||||
int ret;
|
||||
|
||||
trinity_acquire_mutex(rdev);
|
||||
|
||||
@ -1091,7 +1090,6 @@ int trinity_dpm_enable(struct radeon_device *rdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
trinity_enable_clock_power_gating(rdev);
|
||||
trinity_program_bootup_state(rdev);
|
||||
sumo_program_vc(rdev, 0x00C00033);
|
||||
trinity_start_am(rdev);
|
||||
@ -1105,17 +1103,6 @@ int trinity_dpm_enable(struct radeon_device *rdev)
|
||||
trinity_dpm_bapm_enable(rdev, false);
|
||||
trinity_release_mutex(rdev);
|
||||
|
||||
if (rdev->irq.installed &&
|
||||
r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
|
||||
ret = trinity_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
|
||||
if (ret) {
|
||||
trinity_release_mutex(rdev);
|
||||
return ret;
|
||||
}
|
||||
rdev->irq.dpm_thermal = true;
|
||||
radeon_irq_set(rdev);
|
||||
}
|
||||
|
||||
trinity_update_current_ps(rdev, rdev->pm.dpm.boot_ps);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user