Re: [PATCH v3] iio: imu: bmi270: fix zero timestamp in triggered buffer
From: Jonathan Cameron
Date: Sat Nov 28 2026 - 15:21:05 EST
On Tue, 24 Nov 2026 17:10:07 +0800
Liu Yufei <lyf98405@xxxxxxxxx> wrote:
> The BMI270's own trigger uses iio_trigger_poll_nested() from
> the threaded IRQ handler, bypassing the pollfunc top half.
> This leaves the buffer timestamp at zero or a stale value.
>
> Capture the timestamp in the hard IRQ handler and use it when
> the selected trigger is the BMI270's own trigger. For an
> external trigger, take the timestamp in the threaded buffer
> handler before reading the sensor. Drop the pollfunc top half
> now that the buffer handler always supplies the timestamp.
>
> On an Orange Pi Zero 2W, the original driver produced 256 zero
> timestamps in 256 samples with the BMI270's own trigger.
>
> Fixes: a1854d55f54b ("iio: imu: bmi270: add support for data ready interrupt trigger")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Liu Yufei <lyf98405@xxxxxxxxx>
So this got a little messy because the driver was updated (by me)
this cycle to use the iio_push_to_buffers_with_ts() helper.
As such I'm going to apply this the slow way and then we can look at backports
as needed. Applied to the testing branch of iio.git with that conflict
resolved.
Longer term, I'm trying to stop drivers using iio_dev->trig directly but
that can just get swept up in that series. Even longer term I want to
spend some time looking at a generic way of dealing with this timestamp
issue but that's a way off given my backlog of things to sort.
Thanks,
Jonathan