From: Jonathan Cameron <jic23@kernel.org>
To: Martin Kelly <martin@martingkelly.com>
Cc: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Rob Herring <robh+dt@kernel.org>,
Daniel Baluta <daniel.baluta@gmail.com>,
devicetree@vger.kernel.org
Subject: Re: [PATCH v4 5/6] iio:bmi160: use iio_pollfunc_store_time
Date: Sat, 9 Feb 2019 15:24:16 +0000 [thread overview]
Message-ID: <20190209152416.535cb74b@archlinux> (raw)
In-Reply-To: <20190202215601.20275-6-martin@martingkelly.com>
On Sat, 2 Feb 2019 13:56:00 -0800
Martin Kelly <martin@martingkelly.com> wrote:
> From: Martin Kelly <martin@martingkelly.com>
>
> Currently, we snap the timestamp after reading from the buffer and
> processing the event. When the IIO poll function is triggered by an
> interrupt, 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.
>
> Do this by using iio_pollfunc_store_time as other drivers do.
>
> Signed-off-by: Martin Kelly <martin@martingkelly.com>
There is one small quirk here I'd forgotten about, but seems unlikely to
cause too many problems. There are triggers that only call
iio_trigger_poll_chained (which is badly named) and as a result
only end up calling the thread part. That would result in no
timestamp.
It's a hole we really ought to figure out a reliable fix for that
effects lots of drivers.
Anyhow, I doubt anyone is using this device with that set of triggers
so should be fine whilst we think about a more general solution.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/imu/bmi160/bmi160_core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
> index 007f7c532ac4..f3c5b86a281e 100644
> --- a/drivers/iio/imu/bmi160/bmi160_core.c
> +++ b/drivers/iio/imu/bmi160/bmi160_core.c
> @@ -425,8 +425,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, pf->timestamp);
> done:
> iio_trigger_notify_done(indio_dev->trig);
> return IRQ_HANDLED;
> @@ -834,7 +833,8 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap,
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->info = &bmi160_info;
>
> - ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
> + ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> + iio_pollfunc_store_time,
> bmi160_trigger_handler, NULL);
> if (ret < 0)
> return ret;
next prev parent reply other threads:[~2019-02-09 15:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-02 21:55 [PATCH v4 0/6] iio:bmi160: add drdy interrupt support Martin Kelly
2019-02-02 21:55 ` [PATCH v4 1/6] iio:bmi160: add SPDX identifiers Martin Kelly
2019-02-09 14:49 ` Jonathan Cameron
2019-02-02 21:55 ` [PATCH v4 2/6] iio:bmi160: add drdy interrupt support Martin Kelly
2019-02-09 15:15 ` Jonathan Cameron
2019-02-02 21:55 ` [PATCH v4 3/6] dt-bindings: fix incorrect bmi160 IRQ note Martin Kelly
2019-02-09 15:17 ` Jonathan Cameron
2019-02-09 18:37 ` Martin Kelly
2019-02-02 21:55 ` [PATCH v4 4/6] dt-bindings: document open-drain property Martin Kelly
2019-02-09 15:20 ` Jonathan Cameron
2019-02-02 21:56 ` [PATCH v4 5/6] iio:bmi160: use iio_pollfunc_store_time Martin Kelly
2019-02-09 15:24 ` Jonathan Cameron [this message]
2019-02-02 21:56 ` [PATCH v4 6/6] iio:bmi160: use if (ret) instead of if (ret < 0) Martin Kelly
2019-02-02 23:12 ` Fabio Estevam
2019-02-03 0:30 ` Martin Kelly
2019-02-04 15:15 ` Fabio Estevam
2019-02-04 17:07 ` Martin Kelly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190209152416.535cb74b@archlinux \
--to=jic23@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=martin@martingkelly.com \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.