From: Derek Nguyen Date: Thu, 10 Nov 2022 19:21:08 +0000 (-0600) Subject: hwmon: (ltc2947) fix temperature scaling X-Git-Tag: v6.1~47^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07e06193ead86d4812f431b4d87bbd4161222e3f;p=platform%2Fkernel%2Flinux-starfive.git hwmon: (ltc2947) fix temperature scaling The LTC2947 datasheet (Rev. B) calls out in the section "Register Description: Non-Accumulated Result Registers" (pg. 30) that "To calculate temperature, multiply the TEMP register value by 0.204°C and add 5.5°C". Fix to add 5.5C and not 0.55C. Fixes: 9f90fd652bed ("hwmon: Add support for ltc2947") Signed-off-by: Derek Nguyen Signed-off-by: Brandon Maier Link: https://lore.kernel.org/r/20221110192108.20624-1-brandon.maier@collins.com Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/ltc2947-core.c b/drivers/hwmon/ltc2947-core.c index 7404e97..2dbbbac 100644 --- a/drivers/hwmon/ltc2947-core.c +++ b/drivers/hwmon/ltc2947-core.c @@ -396,7 +396,7 @@ static int ltc2947_read_temp(struct device *dev, const u32 attr, long *val, return ret; /* in milidegrees celcius, temp is given by: */ - *val = (__val * 204) + 550; + *val = (__val * 204) + 5500; return 0; }