* [PATCH] hwmon: gsc-hwmon: scale temperature to millidegrees
@ 2020-08-27 17:20 Tim Harvey
2020-08-27 19:48 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Tim Harvey @ 2020-08-27 17:20 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck
Cc: Robert Jones, linux-hwmon, linux-kernel, Tim Harvey, stable
The GSC registers report temperature in decidegrees celcius so we
need to scale it to represent the hwmon sysfs API of millidegrees.
Cc: stable@vger.kernel.org
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
drivers/hwmon/gsc-hwmon.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
index 3dfe2ca..c6d4567 100644
--- a/drivers/hwmon/gsc-hwmon.c
+++ b/drivers/hwmon/gsc-hwmon.c
@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
case mode_temperature:
if (tmp > 0x8000)
tmp -= 0xffff;
+ tmp *= 100; /* convert to millidegrees celsius */
break;
case mode_voltage_raw:
tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: gsc-hwmon: scale temperature to millidegrees
2020-08-27 17:20 [PATCH] hwmon: gsc-hwmon: scale temperature to millidegrees Tim Harvey
@ 2020-08-27 19:48 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-08-27 19:48 UTC (permalink / raw)
To: Tim Harvey; +Cc: Jean Delvare, Robert Jones, linux-hwmon, linux-kernel, stable
On Thu, Aug 27, 2020 at 10:20:24AM -0700, Tim Harvey wrote:
> The GSC registers report temperature in decidegrees celcius so we
> need to scale it to represent the hwmon sysfs API of millidegrees.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/gsc-hwmon.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> index 3dfe2ca..c6d4567 100644
> --- a/drivers/hwmon/gsc-hwmon.c
> +++ b/drivers/hwmon/gsc-hwmon.c
> @@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
> case mode_temperature:
> if (tmp > 0x8000)
> tmp -= 0xffff;
> + tmp *= 100; /* convert to millidegrees celsius */
> break;
> case mode_voltage_raw:
> tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-27 19:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 17:20 [PATCH] hwmon: gsc-hwmon: scale temperature to millidegrees Tim Harvey
2020-08-27 19:48 ` 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).