From: Guenter Roeck <linux@roeck-us.net>
To: Tim Harvey <tharvey@gateworks.com>
Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
Jean Delvare <jdelvare@suse.com>
Subject: Re: [PATCH] hwmon: (gsc-hwmon) fix fan pwm temperature scaling
Date: Thu, 8 Jun 2023 06:36:14 -0700 [thread overview]
Message-ID: <5acc2640-7bf9-488f-bbca-c35542915a2f@roeck-us.net> (raw)
In-Reply-To: <20230606153004.1448086-1-tharvey@gateworks.com>
On Tue, Jun 06, 2023 at 08:30:04AM -0700, Tim Harvey wrote:
> The GSC fan pwm temperature register is in centidegrees celcius but the
> Linux hwmon convention is to use milidegrees celcius. Fix the scaling.
>
> Fixes: 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/gsc-hwmon.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> index 73e5d92b200b..1501ceb551e7 100644
> --- a/drivers/hwmon/gsc-hwmon.c
> +++ b/drivers/hwmon/gsc-hwmon.c
> @@ -82,8 +82,8 @@ static ssize_t pwm_auto_point_temp_store(struct device *dev,
> if (kstrtol(buf, 10, &temp))
> return -EINVAL;
>
> - temp = clamp_val(temp, 0, 10000);
> - temp = DIV_ROUND_CLOSEST(temp, 10);
> + temp = clamp_val(temp, 0, 100000);
> + temp = DIV_ROUND_CLOSEST(temp, 100);
>
> regs[0] = temp & 0xff;
> regs[1] = (temp >> 8) & 0xff;
> @@ -100,7 +100,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)) / 100);
> + return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)));
> }
>
> static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm_auto_point_pwm, 0);
prev parent reply other threads:[~2023-06-08 13:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 15:30 Tim Harvey
2023-06-08 13:36 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5acc2640-7bf9-488f-bbca-c35542915a2f@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tharvey@gateworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®