iio: imu: st_lsm6dsx: fix edge-trigger interrupts
authorLorenzo Bianconi <lorenzo@kernel.org>
Sat, 14 Nov 2020 18:39:05 +0000 (19:39 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Dec 2020 19:40:31 +0000 (19:40 +0000)
commit3f9bce7a22a3f8ac9d885c9d75bc45569f24ac8b
tree991f9a1b3e41dc768af6ed520057e7d4acebe004
parent3418bd7cfce0bd8ef1ccedc4655f9f86f6c3b0ca
iio: imu: st_lsm6dsx: fix edge-trigger interrupts

If we are using edge IRQs, new samples can arrive while processing
current interrupt since there are no hw guarantees the irq line
stays "low" long enough to properly detect the new interrupt.
In this case the new sample will be missed.
Polling FIFO status register in st_lsm6dsx_handler_thread routine
allow us to read new samples even if the interrupt arrives while
processing previous data and the timeslot where the line is "low"
is too short to be properly detected.

Fixes: 89ca88a7cdf2 ("iio: imu: st_lsm6dsx: support active-low interrupts")
Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/5e93cda7dc1e665f5685c53ad8e9ea71dbae782d.1605378871.git.lorenzo@kernel.org
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c