[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbGo4BJOdzkgBrE9jT-rKodd4zssCnOtOuGS+OqV-Uc6Q@mail.gmail.com>
Date: Tue, 25 Oct 2016 20:20:52 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Jerome Brunet <jbrunet@...libre.com>
Cc: Marc Zyngier <marc.zyngier@....com>,
Carlo Caione <carlo@...one.org>,
Kevin Hilman <khilman@...libre.com>,
"open list:ARM/Amlogic Meson..." <linux-amlogic@...ts.infradead.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Jason Cooper <jason@...edaemon.net>,
Rob Herring <robh+dt@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Russell King <linux@...linux.org.uk>
Subject: Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq
On Tue, Oct 25, 2016 at 5:31 PM, Jerome Brunet <jbrunet@...libre.com> wrote:
> On Tue, 2016-10-25 at 15:47 +0100, Marc Zyngier wrote:
>> Is gpio_to_irq() supposed to allocate an interrupt? Or merely to
>> report the existence of a mapping?
It should provide an IRQ corresponding to the gpio line, if possible.
However the semantic is such, that it is not necessary to call to_irq()
before using an IRQ: the irqchip and gpiochip abstractions should be
orthogonal.
This goes especially when using device tree or ACPI, where you
may reference an IRQ from something modeled as irqchip, which
is simultaneously a gpiochip.
> Linus, please correct me if I'm wrong,
> .to_irq gets the linux gpio number and returns the linux virtual irq
> numbers, 0 if there is no interrupt.
Yes. But it may *or may not* be called before using the IRQ.
So it should look up or try to create a mapping on request, but not
assume to have been called before using some line as IRQ.
The only thing you should assume to be called before an interrupt
is put to use is the stuff in irqchip. So you have to do your
dynamic irqdomain mapping elsewhere than .to_irq().
Yours,
Linus Walleij
Powered by blists - more mailing lists