public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate
@ 2025-10-09 17:36 Francesco Lavra
  2025-10-09 17:36 ` [PATCH 1/2] iio: imu: st_lsm6dsx: Fix measurement unit for odr struct member Francesco Lavra
  2025-10-09 17:36 ` [PATCH 2/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate Francesco Lavra
  0 siblings, 2 replies; 20+ messages in thread
From: Francesco Lavra @ 2025-10-09 17:36 UTC (permalink / raw)
  To: Lorenzo Bianconi, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

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.
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 `bdr`
field in the same struct to implement the new functionality.

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    | 64 ++++++++++++++++---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  9 ++-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  4 +-
 4 files changed, 67 insertions(+), 14 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 20+ messages in thread
* [PATCH v2 0/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate
@ 2025-10-16 17:21 Francesco Lavra
  2025-10-16 17:21 ` [PATCH 2/2] " Francesco Lavra
  0 siblings, 1 reply; 20+ messages in thread
From: Francesco Lavra @ 2025-10-16 17:21 UTC (permalink / raw)
  To: Lorenzo Bianconi, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

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 in v2:
 - 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)

v1: [1]

[1] https://lore.kernel.org/linux-iio/20251009173609.992452-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  |  3 +-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  3 +-
 4 files changed, 70 insertions(+), 11 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-10-18 17:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 17:36 [PATCH 0/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate Francesco Lavra
2025-10-09 17:36 ` [PATCH 1/2] iio: imu: st_lsm6dsx: Fix measurement unit for odr struct member Francesco Lavra
2025-10-09 20:40   ` Lorenzo Bianconi
2025-10-09 17:36 ` [PATCH 2/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate Francesco Lavra
2025-10-09 22:30   ` Lorenzo Bianconi
2025-10-10  7:12     ` Francesco Lavra
2025-10-10  8:13       ` Lorenzo Bianconi
2025-10-10  9:28         ` Francesco Lavra
2025-10-10 13:15           ` Lorenzo Bianconi
2025-10-10 15:50             ` David Lechner
2025-10-10 16:22               ` Lorenzo Bianconi
2025-10-10 16:23                 ` Andy Shevchenko
2025-10-10 18:35                   ` Francesco Lavra
2025-10-10 14:55   ` Andy Shevchenko
2025-10-10 18:44     ` Francesco Lavra
2025-10-15 14:34       ` Andy Shevchenko
2025-10-10 17:44   ` Jonathan Cameron
2025-10-10 18:50     ` Francesco Lavra
  -- strict thread matches above, loose matches on Subject: below --
2025-10-16 17:21 [PATCH v2 0/2] " Francesco Lavra
2025-10-16 17:21 ` [PATCH 2/2] " Francesco Lavra
2025-10-16 20:22   ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox