[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1598548824-16898-1-git-send-email-tharvey@gateworks.com>
Date: Thu, 27 Aug 2020 10:20:24 -0700
From: Tim Harvey <tharvey@...eworks.com>
To: Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>
Cc: Robert Jones <rjones@...eworks.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org, Tim Harvey <tharvey@...eworks.com>,
stable@...r.kernel.org
Subject: [PATCH] hwmon: gsc-hwmon: scale temperature to millidegrees
The GSC registers report temperature in decidegrees celcius so we
need to scale it to represent the hwmon sysfs API of millidegrees.
Cc: stable@...r.kernel.org
Signed-off-by: Tim Harvey <tharvey@...eworks.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
Powered by blists - more mailing lists