Skip to content

iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate

Francesco Lavra linux-iio lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v22 patches 3 repliesSuperseded
  3. v12 patches 15 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iio: imu: st_lsm6dsx: Fix measurement unit for odr struct memberdrivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h+1 -10 replies
2/2iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data ratedrivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +1 more+72 -100 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchLorenzo Bianconi
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [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/[email protected]/T/#u
[2] https://lore.kernel.org/linux-iio/[email protected]/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(-)
Signature · 1 line
2.39.5