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

Petre Rodan posted 19 patches 2 months, 1 week ago
[PATCH v4 12/19] iio: accel: bma220: populate buffer ts in trigger handler
Posted by Petre Rodan 2 months, 1 week ago
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
Re: [PATCH v4 12/19] iio: accel: bma220: populate buffer ts in trigger handler
Posted by Jonathan Cameron 2 months ago
On Sun, 05 Oct 2025 16:12:21 +0300
Petre Rodan <petre.rodan@subdimension.ro> wrote:

> 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>
I hope that we will at somepoint get the generic code that would make this unnecessary
but it's not there yet so fair enough.

Applied.
Re: [PATCH v4 12/19] iio: accel: bma220: populate buffer ts in trigger handler
Posted by Petre Rodan 2 months ago
Hello Jonathan.

I was a bit worried and I hope you've fully recovered from the flu.

And yes, it also had to restart the rebase multiple times because either I forgot to add bma220.h or I tweaked a few innocent lines in the 4-th patch and they had a ripple effect on everything that followed. Thank you for adding the finishing touches.

> Applied.

I promise to test these out quickly, but please do a push on your testing branch (the last commit I can see is the previous patch).

best regards,
peter