]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: imu: st_lsm6dsx: Fix check for invalid samples from FIFO
authorFrancesco Lavra <flavra@baylibre.com>
Tue, 24 Mar 2026 08:47:33 +0000 (09:47 +0100)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Apr 2026 08:58:16 +0000 (09:58 +0100)
commit7216b9f7e9fe34a1623cceee920caede8929078e
tree578633128ad8bbd110581cf73cde427c8c3caddd
parent5c2290c054f0746f34934540e7cb5160278f7e2b
iio: imu: st_lsm6dsx: Fix check for invalid samples from FIFO

The DRDY_MASK feature implemented in sensor chips marks gyroscope and
accelerometer invalid samples (i.e. samples that have been acquired during
the settling time of sensor filters) with the special values 0x7FFFh,
0x7FFE, and 0x7FFD.
The driver checks FIFO samples against these special values in order to
discard invalid samples; however, it does the check regardless of the type
of samples being processed, whereas this feature is specific to gyroscope
and accelerometer data. This could cause valid samples to be discarded.

Fix the above check so that it takes into account the type of samples being
processed. To avoid casting to __le16 * when checking sample values, clean
up the type representation for data read from the FIFO.

Fixes: 960506ed2c69 ("iio: imu: st_lsm6dsx: enable drdy-mask if available")
Signed-off-by: Francesco Lavra <flavra@baylibre.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c