diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/ci_dpm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/ci_dpm.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 4581d6cf90e8..83121403ce3b 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -714,6 +714,25 @@ static int ci_enable_smc_cac(struct radeon_device *rdev, bool enable) | |||
714 | return ret; | 714 | return ret; |
715 | } | 715 | } |
716 | 716 | ||
717 | static int ci_enable_thermal_based_sclk_dpm(struct radeon_device *rdev, | ||
718 | bool enable) | ||
719 | { | ||
720 | struct ci_power_info *pi = ci_get_pi(rdev); | ||
721 | PPSMC_Result smc_result = PPSMC_Result_OK; | ||
722 | |||
723 | if (pi->thermal_sclk_dpm_enabled) { | ||
724 | if (enable) | ||
725 | smc_result = ci_send_msg_to_smc(rdev, PPSMC_MSG_ENABLE_THERMAL_DPM); | ||
726 | else | ||
727 | smc_result = ci_send_msg_to_smc(rdev, PPSMC_MSG_DISABLE_THERMAL_DPM); | ||
728 | } | ||
729 | |||
730 | if (smc_result == PPSMC_Result_OK) | ||
731 | return 0; | ||
732 | else | ||
733 | return -EINVAL; | ||
734 | } | ||
735 | |||
717 | static int ci_power_control_set_level(struct radeon_device *rdev) | 736 | static int ci_power_control_set_level(struct radeon_device *rdev) |
718 | { | 737 | { |
719 | struct ci_power_info *pi = ci_get_pi(rdev); | 738 | struct ci_power_info *pi = ci_get_pi(rdev); |
@@ -5177,6 +5196,12 @@ int ci_dpm_enable(struct radeon_device *rdev) | |||
5177 | 5196 | ||
5178 | ci_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true); | 5197 | ci_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true); |
5179 | 5198 | ||
5199 | ret = ci_enable_thermal_based_sclk_dpm(rdev, true); | ||
5200 | if (ret) { | ||
5201 | DRM_ERROR("ci_enable_thermal_based_sclk_dpm failed\n"); | ||
5202 | return ret; | ||
5203 | } | ||
5204 | |||
5180 | ci_thermal_start_thermal_controller(rdev); | 5205 | ci_thermal_start_thermal_controller(rdev); |
5181 | 5206 | ||
5182 | ci_update_current_ps(rdev, boot_ps); | 5207 | ci_update_current_ps(rdev, boot_ps); |
@@ -5240,6 +5265,7 @@ void ci_dpm_disable(struct radeon_device *rdev) | |||
5240 | ci_reset_to_default(rdev); | 5265 | ci_reset_to_default(rdev); |
5241 | ci_dpm_stop_smc(rdev); | 5266 | ci_dpm_stop_smc(rdev); |
5242 | ci_force_switch_to_arb_f0(rdev); | 5267 | ci_force_switch_to_arb_f0(rdev); |
5268 | ci_enable_thermal_based_sclk_dpm(rdev, false); | ||
5243 | 5269 | ||
5244 | ci_update_current_ps(rdev, boot_ps); | 5270 | ci_update_current_ps(rdev, boot_ps); |
5245 | } | 5271 | } |
@@ -5639,6 +5665,7 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5639 | pi->sclk_dpm_key_disabled = 0; | 5665 | pi->sclk_dpm_key_disabled = 0; |
5640 | pi->mclk_dpm_key_disabled = 0; | 5666 | pi->mclk_dpm_key_disabled = 0; |
5641 | pi->pcie_dpm_key_disabled = 0; | 5667 | pi->pcie_dpm_key_disabled = 0; |
5668 | pi->thermal_sclk_dpm_enabled = 0; | ||
5642 | 5669 | ||
5643 | /* mclk dpm is unstable on some R7 260X cards with the old mc ucode */ | 5670 | /* mclk dpm is unstable on some R7 260X cards with the old mc ucode */ |
5644 | if ((rdev->pdev->device == 0x6658) && | 5671 | if ((rdev->pdev->device == 0x6658) && |