Skip to content

Commit

Permalink
drm/radeon: use 0-255 rather than 0-100 for pwm fan range
Browse files Browse the repository at this point in the history
0-255 seems to be the preferred range for the pwm interface.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Deucher committed Feb 11, 2015
1 parent 85840c7 commit 082452e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpu/drm/radeon/radeon_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ static ssize_t radeon_hwmon_set_pwm1_enable(struct device *dev,
if (err)
return err;

switch(value) {
switch (value) {
case 1: /* manual, percent-based */
rdev->asic->dpm.fan_ctrl_set_mode(rdev, FDO_PWM_MODE_STATIC);
break;
Expand All @@ -608,7 +608,7 @@ static ssize_t radeon_hwmon_get_pwm1_max(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%i\n", 100); /* pwm uses percent-based fan-control */
return sprintf(buf, "%i\n", 255);
}

static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
Expand All @@ -623,6 +623,8 @@ static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
if (err)
return err;

value = (value * 100) / 255;

err = rdev->asic->dpm.set_fan_speed_percent(rdev, value);
if (err)
return err;
Expand All @@ -642,6 +644,8 @@ static ssize_t radeon_hwmon_get_pwm1(struct device *dev,
if (err)
return err;

speed = (speed * 255) / 100;

return sprintf(buf, "%i\n", speed);
}

Expand Down

0 comments on commit 082452e

Please sign in to comment.