Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq
From: Jerome Brunet
Date: Fri Oct 21 2016 - 05:06:45 EST
On Thu, 2016-10-20 at 21:21 +0200, Linus Walleij wrote:
> On Wed, Oct 19, 2016 at 12:08 PM, Jerome Brunet <jbrunet@xxxxxxxxxxxx
> > wrote:
>
> >
> > Add the ability for gpio to request irq from the gpio interrupt
> > controller
> > if present. We have to specificaly that the parent interrupt
> > controller is
> > the gpio interrupt controller because gpio on meson SoCs can't
> > generate
> > interrupt directly on the GIC.
> >
> > Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
> (...)
> >
> > +ÂÂÂÂÂÂÂselect IRQ_DOMAIN
> > ÂÂÂÂÂÂÂÂselect OF_GPIO
> > +ÂÂÂÂÂÂÂselect OF_IRQ
> (...)
> >
> > +static int meson_gpio_to_hwirq(struct meson_bank *bank, unsigned
> > int offset)
> > +{
> > +ÂÂÂÂÂÂÂunsigned int hwirq;
> > +
> > +ÂÂÂÂÂÂÂif (bank->irq_first < 0)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* this bank cannot generate irqs */
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> > +
> > +ÂÂÂÂÂÂÂhwirq = offset - bank->first + bank->irq_first;
> > +
> > +ÂÂÂÂÂÂÂif (hwirq > bank->irq_last)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* this pin cannot generate irqs */
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> > +
> > +ÂÂÂÂÂÂÂreturn hwirq;
> > +}
>
> This is reimplementing irqdomain.
>
> >
> > +static int meson_gpio_to_irq(struct gpio_chip *chip, unsigned int
> > offset)
> > +{
> (...)
> >
> > +ÂÂÂÂÂÂÂhwirq = meson_gpio_to_hwirq(bank, offset);
> > +ÂÂÂÂÂÂÂif (hwirq < 0) {
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂdev_dbg(pc->dev, "no interrupt for pin %u\n",
> > offset);
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn 0;
> > +ÂÂÂÂÂÂÂ}
>
> Isn't this usecase (also as described in the cover letter) a textbook
> example of when you should be using hierarchical irqdomain?
>
> Please check with Marc et al on hierarchical irqdomains.
Linus,
Do you mean I should create a new hierarchicalÂirqdomains in each of
the two pinctrl instances we have in these SoC, these domains being
stacked on the one I just added for controller in irqchip ?
I did not understand this is what you meant when I asked you the
question at ELCE.
>
> Yours,
> Linus Walleij