[PATCH v4 12/19] iio: accel: bma220: populate buffer ts in trigger handler

Petre Rodan
2025-10-05T13:13:10Z

Populate buffer timestamps in trigger handler since not all
triggers can run the top half handler that provides
pf->timestamp.

Fixes failing unit test that triggers based on the INT signal.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
---
v2->v3 split out from bigger patch (Jonathan)
v4 more verbose commit msg (Jonathan)
---
drivers/iio/accel/bma220_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/bma220_core.c b/drivers/iio/accel/bma220_core.c
index 7b1e87c6932a3a6698651e528fb8182c03a2432e..ec7409db83f81882043653cd70e3205500348994 100644
--- a/drivers/iio/accel/bma220_core.c
+++ b/drivers/iio/accel/bma220_core.c
@@ -186,7 +186,7 @@ static irqreturn_t bma220_trigger_handler(int irq, void *p)
return IRQ_NONE;

iio_push_to_buffers_with_ts(indio_dev, &data->scan, sizeof(data->scan),
- pf->timestamp);
+ iio_get_time_ns(indio_dev));
iio_trigger_notify_done(indio_dev->trig);

return IRQ_HANDLED;
@@ -404,8 +404,7 @@ int bma220_common_probe(struct device *dev, struct regmap *regmap, int irq)
if (ret)
return ret;

- ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
- iio_pollfunc_store_time,
+ ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
bma220_trigger_handler, NULL);
if (ret < 0)
dev_err_probe(dev, ret, "iio triggered buffer setup failed\n");

--
2.49.1