linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: bmi160: snap timestamp closer to event
@ 2018-11-19  0:53 Martin Kelly
  2018-11-19  0:53 ` [PATCH 2/2] iio: bmi160: use all devm functions in probe Martin Kelly
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Martin Kelly @ 2018-11-19  0:53 UTC (permalink / raw)
  To: linux-iio; +Cc: Daniel Baluta, Jonathan Cameron, Martin Kelly

From: Martin Kelly <martin@martingkelly.com>

Currently, we snap the timestamp after reading from the buffer and
processing the event. Technically, we can get a slightly more accurate
timestamp by snapping it prior to reading the data, since the data was
already generated prior to entering the trigger handler. This is not going
to make a huge difference, but we might as well improve slightly.

Signed-off-by: Martin Kelly <martin@martingkelly.com>
---
 drivers/iio/imu/bmi160/bmi160_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index c85659ca9507..4d9d59d9e3a9 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -384,6 +384,7 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
 {
 	struct iio_poll_func *pf = p;
 	struct iio_dev *indio_dev = pf->indio_dev;
+	s64 ts = iio_get_time_ns(indio_dev);
 	struct bmi160_data *data = iio_priv(indio_dev);
 	__le16 buf[16];
 	/* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */
@@ -399,8 +400,7 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
 		buf[j++] = sample;
 	}
 
-	iio_push_to_buffers_with_timestamp(indio_dev, buf,
-					   iio_get_time_ns(indio_dev));
+	iio_push_to_buffers_with_timestamp(indio_dev, buf, ts);
 done:
 	iio_trigger_notify_done(indio_dev->trig);
 	return IRQ_HANDLED;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-12-02  2:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-19  0:53 [PATCH 1/2] iio: bmi160: snap timestamp closer to event Martin Kelly
2018-11-19  0:53 ` [PATCH 2/2] iio: bmi160: use all devm functions in probe Martin Kelly
2018-11-19  8:48   ` Daniel Baluta
2018-11-25 13:51     ` Jonathan Cameron
2018-11-26 23:45       ` Martin Kelly
2018-11-19  8:45 ` [PATCH 1/2] iio: bmi160: snap timestamp closer to event Daniel Baluta
2018-11-20  3:45   ` Martin Kelly
2018-11-20  3:45   ` Martin Kelly
2018-11-25 13:59 ` Jonathan Cameron
2018-11-26 23:43   ` Martin Kelly
2018-12-01 14:58     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).