Commit 40a7198a authored by Mike Looijmans's avatar Mike Looijmans Committed by Jonathan Cameron

iio/gyro/bmg160: Use millidegrees for temperature scale

Standard unit for temperature is millidegrees Celcius, whereas this driver
was reporting in degrees. Fix the scale factor in the driver.
Signed-off-by: default avatarMike Looijmans <mike.looijmans@topic.nl>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 0a8a29be
...@@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, ...@@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
return bmg160_get_filter(data, val); return bmg160_get_filter(data, val);
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
*val = 0;
switch (chan->type) { switch (chan->type) {
case IIO_TEMP: case IIO_TEMP:
*val2 = 500000; *val = 500;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT;
case IIO_ANGL_VEL: case IIO_ANGL_VEL:
{ {
int i; int i;
...@@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, ...@@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev,
for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) {
if (bmg160_scale_table[i].dps_range == if (bmg160_scale_table[i].dps_range ==
data->dps_range) { data->dps_range) {
*val = 0;
*val2 = bmg160_scale_table[i].scale; *val2 = bmg160_scale_table[i].scale;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment