iio: bmp280: properly initialize device for humidity reading
authorAndreas Klinger <ak@it-klinger.de>
Tue, 25 Jul 2017 09:11:14 +0000 (11:11 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 30 Jul 2017 13:41:12 +0000 (14:41 +0100)
commiteb92b4183d93a6f101a6bd3aaae651de404c119a
tree764cfc1057925e126774dc1c053c4fc1dfaad5da
parent055655a9f0fefef2256310a128a4cdaff8b8c432
iio: bmp280: properly initialize device for humidity reading

If the device is not initialized at least once it happens that the humidity
reading is skipped, which means the special value 0x8000 is delivered.

For omitting this case the oversampling of the humidity must be set before
the oversampling of the temperature und pressure is set as written in the
datasheet of the BME280.

Furthermore proper error detection is added in case a skipped value is read
from the device. This is done also for pressure and temperature reading.
Especially it don't make sense to compensate this value and treat it as
regular value.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/pressure/bmp280-core.c
drivers/iio/pressure/bmp280.h