summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2016-01-21 01:07:31 +0900
committerJonathan Cameron <jic23@kernel.org>2016-01-30 16:07:32 +0000
commit431386e783a3a6c8b7707bee32d18c353b8688b2 (patch)
treef1443db133e55388affeb9f50754e9c74b77af3c /drivers/iio
parentd81dac3c1c5295c61b15293074ac2bd3254e1875 (diff)
downloadop-kernel-dev-431386e783a3a6c8b7707bee32d18c353b8688b2.zip
op-kernel-dev-431386e783a3a6c8b7707bee32d18c353b8688b2.tar.gz
iio: pressure: mpl115: fix temperature offset sign
According to the datasheet, the resolusion of temperature sensor is -5.35 counts/C. Temperature ADC is 472 counts at 25C. (https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf NOTE: This is older revision, but this information is removed from the latest datasheet from nxp somehow) Temp [C] = (Tadc - 472) / -5.35 + 25 = (Tadc - 605.750000) * -0.186915888 So the correct offset is -605.750000. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/pressure/mpl115.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c
index f5ecd6e..a0d7dee 100644
--- a/drivers/iio/pressure/mpl115.c
+++ b/drivers/iio/pressure/mpl115.c
@@ -117,7 +117,7 @@ static int mpl115_read_raw(struct iio_dev *indio_dev,
*val = ret >> 6;
return IIO_VAL_INT;
case IIO_CHAN_INFO_OFFSET:
- *val = 605;
+ *val = -605;
*val2 = 750000;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_SCALE:
OpenPOWER on IntegriCloud