linux/drivers/iio
Vasileios Amoiridis 59a84bcf1c iio: chemical: bme680: Fix sensor data read operation
commit 4241665e6e upstream.

A read operation is happening as follows:

a) Set sensor to forced mode
b) Sensor measures values and update data registers and sleeps again
c) Read data registers

In the current implementation the read operation happens immediately
after the sensor is set to forced mode so the sensor does not have
the time to update properly the registers. This leads to the following
2 problems:

1) The first ever value which is read by the register is always wrong
2) Every read operation, puts the register into forced mode and reads
the data that were calculated in the previous conversion.

This behaviour was tested in 2 ways:

1) The internal meas_status_0 register was read before and after every
read operation in order to verify that the data were ready even before
the register was set to forced mode and also to check that after the
forced mode was set the new data were not yet ready.

2) Physically changing the temperature and measuring the temperature

This commit adds the waiting time in between the set of the forced mode
and the read of the data. The function is taken from the Bosch BME68x
Sensor API [1].

[1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L490

Fixes: 1b3bd85927 ("iio: chemical: Add support for Bosch BME680 sensor")
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240606212313.207550-5-vassilisamir@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-05 09:12:52 +02:00
..
accel iio: accel: mxc4005: Interrupt handling fixes 2024-05-17 11:48:09 +02:00
adc iio: adc: ad7266: Fix variable checking bug 2024-07-05 09:12:52 +02:00
addac iio: add addac subdirectory 2023-08-26 15:26:47 +02:00
afe iio: afe: rescale: use s64 for temporary scale calculations 2022-04-08 14:39:49 +02:00
amplifiers
buffer
chemical iio: chemical: bme680: Fix sensor data read operation 2024-07-05 09:12:52 +02:00
common iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table 2024-01-05 15:12:26 +01:00
dac iio: dac: ad5592r: fix temperature channel scaling value 2024-07-05 09:12:29 +02:00
dummy iio: dummy: iio_simple_dummy: check the return value of kstrdup() 2022-06-14 18:32:41 +02:00
frequency
gyro iio:imu:adis: Move exports into IIO_ADISLIB namespace 2023-01-14 10:15:58 +01:00
health iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw 2022-12-08 11:23:54 +01:00
humidity
imu iio: imu: inv_icm42600: delete unneeded update watermark call 2024-07-05 09:12:29 +02:00
light iio: light: vcnl4035: fixed chip ID check 2023-06-09 10:30:13 +02:00
magnetometer iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC 2024-02-23 08:42:27 +01:00
multiplexer
orientation
position
potentiometer
potentiostat
pressure iio: pressure: dps310: support negative temperature values 2024-06-16 13:32:18 +02:00
proximity iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeout 2022-06-14 18:32:32 +02:00
resolver
temperature iio: temperature: ltc2983: make bulk write buffer DMA-safe 2023-01-14 10:15:57 +01:00
trigger iio: trigger: sysfs: fix possible memory leak in iio_sysfs_trig_init() 2022-11-25 17:45:51 +01:00
iio_core_trigger.h
iio_core.h
industrialio-buffer.c
industrialio-configfs.c
industrialio-core.c
industrialio-event.c
industrialio-sw-device.c
industrialio-sw-trigger.c iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails 2022-12-02 17:40:02 +01:00
industrialio-trigger.c
industrialio-triggered-event.c
inkern.c iio: inkern: only release the device node when done with it 2022-10-26 13:25:30 +02:00
Kconfig iio: add addac subdirectory 2023-08-26 15:26:47 +02:00
Makefile iio: add addac subdirectory 2023-08-26 15:26:47 +02:00
TODO