From: Crestez Dan Leonard <cdleonard@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org
Cc: Giuseppe Barba <giuseppe.barba@st.com>,
Denis Ciocca <denis.ciocca@st.com>
Subject: Re: [PATCH 3/4] iio: st_sensors: verify interrupt event to status
Date: Tue, 3 May 2016 20:58:26 +0300 [thread overview]
Message-ID: <5728E6C2.1050901@gmail.com> (raw)
In-Reply-To: <1458825486-17188-3-git-send-email-linus.walleij@linaro.org>
On 03/24/2016 03:18 PM, Linus Walleij wrote:
> This makes all ST sensor drivers check that they actually have
> new data available for the requested channel(s) before claiming
> an IRQ, by reading the status register (which is conveniently
> the same for all ST sensors) and check that the channel has new
> data before proceeding to read it and fill the buffer.
>
> This way sensors can share an interrupt line: it can be flaged
> as shared and then the sensor that did not fire will return
> NO_IRQ, and the sensor that fired will handle the IRQ and
> return IRQ_HANDLED.
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> index 2ce0d2a3f855..c55898543a47 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> @@ -58,6 +58,24 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
> struct iio_dev *indio_dev = pf->indio_dev;
> struct st_sensor_data *sdata = iio_priv(indio_dev);
>
> + /* If we have a status register, check if this IRQ came from us */
> + if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) {
> + u8 status;
> +
> + len = sdata->tf->read_byte(&sdata->tb, sdata->dev,
> + sdata->sensor_settings->drdy_irq.addr_stat_drdy,
> + &status);
> + if (len < 0)
> + dev_err(sdata->dev, "could not read channel status\n");
> +
> + /*
> + * If this was not caused by any channels on this sensor,
> + * return IRQ_NONE
> + */
> + if (!(status & (u8)indio_dev->active_scan_mask[0]))
> + return IRQ_NONE;
> + }
>
This seems to break software trigger mode when the timer frequency is
higher that the device polling frequency. In that case it is possible to
poll multiple times between updates and the first time this happens
further updates hang.
Even with hardware triggers: are you sure this is correct? Shouldn't
iio_trigger_notify_done still get called even when there is nothing to do?
--
Regards,
Leonard
next prev parent reply other threads:[~2016-05-03 17:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 13:18 [PATCH 1/4] iio: st_sensors: simplify buffer address handling Linus Walleij
2016-03-24 13:18 ` [PATCH 2/4] iio: st_sensors: read each channel individually Linus Walleij
2016-03-28 8:03 ` Jonathan Cameron
2016-03-28 9:20 ` Linus Walleij
2016-03-28 9:37 ` Jonathan Cameron
2016-03-29 8:15 ` Linus Walleij
2016-04-10 14:29 ` Jonathan Cameron
2016-04-11 6:50 ` Linus Walleij
2016-04-17 11:22 ` Jonathan Cameron
2016-04-17 18:47 ` Linus Walleij
2016-03-24 13:18 ` [PATCH 3/4] iio: st_sensors: verify interrupt event to status Linus Walleij
2016-03-28 8:09 ` Jonathan Cameron
2016-04-12 12:34 ` Linus Walleij
2016-04-17 11:24 ` Jonathan Cameron
2016-05-03 17:58 ` Crestez Dan Leonard [this message]
2016-05-03 20:10 ` Linus Walleij
2016-05-04 7:35 ` Jonathan Cameron
2016-05-04 14:34 ` Linus Walleij
2016-05-04 18:14 ` Crestez Dan Leonard
2016-05-06 9:14 ` Linus Walleij
2016-03-24 13:18 ` [PATCH 4/4] iio: st_sensors: support open drain mode Linus Walleij
2016-03-28 9:12 ` Jonathan Cameron
2016-03-31 8:15 ` Linus Walleij
2016-04-03 9:33 ` Jonathan Cameron
2016-03-28 3:42 ` [PATCH 1/4] iio: st_sensors: simplify buffer address handling Denis Ciocca
2016-03-28 7:52 ` Jonathan Cameron
2016-03-28 8:16 ` Denis Ciocca
2016-03-28 8:27 ` 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=5728E6C2.1050901@gmail.com \
--to=cdleonard@gmail.com \
--cc=denis.ciocca@st.com \
--cc=giuseppe.barba@st.com \
--cc=jic23@kernel.org \
--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).