Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1505203

Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq
Date 2016-10-20 21:30 +0200
Message-ID <surcl-3mp-11@gated-at.bofh.it> (permalink)
References <su0Yx-33U-25@gated-at.bofh.it> <su0Yz-33U-97@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 19, 2016 at 12:08 PM, Jerome Brunet <jbrunet@baylibre.com> 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@baylibre.com>
(...)
> +       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.

Yours,
Linus Walleij

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-19 17:30 +0200
  Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Linus Walleij <linus.walleij@linaro.org> - 2016-10-20 21:30 +0200
    Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-21 11:10 +0200
      Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Linus Walleij <linus.walleij@linaro.org> - 2016-10-25 11:20 +0200
        Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Marc Zyngier <marc.zyngier@arm.com> - 2016-10-25 12:40 +0200
          Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-25 15:10 +0200
            Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Marc Zyngier <marc.zyngier@arm.com> - 2016-10-25 15:40 +0200
              Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-25 16:30 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Marc Zyngier <marc.zyngier@arm.com> - 2016-10-25 16:50 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-25 17:40 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Linus Walleij <linus.walleij@linaro.org> - 2016-10-25 20:30 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-26 16:30 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Linus Walleij <linus.walleij@linaro.org> - 2016-10-26 16:40 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Kevin Hilman <khilman@baylibre.com> - 2016-10-26 18:00 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Linus Walleij <linus.walleij@linaro.org> - 2016-10-25 20:20 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Jerome Brunet <jbrunet@baylibre.com> - 2016-10-26 16:30 +0200
                Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Linus Walleij <linus.walleij@linaro.org> - 2016-10-26 16:50 +0200
        Re: [PATCH 4/9] pinctrl: meson: allow gpio to request irq Thomas Gleixner <tglx@linutronix.de> - 2016-10-25 12:50 +0200

csiph-web