Re: [PATCH] iio: imu: bmi270: fix zero timestamp in triggered buffer
From: Jonathan Cameron
Date: Sun Nov 01 2026 - 13:10:39 EST
On Thu, 29 Oct 2026 15:19:05 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Wed, Oct 28, 2026 at 10:24:11PM +0800, Liu Yufei wrote:
> > On Wed, Oct 28, 2026 at 10:58:25AM +0200, Andy Shevchenko wrote:
> > > On Wed, Oct 28, 2026 at 10:59:26AM +0800, Liu Yufei wrote:
>
> ...
>
> > > > + s64 timestamp = iio_get_time_ns(indio_dev);
> > >
> > > Do we need this variable? Why not call it directly?
> >
> > The intent was to capture the timestamp before the bus read, so it is
> > as close as possible to the data ready event rather than after the
> > regmap_bulk_read() over I2C/SPI.
> >
> > If that difference is not considered significant here, I'm happy to
> > call it directly in v2.
>
> But the time of the event in the kernel should be ideally with data we get,
> not in the past, right?
>
> Jonathan, what our expectations / requirements on the timestamp capture?
>
As close to data capture as possible. For drivers with a dataready
we grab early in the interrupt handling. Where it is being driven by
something else (such as polling elsewhere that didn't grab a timestamp)
we grab at time of read as that's the best we can do.
Jonathan