* [PATCH] hwmon: (gsc-hwmon) fix fan pwm setpoint show functions
@ 2025-07-18 20:02 Tim Harvey
2025-07-19 21:58 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Tim Harvey @ 2025-07-18 20:02 UTC (permalink / raw)
To: Guenter Roeck, Jean Delvare; +Cc: linux-hwmon, linux-kernel, stable, Tim Harvey
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>
---
drivers/hwmon/gsc-hwmon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
index 0f9af82cebec..105b9f9dbec3 100644
--- a/drivers/hwmon/gsc-hwmon.c
+++ b/drivers/hwmon/gsc-hwmon.c
@@ -64,7 +64,7 @@ static ssize_t pwm_auto_point_temp_show(struct device *dev,
return ret;
ret = regs[0] | regs[1] << 8;
- return sprintf(buf, "%d\n", ret * 10);
+ return sprintf(buf, "%d\n", ret * 100);
}
static ssize_t pwm_auto_point_temp_store(struct device *dev,
@@ -99,7 +99,7 @@ static ssize_t pwm_auto_point_pwm_show(struct device *dev,
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)));
+ return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)) / 100);
}
static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm_auto_point_pwm, 0);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (gsc-hwmon) fix fan pwm setpoint show functions
2025-07-18 20:02 [PATCH] hwmon: (gsc-hwmon) fix fan pwm setpoint show functions Tim Harvey
@ 2025-07-19 21:58 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2025-07-19 21:58 UTC (permalink / raw)
To: Tim Harvey; +Cc: Jean Delvare, linux-hwmon, linux-kernel, stable
On Fri, Jul 18, 2025 at 01:02:59PM -0700, Tim Harvey wrote:
> 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>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-19 21:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 20:02 [PATCH] hwmon: (gsc-hwmon) fix fan pwm setpoint show functions Tim Harvey
2025-07-19 21:58 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).