[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251017164255.1251060-1-flavra@baylibre.com>
Date: Fri, 17 Oct 2025 18:42:53 +0200
From: Francesco Lavra <flavra@...libre.com>
To: Lorenzo Bianconi <lorenzo@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 0/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate
The rate at which accelerometer or gyroscope sensor samples are fed
to the hardware FIFO (batch data rate, or BDR) does not have to
coincide with the sensor sampling frequency (output data rate, or
ODR); the only requirement is for the BDR to not be greater than
the ODR. Having a BDR lower than the ODR is useful in cases where
an application requires a high sampling rate for accurate detection
of motion events (e.g. wakeup events), but wants to read sensor
sample values from the device buffer at a lower data rate (e.g. to
minimize the amount of I2C or SPI traffic and the rate of periodic
interrupts).
This change set amends the st_lsm6dsx IIO driver to support the above
use case. The first commit is a trivial fix to the source code comment
that indicates what measurement unit is used for the `odr` field of
struct st_lsm6ds_sensor, while the second commit introduces a new
`hwfifo_odr_mHz` field in the same struct to implement the new functionality.
Changes from v2 [2]:
- fixed Fixes tag in patch 1/2
- removed local variable from st_lsm6dsx_hwfifo_odr_show() (Lorenzo)
- replaced multi-assignments with on assignment per line (Lorenzo)
- added Acked-by tags to patches 1/2 and 2/2 (Lorenzo)
Changes from v1 [1]:
- added Fixes tag to patch 1/2 (Lorenzo)
- in sysfs store handler, moved iio_device_claim_direct() call to beginning
of function (Lorenzo)
- changed new struct st_lsm6dsx_sensor field name from `bdr` to
`hwfifo_odr_mHz` (Lorenzo, David)
- replaced min_t() and max_t() calls with min() and max() (Andy)
- added setting of buffer frequency equal to main frequency whenever the
latter is updated via sysfs (Jonathan)
- miscellaneous stylistic modifications (Lorenzo, Andy, Jonathan)
[1] https://lore.kernel.org/linux-iio/20251009173609.992452-1-flavra@baylibre.com/T/#u
[2] https://lore.kernel.org/linux-iio/20251016172122.1220332-1-flavra@baylibre.com/T/#u
Francesco Lavra (2):
iio: imu: st_lsm6dsx: Fix measurement unit for odr struct member
iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 4 +-
.../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 71 ++++++++++++++++---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 7 +-
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 2 +
4 files changed, 73 insertions(+), 11 deletions(-)
--
2.39.5
Powered by blists - more mailing lists