aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2014-09-15 02:15:04 -0400
committerAlex Deucher <alexander.deucher@amd.com>2014-11-20 13:00:10 -0500
commit0e4ed1c1908e48ee66d9e955ce824bc1f34d103e (patch)
tree4f51335567b77e2af114c6e48d06b64c04cbb31c
parente03cea367f992e683435c41344197cd7b223b62c (diff)
drm/radeon/dpm: add thermal dpm support for CI
Not currently used. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/ci_dpm.c27
-rw-r--r--drivers/gpu/drm/radeon/ci_dpm.h1
-rw-r--r--drivers/gpu/drm/radeon/ppsmc.h3
3 files changed, 31 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
717static 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
717static int ci_power_control_set_level(struct radeon_device *rdev) 736static 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) &&
diff --git a/drivers/gpu/drm/radeon/ci_dpm.h b/drivers/gpu/drm/radeon/ci_dpm.h
index bb19fbf3ab8a..84e3d3bcf9f3 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.h
+++ b/drivers/gpu/drm/radeon/ci_dpm.h
@@ -239,6 +239,7 @@ struct ci_power_info {
239 u32 sclk_dpm_key_disabled; 239 u32 sclk_dpm_key_disabled;
240 u32 mclk_dpm_key_disabled; 240 u32 mclk_dpm_key_disabled;
241 u32 pcie_dpm_key_disabled; 241 u32 pcie_dpm_key_disabled;
242 u32 thermal_sclk_dpm_enabled;
242 struct ci_pcie_perf_range pcie_gen_performance; 243 struct ci_pcie_perf_range pcie_gen_performance;
243 struct ci_pcie_perf_range pcie_lane_performance; 244 struct ci_pcie_perf_range pcie_lane_performance;
244 struct ci_pcie_perf_range pcie_gen_powersaving; 245 struct ci_pcie_perf_range pcie_gen_powersaving;
diff --git a/drivers/gpu/drm/radeon/ppsmc.h b/drivers/gpu/drm/radeon/ppsmc.h
index ff698b05bdf5..7e5724a12f8b 100644
--- a/drivers/gpu/drm/radeon/ppsmc.h
+++ b/drivers/gpu/drm/radeon/ppsmc.h
@@ -162,6 +162,9 @@ typedef uint8_t PPSMC_Result;
162#define PPSMC_MSG_Remove_DC_Clamp ((uint16_t) 0x191) 162#define PPSMC_MSG_Remove_DC_Clamp ((uint16_t) 0x191)
163#define PPSMC_MSG_SetFanPwmMax ((uint16_t) 0x19A) 163#define PPSMC_MSG_SetFanPwmMax ((uint16_t) 0x19A)
164 164
165#define PPSMC_MSG_ENABLE_THERMAL_DPM ((uint16_t) 0x19C)
166#define PPSMC_MSG_DISABLE_THERMAL_DPM ((uint16_t) 0x19D)
167
165#define PPSMC_MSG_API_GetSclkFrequency ((uint16_t) 0x200) 168#define PPSMC_MSG_API_GetSclkFrequency ((uint16_t) 0x200)
166#define PPSMC_MSG_API_GetMclkFrequency ((uint16_t) 0x201) 169#define PPSMC_MSG_API_GetMclkFrequency ((uint16_t) 0x201)
167 170