Skip to content

Commit e26bd46

Browse files
Gateworksgregkh
authored andcommitted
hwmon: (gsc-hwmon) fix fan pwm setpoint show functions
commit 9c62e22 upstream. The Linux hwmon sysfs API values for pwmX_auto_pointY_pwm represent an integer value between 0 (0%) to 255 (100%) and the pwmX_auto_pointY_temp represent millidegrees Celcius. Commit a6d80df ("hwmon: (gsc-hwmon) fix fan pwm temperature scaling") properly addressed the incorrect scaling in the pwm_auto_point_temp_store implementation but erroneously scaled the pwm_auto_point_pwm_show (pwm value) instead of the pwm_auto_point_temp_show (temp value) resulting in: # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_pwm 25500 # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_temp 4500 Fix the scaling of these attributes: # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_pwm 255 # cat /sys/class/hwmon/hwmon0/pwm1_auto_point6_temp 45000 Fixes: a6d80df ("hwmon: (gsc-hwmon) fix fan pwm temperature scaling") Cc: [email protected] Signed-off-by: Tim Harvey <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dbe8b43 commit e26bd46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/gsc-hwmon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static ssize_t pwm_auto_point_temp_show(struct device *dev,
6565
return ret;
6666

6767
ret = regs[0] | regs[1] << 8;
68-
return sprintf(buf, "%d\n", ret * 10);
68+
return sprintf(buf, "%d\n", ret * 100);
6969
}
7070

7171
static ssize_t pwm_auto_point_temp_store(struct device *dev,
@@ -100,7 +100,7 @@ static ssize_t pwm_auto_point_pwm_show(struct device *dev,
100100
{
101101
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
102102

103-
return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)));
103+
return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)) / 100);
104104
}
105105

106106
static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm_auto_point_pwm, 0);

0 commit comments

Comments
 (0)