Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hwmon: (gsc-hwmon) fix fan pwm setpoint show functions

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 a6d80df47ee2 ("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: a6d80df47ee2 ("hwmon: (gsc-hwmon) fix fan pwm temperature scaling")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Link: https://lore.kernel.org/r/20250718200259.1840792-1-tharvey@gateworks.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Tim Harvey and committed by
Guenter Roeck
9c62e228 89be9a83

+2 -2
+2 -2
drivers/hwmon/gsc-hwmon.c
··· 64 64 return ret; 65 65 66 66 ret = regs[0] | regs[1] << 8; 67 - return sprintf(buf, "%d\n", ret * 10); 67 + return sprintf(buf, "%d\n", ret * 100); 68 68 } 69 69 70 70 static ssize_t pwm_auto_point_temp_store(struct device *dev, ··· 99 99 { 100 100 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 101 101 102 - return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10))); 102 + return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)) / 100); 103 103 } 104 104 105 105 static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm_auto_point_pwm, 0);