]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/iio-gyro-bmg160-use-millidegrees-for-temperature-scale.patch
f8b7a9b78f4d8bf4687bed7dbd85a4a4d8937c8d
[thirdparty/kernel/stable-queue.git] / queue-4.19 / iio-gyro-bmg160-use-millidegrees-for-temperature-scale.patch
1 From 40a7198a4a01037003c7ca714f0d048a61e729ac Mon Sep 17 00:00:00 2001
2 From: Mike Looijmans <mike.looijmans@topic.nl>
3 Date: Wed, 13 Feb 2019 08:41:47 +0100
4 Subject: iio/gyro/bmg160: Use millidegrees for temperature scale
5
6 From: Mike Looijmans <mike.looijmans@topic.nl>
7
8 commit 40a7198a4a01037003c7ca714f0d048a61e729ac upstream.
9
10 Standard unit for temperature is millidegrees Celcius, whereas this driver
11 was reporting in degrees. Fix the scale factor in the driver.
12
13 Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
14 Cc: <Stable@vger.kernel.org>
15 Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 drivers/iio/gyro/bmg160_core.c | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22 --- a/drivers/iio/gyro/bmg160_core.c
23 +++ b/drivers/iio/gyro/bmg160_core.c
24 @@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_de
25 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
26 return bmg160_get_filter(data, val);
27 case IIO_CHAN_INFO_SCALE:
28 - *val = 0;
29 switch (chan->type) {
30 case IIO_TEMP:
31 - *val2 = 500000;
32 - return IIO_VAL_INT_PLUS_MICRO;
33 + *val = 500;
34 + return IIO_VAL_INT;
35 case IIO_ANGL_VEL:
36 {
37 int i;
38 @@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_de
39 for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) {
40 if (bmg160_scale_table[i].dps_range ==
41 data->dps_range) {
42 + *val = 0;
43 *val2 = bmg160_scale_table[i].scale;
44 return IIO_VAL_INT_PLUS_MICRO;
45 }