Commit 082452e1 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: use 0-255 rather than 0-100 for pwm fan range

0-255 seems to be the preferred range for the pwm interface.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 85840c76
...@@ -585,7 +585,7 @@ static ssize_t radeon_hwmon_set_pwm1_enable(struct device *dev, ...@@ -585,7 +585,7 @@ static ssize_t radeon_hwmon_set_pwm1_enable(struct device *dev,
if (err) if (err)
return err; return err;
switch(value) { switch (value) {
case 1: /* manual, percent-based */ case 1: /* manual, percent-based */
rdev->asic->dpm.fan_ctrl_set_mode(rdev, FDO_PWM_MODE_STATIC); rdev->asic->dpm.fan_ctrl_set_mode(rdev, FDO_PWM_MODE_STATIC);
break; break;
...@@ -608,7 +608,7 @@ static ssize_t radeon_hwmon_get_pwm1_max(struct device *dev, ...@@ -608,7 +608,7 @@ static ssize_t radeon_hwmon_get_pwm1_max(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) 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, static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
...@@ -623,6 +623,8 @@ static ssize_t radeon_hwmon_set_pwm1(struct device *dev, ...@@ -623,6 +623,8 @@ static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
if (err) if (err)
return err; return err;
value = (value * 100) / 255;
err = rdev->asic->dpm.set_fan_speed_percent(rdev, value); err = rdev->asic->dpm.set_fan_speed_percent(rdev, value);
if (err) if (err)
return err; return err;
...@@ -642,6 +644,8 @@ static ssize_t radeon_hwmon_get_pwm1(struct device *dev, ...@@ -642,6 +644,8 @@ static ssize_t radeon_hwmon_get_pwm1(struct device *dev,
if (err) if (err)
return err; return err;
speed = (speed * 255) / 100;
return sprintf(buf, "%i\n", speed); return sprintf(buf, "%i\n", speed);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment