linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>, linux-iio@vger.kernel.org
Cc: Giuseppe Barba <giuseppe.barba@st.com>,
	Denis Ciocca <denis.ciocca@st.com>,
	Crestez Dan Leonard <leonard.crestez@intel.com>,
	Gregor Boirie <gregor.boirie@parrot.com>
Subject: Re: [PATCH 2/3] iio: st_sensors: use the helper function
Date: Sat, 10 Sep 2016 16:50:01 +0100	[thread overview]
Message-ID: <4bf712f5-6afd-d14f-02c1-55d7d6fb8876@kernel.org> (raw)
In-Reply-To: <1472718439-16734-2-git-send-email-linus.walleij@linaro.org>

On 01/09/16 09:27, Linus Walleij wrote:
> The ST sensors can be used as a trigger for its own triggered buffer
> but it is also possible to use an external trigger: a HRTimer or
> even a different sensor (!) as trigger. In that case we should not
> pick the timestamp from our own interrupt top half even if it is
> active.
> 
> This could practically happen if some other sensor is using the
> ST sensor as trigger but the ST sensor itself is using e.g.
> an HRTimer as trigger. So the trigger is on, but not used by us.
> 
> We used to assume that whenever the hardware interrupt is turned
> on, we are using it for our own trigger, but this is an
> oversimplification.
> 
> Handle this logically by using the iio_trigger_using_own() helper.
> 
> Cc: Giuseppe Barba <giuseppe.barba@st.com>
> Cc: Denis Ciocca <denis.ciocca@st.com>
> Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
> Cc: Gregor Boirie <gregor.boirie@parrot.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/common/st_sensors/st_sensors_buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> index d06e728cea37..fe7775bb3740 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> @@ -63,7 +63,7 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
>  	 * the hardware trigger) and the hw_timestamp may get updated.
>  	 * By storing it in a local variable first, we are safe.
>  	 */
> -	if (sdata->hw_irq_trigger)
> +	if (iio_trigger_using_own(indio_dev))
>  		timestamp = sdata->hw_timestamp;
>  	else
>  		timestamp = iio_get_time_ns(indio_dev);
> 


  reply	other threads:[~2016-09-10 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01  8:27 [PATCH 1/3] iio: trigger: helpers to determine own trigger Linus Walleij
2016-09-01  8:27 ` [PATCH 2/3] iio: st_sensors: use the helper function Linus Walleij
2016-09-10 15:50   ` Jonathan Cameron [this message]
2016-09-01  8:27 ` [PATCH 3/3] iio: gyro: mpu3050: " Linus Walleij
2016-09-03 17:24 ` [PATCH 1/3] iio: trigger: helpers to determine own trigger Jonathan Cameron
2016-09-05 12:41   ` Linus Walleij
2016-09-10 15:48 ` Jonathan Cameron

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=4bf712f5-6afd-d14f-02c1-55d7d6fb8876@kernel.org \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=giuseppe.barba@st.com \
    --cc=gregor.boirie@parrot.com \
    --cc=leonard.crestez@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.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 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).