summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Looijmans <mike.looijmans@topic.nl>2019-02-13 08:41:47 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-27 09:34:01 +0200
commite20204c43c0bc2c3f793f7d5c20716748a0db0c7 (patch)
tree104a786c2189b0d12d215891e54dd92351f973d9
parenteaa303a2d65d52260fa8e0ad0a356ac3f0b7568e (diff)
downloadlinux-stable-e20204c43c0bc2c3f793f7d5c20716748a0db0c7.tar.gz
linux-stable-e20204c43c0bc2c3f793f7d5c20716748a0db0c7.tar.bz2
linux-stable-e20204c43c0bc2c3f793f7d5c20716748a0db0c7.zip
iio/gyro/bmg160: Use millidegrees for temperature scale
commit 40a7198a4a01037003c7ca714f0d048a61e729ac upstream. Standard unit for temperature is millidegrees Celcius, whereas this driver was reporting in degrees. Fix the scale factor in the driver. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/gyro/bmg160_core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
index 90841abd3ce4..a4dc6a3783d0 100644
--- a/drivers/iio/gyro/bmg160_core.c
+++ b/drivers/iio/gyro/bmg160_core.c
@@ -519,11 +519,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev,
} else
return -EINVAL;
case IIO_CHAN_INFO_SCALE:
- *val = 0;
switch (chan->type) {
case IIO_TEMP:
- *val2 = 500000;
- return IIO_VAL_INT_PLUS_MICRO;
+ *val = 500;
+ return IIO_VAL_INT;
case IIO_ANGL_VEL:
{
int i;
@@ -531,6 +530,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev,
for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) {
if (bmg160_scale_table[i].dps_range ==
data->dps_range) {
+ *val = 0;
*val2 = bmg160_scale_table[i].scale;
return IIO_VAL_INT_PLUS_MICRO;
}