linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Crestez Dan Leonard <leonard.crestez@intel.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: "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: Sun, 29 May 2016 20:29:40 +0100	[thread overview]
Message-ID: <a27872f0-6359-2c73-002c-2550ef6a9a2b@kernel.org> (raw)
In-Reply-To: <821accfa-33fc-9d64-2601-7feae77bf38a@intel.com>

On 24/05/16 13:35, Crestez Dan Leonard wrote:
> 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.
That's precisely the question I raised way back when writing the lis3l02dq
driver.  Apparently someone once had a go but it never went anywhere...

Feel free to try! It would be great if possible.

Jonathan
> 

  reply	other threads:[~2016-05-29 19:29 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
2016-05-29 19:29       ` Jonathan Cameron [this message]
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=a27872f0-6359-2c73-002c-2550ef6a9a2b@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=denis.ciocca@st.com \
    --cc=giuseppe.barba@st.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=leonard.crestez@intel.com \
    --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).