Commit 13399ff2 authored by Tomasz Duszynski's avatar Tomasz Duszynski Committed by Jonathan Cameron

iio: pressure: bmp280: fix relative humidity unit

According to IIO ABI relative humidity reading should be
returned in milli percent.

This patch addresses that by applying proper scaling and
returning integer instead of fractional format type specifier.

Note that the fixes tag is before the driver was heavily refactored
to introduce spi support, so the patch won't apply that far back.
Signed-off-by: default avatarTomasz Duszynski <tduszyns@gmail.com>
Fixes: 14beaa8f ("iio: pressure: bmp280: add humidity support")
Acked-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent ce397d21
......@@ -415,10 +415,9 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2)
}
comp_humidity = bmp280_compensate_humidity(data, adc_humidity);
*val = comp_humidity;
*val2 = 1024;
*val = comp_humidity * 1000 / 1024;
return IIO_VAL_FRACTIONAL;
return IIO_VAL_INT;
}
static int bmp280_read_raw(struct iio_dev *indio_dev,
......
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