mbox series

[v6,00/15] qcom: spmi: add support for hierarchical IRQ chip

Message ID 20190119204252.18370-1-masneyb@onstation.org (mailing list archive)
Headers show
Series qcom: spmi: add support for hierarchical IRQ chip | expand

Message

Brian Masney Jan. 19, 2019, 8:42 p.m. UTC
This patch series adds hierarchical IRQ chip support to spmi-gpio so
that device tree consumers can request an IRQ directly from the GPIO
block rather than having to request an IRQ from the underlying PMIC.

For more background information, see the email thread with Linus
Walleij's excellent description of the problem at
https://www.spinics.net/lists/linux-gpio/msg34655.html.

This work was tested on a LG Nexus 5 (hammerhead) phone. My status page
at https://masneyb.github.io/nexus-5-upstream/ describes what is working
so far with the upstream kernel.

Changes since v5:
- Patch 4: Set handler to edge or level when the IRQ is mapped.
- Patch 7: Change IRQ_TYPE_NONE to IRQ_TYPE_EDGE_RISING
- Patch 14: New patch to validate type when mapping IRQ

Changes since v4:
- Patch 3: Remove unnecessary u16 cast on device_get_match_data()
- Patch 5: Change '&struct gpiochip' in kernel doc to
  '&struct gpio_chip'

High-level changes since v3:
- Add missing variants to spmi-gpio driver and device tree binding doc
  that are already in use in device tree.
- Introduce patch that disassociates the old virq if hwirq mapping
  already exists and then drop it at the end of the series. This is to
  not break git bisect for existing boards.
- Migrate arm64 device tree files.
- There are 8 new patches in this series and I denoted this in the notes
  on the relevant patches.

High-level changes since v2:
- Dropped patch to mfd/qcom-spmi-pmic.c
- Patch 3 is new and adds two new functions to gpiolib
- Patch 6 is new and corrects the only other upstream user of spmi-gpio

High-level changes since v1:
- Patches 1 and 2 are new. This brought in a third subsystem (mfd).
- I have detailed changelogs attached to the notes on patches 3-5.

Brian Masney (15):
  dt-bindings: pinctrl: qcom-pmic-gpio: add qcom,pmi8998-gpio binding
  pinctrl: qcom: spmi-gpio: add support for three new variants
  pinctrl: qcom: spmi-gpio: hardcode IRQ counts
  spmi: pmic-arb: convert to v2 irq interfaces to support hierarchical
    IRQ chips
  gpio: add irq domain activate/deactivate functions
  spmi: pmic-arb: disassociate old virq if hwirq mapping already exists
  qcom: spmi-gpio: add support for hierarchical IRQ chip
  ARM: dts: qcom: pm8941: add interrupt controller properties
  ARM: dts: qcom: pma8084: add interrupt controller properties
  arm64: dts: qcom: pm8005: add interrupt controller properties
  arm64: dts: qcom: pm8998: add interrupt controller properties
  arm64: dts: qcom: pmi8994: add interrupt controller properties
  arm64: dts: qcom: pmi8998: add interrupt controller properties
  spmi: pmic-arb: validate type when mapping IRQ
  spmi: pmic-arb: revert "disassociate old virq if hwirq mapping already
    exists"

 .../bindings/pinctrl/qcom,pmic-gpio.txt       |   1 +
 arch/arm/boot/dts/qcom-pm8941.dtsi            |  38 +----
 arch/arm/boot/dts/qcom-pma8084.dtsi           |  24 +--
 arch/arm64/boot/dts/qcom/pm8005.dtsi          |   6 +-
 arch/arm64/boot/dts/qcom/pm8998.dtsi          |  28 +---
 arch/arm64/boot/dts/qcom/pmi8994.dtsi         |  12 +-
 arch/arm64/boot/dts/qcom/pmi8998.dtsi         |  16 +-
 drivers/gpio/gpiolib.c                        |  37 +++++
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c      | 140 +++++++++++++++---
 drivers/spmi/spmi-pmic-arb.c                  |  74 ++++++---
 include/linux/gpio/driver.h                   |   5 +
 11 files changed, 225 insertions(+), 156 deletions(-)

Comments

Linus Walleij Jan. 19, 2019, 11:13 p.m. UTC | #1
On Sat, Jan 19, 2019 at 9:43 PM Brian Masney <masneyb@onstation.org> wrote:

> This patch series adds hierarchical IRQ chip support to spmi-gpio so
> that device tree consumers can request an IRQ directly from the GPIO
> block rather than having to request an IRQ from the underlying PMIC.
>
> For more background information, see the email thread with Linus
> Walleij's excellent description of the problem at
> https://www.spinics.net/lists/linux-gpio/msg34655.html.
>
> This work was tested on a LG Nexus 5 (hammerhead) phone. My status page
> at https://masneyb.github.io/nexus-5-upstream/ describes what is working
> so far with the upstream kernel.
>
> Changes since v5:
> - Patch 4: Set handler to edge or level when the IRQ is mapped.
> - Patch 7: Change IRQ_TYPE_NONE to IRQ_TYPE_EDGE_RISING
> - Patch 14: New patch to validate type when mapping IRQ

If Marc Z is happy I think I will apply all patches on an immutable branch in
the pin control tree, so that ARM SoC and GPIO can pull it in later if need
be. (E.g. if they get conflicts.)

I was thinking to also include the DTS changes as it all is so neatly
coupled, then offer the branch to ARM SoC.

Anyone against?

Yours,
Linus Walleij
Marc Zyngier Jan. 20, 2019, 11:36 a.m. UTC | #2
On Sat, 19 Jan 2019 23:13:45 +0000,
Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> On Sat, Jan 19, 2019 at 9:43 PM Brian Masney <masneyb@onstation.org> wrote:
> 
> > This patch series adds hierarchical IRQ chip support to spmi-gpio so
> > that device tree consumers can request an IRQ directly from the GPIO
> > block rather than having to request an IRQ from the underlying PMIC.
> >
> > For more background information, see the email thread with Linus
> > Walleij's excellent description of the problem at
> > https://www.spinics.net/lists/linux-gpio/msg34655.html.
> >
> > This work was tested on a LG Nexus 5 (hammerhead) phone. My status page
> > at https://masneyb.github.io/nexus-5-upstream/ describes what is working
> > so far with the upstream kernel.
> >
> > Changes since v5:
> > - Patch 4: Set handler to edge or level when the IRQ is mapped.
> > - Patch 7: Change IRQ_TYPE_NONE to IRQ_TYPE_EDGE_RISING
> > - Patch 14: New patch to validate type when mapping IRQ
> 
> If Marc Z is happy I think I will apply all patches on an immutable branch in

As a matter of fact, I am!

> the pin control tree, so that ARM SoC and GPIO can pull it in later if need
> be. (E.g. if they get conflicts.)
> 
> I was thinking to also include the DTS changes as it all is so neatly
> coupled, then offer the branch to ARM SoC.
> 
> Anyone against?

No objection from me whatsoever.

Thanks,

	M.
Linus Walleij Jan. 22, 2019, 3:31 p.m. UTC | #3
On Sat, Jan 19, 2019 at 9:43 PM Brian Masney <masneyb@onstation.org> wrote:

> This patch series adds hierarchical IRQ chip support to spmi-gpio so
> that device tree consumers can request an IRQ directly from the GPIO
> block rather than having to request an IRQ from the underlying PMIC.

I have applied all these patches including the DTS patches to the GPIO
tree and pushed for linux-next.

If all works out well I will solidify the branch, pull it into the pin control
tree as well and offer the branch to ARM SoC.

Yours,
Linus Walleij
Andy Gross Jan. 22, 2019, 9:13 p.m. UTC | #4
On Tue, Jan 22, 2019 at 04:31:20PM +0100, Linus Walleij wrote:
> On Sat, Jan 19, 2019 at 9:43 PM Brian Masney <masneyb@onstation.org> wrote:
> 
> > This patch series adds hierarchical IRQ chip support to spmi-gpio so
> > that device tree consumers can request an IRQ directly from the GPIO
> > block rather than having to request an IRQ from the underlying PMIC.
> 
> I have applied all these patches including the DTS patches to the GPIO
> tree and pushed for linux-next.
> 
> If all works out well I will solidify the branch, pull it into the pin control
> tree as well and offer the branch to ARM SoC.

Thanks Linus!