public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Francesco Lavra" <flavra@baylibre.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate
Date: Fri, 10 Oct 2025 18:22:08 +0200	[thread overview]
Message-ID: <aOkysKyWX2hYEnED@lore-desk> (raw)
In-Reply-To: <007e87d2-92f5-417a-a6bf-1babd4c60c61@baylibre.com>

[-- Attachment #1: Type: text/plain, Size: 2456 bytes --]

On Oct 10, David Lechner wrote:
> On 10/10/25 8:15 AM, Lorenzo Bianconi wrote:
> > On Oct 10, Francesco Lavra wrote:
> >> On Fri, 2025-10-10 at 10:13 +0200, Lorenzo Bianconi wrote:
> >>>> On Fri, 2025-10-10 at 00:30 +0200, Lorenzo Bianconi wrote:
> >>>>>> 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.
> >>>>>
> >>>>> can you please provide more details here? Are you using the hw fifo
> >>>>> to
> >>>>> read
> >>>>> data? If we configure the hw fifo according to the BDR (even assuming
> >>>>> the
> >>>>> watermark is set 1) the hw will generate interrupts according to the
> >>>>> BDR
> >>>>> (bdr < odr).
> >>>>
> >>>> Yes, I'm using the hw fifo to read data. The use case is to enable
> >>>> event
> >>>> detection (which works best at high sampling rates) and sensor data
> >>>> streaming at the same time, without requiring the data stream to be at
> >>>> the
> >>>> same rate as the sensor sampling rate. So the amount of I2C (or SPI)
> >>>> traffic (as well as the rate of periodic interrupts) required by the
> >>>> data
> >>>> stream is kept to a minimum without sacrificing the accuracy of event
> >>>> detection.
> >>>
> >>> I guess you can get the same result (reduce sensor data interrupt rate
> >>> keeping high odr value) configuring the hw fifo watermark.
> >>> Does it work for you?
> >>
> >> Setting the hw fifo watermark to a high value reduces the rate of
> >> interrupts, but doesn't do much to reduce the amount of I2C traffic, so the
> >> issue would still be there.
> > 
> > ack, now I got the goal of the series. I think the series is mostly fine.
> > I guess hwfifo_odr instead of bdr is more meaningful, what do you think?
> > Naming is always hard.
> > 
> > Regards,
> > Lorenzo
> 
> In the IIO subsystem, we prefer to include the units in the variable/
> field name as well, e.g. hw_fifo_odr_mHz.

ack, but please avoid camel case :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-10-10 16:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aOkysKyWX2hYEnED@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=flavra@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox