linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crestez Dan Leonard <leonard.crestez@intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Daniel Baluta <daniel.baluta@intel.com>,
	Giuseppe Barba <giuseppe.barba@st.com>,
	Denis Ciocca <denis.ciocca@st.com>
Subject: Re: [PATCH 3/3] iio: st_sensors: Use level interrupts
Date: Tue, 24 May 2016 15:35:14 +0300	[thread overview]
Message-ID: <821accfa-33fc-9d64-2601-7feae77bf38a@intel.com> (raw)
In-Reply-To: <CACRpkdbch1dhUTdCMxLqLHY_cfmgtFvxKoBaCwf7w=RjV0vh7A@mail.gmail.com>

On 05/24/2016 02:40 PM, Linus Walleij wrote:
> On Fri, May 13, 2016 at 8:43 PM, Crestez Dan Leonard
> <leonard.crestez@intel.com> wrote:
> 
>> As far as I can tell DRDY for ST sensors behaves as a level rather than
>> edge interrupt. Registering for IRQF_TRIGGER_RISING instead of
>> IRQF_TRIGGER_HIGH mostly works except when the sampling frequency is
>> high enough that new samples come before the new ones are read
>> completely. In that case the interrupt line remains high, no more rising
>> edges occur and the iio buffer stalls.
>>
>> Configuring the interrupt as IRQF_TRIGGER_HIGH makes it work as
>> expected. This patch makes it so that st_sensors_trigger interrupt
>> request code doesn't mangle the request flags into IRQF_TRIGGER_RISING.
>>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Cc: Giuseppe Barba <giuseppe.barba@st.com>
>> Cc: Denis Ciocca <denis.ciocca@st.com>
>> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> 
> The analysis is probably correct: the sensors will hold the line low
> until the values have been read and no data is ready in the pipe.
> 
> This is delicate when the sensors are used with GPIO controllers
> as interrupt line handlers, because some of them (like mine
> on Ux500) do not support level interrupts :(

This might be completely crazy, but wouldn't it be possible to support
gpio level interrupts purely in software? Just read the GPIO state again
after the interrupt is unmasked and retrigger.

This seems preferable to implementing per-driver workarounds. Perhaps it
would even fit in some gpio-irqchip glue.

-- 
Regards,
Leonard

  reply	other threads:[~2016-05-24 12:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 18:43 [PATCH 1/3] iio: st_sensors: Init trigger before irq request Crestez Dan Leonard
2016-05-13 18:43 ` [PATCH 2/3] iio: st_sensors: Disable DRDY at init time Crestez Dan Leonard
2016-05-14 16:55   ` Jonathan Cameron
2016-05-24 11:28   ` Linus Walleij
2016-05-29 19:28     ` Jonathan Cameron
2016-05-13 18:43 ` [PATCH 3/3] iio: st_sensors: Use level interrupts Crestez Dan Leonard
2016-05-14 16:16   ` Jonathan Cameron
2016-05-24 11:40   ` Linus Walleij
2016-05-24 12:35     ` Crestez Dan Leonard [this message]
2016-05-29 19:29       ` Jonathan Cameron
2016-06-02 14:36         ` Linus Walleij
2016-06-03 11:08           ` Jonathan Cameron
2016-06-20 13:26   ` Linus Walleij
2016-05-14 16:54 ` [PATCH 1/3] iio: st_sensors: Init trigger before irq request Jonathan Cameron
2016-05-24 11:27 ` Linus Walleij
2016-05-24 12:33   ` Crestez Dan Leonard
2016-05-24 21:54     ` Linus Walleij
2016-05-29 19:26       ` 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=821accfa-33fc-9d64-2601-7feae77bf38a@intel.com \
    --to=leonard.crestez@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=denis.ciocca@st.com \
    --cc=giuseppe.barba@st.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).