summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/si_dpm.c
diff options
context:
space:
mode:
authorOleg Chernovskiy <algonkvel@gmail.com>2015-01-17 21:10:39 +0300
committerAlex Deucher <alexander.deucher@amd.com>2015-01-22 18:38:49 +0300
commit47fd97ca739ee6636da241b796222ca0c2aac8db (patch)
tree676b558e80f5b581c5f21514f78fabea38ed2b0b /drivers/gpu/drm/radeon/si_dpm.c
parent5e8150a6876a2a7784b0029506c90ab3d26c9a41 (diff)
downloadlinux-47fd97ca739ee6636da241b796222ca0c2aac8db.tar.xz
fixes for SI fan handling
Added temperature values to SMC payload. Fan mode check moved check to proper place. Signed-off-by: Oleg Chernovskiy <algonkvel@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/si_dpm.c')
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 3cde272f82b2..80e29448d363 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -5976,6 +5976,10 @@ static int si_thermal_setup_fan_table(struct radeon_device *rdev)
slope1 = (u16)((50 + ((16 * duty100 * pwm_diff1) / t_diff1)) / 100);
slope2 = (u16)((50 + ((16 * duty100 * pwm_diff2) / t_diff2)) / 100);
+ fan_table.temp_min = cpu_to_be16((50 + rdev->pm.dpm.fan.t_min) / 100);
+ fan_table.temp_med = cpu_to_be16((50 + rdev->pm.dpm.fan.t_med) / 100);
+ fan_table.temp_max = cpu_to_be16((50 + rdev->pm.dpm.fan.t_max) / 100);
+
fan_table.slope1 = cpu_to_be16(slope1);
fan_table.slope2 = cpu_to_be16(slope2);
@@ -6045,16 +6049,12 @@ static int si_fan_ctrl_stop_smc_fan_control(struct radeon_device *rdev)
int si_fan_ctrl_get_fan_speed_percent(struct radeon_device *rdev,
u32 *speed)
{
- struct si_power_info *si_pi = si_get_pi(rdev);
u32 duty, duty100;
u64 tmp64;
if (rdev->pm.no_fan)
return -ENOENT;
- if (si_pi->fan_is_controlled_by_smc)
- return -EINVAL;
-
duty100 = (RREG32(CG_FDO_CTRL1) & FMAX_DUTY100_MASK) >> FMAX_DUTY100_SHIFT;
duty = (RREG32(CG_THERMAL_STATUS) & FDO_PWM_DUTY_MASK) >> FDO_PWM_DUTY_SHIFT;
@@ -6074,6 +6074,7 @@ int si_fan_ctrl_get_fan_speed_percent(struct radeon_device *rdev,
int si_fan_ctrl_set_fan_speed_percent(struct radeon_device *rdev,
u32 speed)
{
+ struct si_power_info *si_pi = si_get_pi(rdev);
u32 tmp;
u32 duty, duty100;
u64 tmp64;
@@ -6081,6 +6082,9 @@ int si_fan_ctrl_set_fan_speed_percent(struct radeon_device *rdev,
if (rdev->pm.no_fan)
return -ENOENT;
+ if (si_pi->fan_is_controlled_by_smc)
+ return -EINVAL;
+
if (speed > 100)
return -EINVAL;