Skip to content

Commit 13399ff

Browse files
tduszynskijic23
authored andcommitted
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: Tomasz Duszynski <[email protected]> Fixes: 14beaa8 ("iio: pressure: bmp280: add humidity support") Acked-by: Matt Ranostay <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent ce397d2 commit 13399ff

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/iio/pressure/bmp280-core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,9 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2)
415415
}
416416
comp_humidity = bmp280_compensate_humidity(data, adc_humidity);
417417

418-
*val = comp_humidity;
419-
*val2 = 1024;
418+
*val = comp_humidity * 1000 / 1024;
420419

421-
return IIO_VAL_FRACTIONAL;
420+
return IIO_VAL_INT;
422421
}
423422

424423
static int bmp280_read_raw(struct iio_dev *indio_dev,

0 commit comments

Comments
 (0)