linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: device-tree: at91: irq and gpios: problem while requesting a gpio used as an interrupt source.
Date: Thu, 16 Jan 2014 12:04:10 +0100	[thread overview]
Message-ID: <52D7BCAA.30706@atmel.com> (raw)
In-Reply-To: <52D79E51.4030300@overkiz.com>

On 16/01/2014 09:54, boris brezillon :
> On 15/01/2014 19:06, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 11:35 Mon 13 Jan     , boris brezillon wrote:
>>> On 13/01/2014 11:29, Jean-Jacques Hiblot wrote:
>>>> Hello Nicolas, Jean-Christophe,
>>>>
>>>> As I was trying to enable the touchscreen on the at91sam9261ek with
>>>> device-tree support, I ran into an issue. The touchscreen driver needs
>>>> to know the state of the pendown gpio and also needs it as an
>>>> interrupt source.
>>>>
>>>> The problem is that when a gpio is used as an interrupt, it's
>>>> requested by the pinctrl driver during the xlate stage, marking it
>>>> unavaliable for the other driver.
>>>> It looks like the at91 pinctrl driver is the only one to use
>>>> gpio_request() in the xlate stage. Maybe we should remove this:
>>> You should only request it as a GPIO and then use gpio_to_irq to get the
>>> related IRQ.
>> This here a HUGE issue in the hole kernel
>>
>> You should NEVER known ti's a gpio in the driver at all gpio_to_irq should never
>> exist you need to only see the irq
>>
>>> Because what is done here, is to solve the case where only the irq
>>> is request, and in this specific case we need to request the pin as a
>>> GPIO.
>> this need to be handled at irq level not drivers
> 
> Then propose something (or at least give us a deadline for this new 
> interrupt
> model to come out), because the ADS7843E touchscreen is not working anymore
> (at least on at91 platforms).
> 
> What this driver needs is a level IRQ (not an edge IRQ). The code in 
> ads7846_hard_irq<http://lxr.free-electrons.com/ident?i=ads7846_hard_irq>
> interrupt handler is here to transform an edge IRQ into a level IRQ.
> 
> Is there a way to provide a generic framework to transform edge IRQs 
> into level IRQs
> (because some GPIO controllers do not support level IRQs, and this is 
> the case for the
> at91sam9261 one) ?
> 
> 
> Of cource the gpio_to_irq approach is not perfect, but at least it as 
> the benefit to quickly
> fix the bug, and we will still be able to improve this later, when we 
> have enough tools
> (or mechanisms) to do it.

Moreover, I do not see the rationale behind the concept of "interrupt
with an electrical value". An interrupt signals an event and this event
can be a transition or a state but an electrical value is the
responsibility of a GPIO line, not the other way around.

I see a code that could give the value of an electrical line related to
an interrupt as a twisted interpretation of the notion of "interrupt".
It surprises me that it could be thought as an enhancement that an IRQ
coming from a GPIO could give a value!

Isn't it why other people are also using this simple distinction to use
their GPIO/IRQ mechanism? Maybe this is why we are the only ones to
completely forbid this possibility.

So, let's fix the bug, submit the modification to mainline, make
platform work and see if somebody can convince me that retrieving an
electrical line status from a GPIO is a "bad" thing...

Bye,
-- 
Nicolas Ferre

  reply	other threads:[~2014-01-16 11:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 10:29 device-tree: at91: irq and gpios: problem while requesting a gpio used as an interrupt source Jean-Jacques Hiblot
2014-01-13 10:35 ` boris brezillon
2014-01-13 11:05   ` Jean-Jacques Hiblot
2014-01-15 12:33     ` Jean-Christophe PLAGNIOL-VILLARD
2014-01-15 13:04       ` Jean-Jacques Hiblot
2014-01-15 13:20         ` Jean-Christophe PLAGNIOL-VILLARD
2014-01-15 13:44           ` Jean-Jacques Hiblot
2014-01-15 13:48             ` Arnd Bergmann
2014-01-15 13:56             ` Jean-Christophe PLAGNIOL-VILLARD
2014-01-15 14:41               ` Jean-Jacques Hiblot
2014-01-15 15:25                 ` Jean-Christophe PLAGNIOL-VILLARD
2014-01-15 15:30                   ` Jean-Jacques Hiblot
2014-01-15 18:00                     ` Jean-Christophe PLAGNIOL-VILLARD
2014-01-15 17:28   ` Nicolas Ferre
2014-01-22 10:11     ` Linus Walleij
2014-01-22 12:23       ` Jean-Jacques Hiblot
2014-01-15 18:06   ` Jean-Christophe PLAGNIOL-VILLARD
2014-01-16  8:54     ` boris brezillon
2014-01-16 11:04       ` Nicolas Ferre [this message]
2014-01-16 12:02         ` Jean-Jacques Hiblot
2014-01-22 10:15           ` Linus Walleij
2014-01-23 13:16             ` Jean-Jacques Hiblot
2014-01-31  8:03               ` Linus Walleij
2014-01-15 12:02 ` Jean-Christophe PLAGNIOL-VILLARD

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=52D7BCAA.30706@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.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).