[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240430131330.1555849-1-marc.ferland@sonatest.com>
Date: Tue, 30 Apr 2024 09:13:30 -0400
From: marc.ferland@...il.com
To: lars@...afoo.de
Cc: Michael.Hennerich@...log.com,
jic23@...nel.org,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Marc Ferland <marc.ferland@...atest.com>
Subject: [PATCH] iio: dac: ad5592r: fix temperature scale
From: Marc Ferland <marc.ferland@...atest.com>
For temperature readings, the remainder is returned as nano Celsius
_but_ we mark it as IIO_VAL_INT_PLUS_MICRO. This results in incorrect
temperature reporting through hwmon for example. I have a board here
which reports the following when running 'sensors':
iio_hwmon-isa-0000
Adapter: ISA adapter
temp1: +93.3°C
With the patch applied, it returns the correct temperature:
iio_hwmon-isa-0000
Adapter: ISA adapter
temp1: +30.5°C
Signed-off-by: Marc Ferland <marc.ferland@...atest.com>
---
drivers/iio/dac/ad5592r-base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
index 076bc9ecfb49..4763402dbcd6 100644
--- a/drivers/iio/dac/ad5592r-base.c
+++ b/drivers/iio/dac/ad5592r-base.c
@@ -415,7 +415,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
s64 tmp = *val * (3767897513LL / 25LL);
*val = div_s64_rem(tmp, 1000000000LL, val2);
- return IIO_VAL_INT_PLUS_MICRO;
+ return IIO_VAL_INT_PLUS_NANO;
}
mutex_lock(&st->lock);
base-commit: 98369dccd2f8e16bf4c6621053af7aa4821dcf8e
--
2.34.1
Powered by blists - more mailing lists