linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] pinctrl/GPIO driver for Apple SoCs
@ 2021-10-24 10:18 Joey Gouly
  2021-10-24 10:18 ` [PATCH v4 1/5] gpio: Allow per-parent interrupt data Joey Gouly
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Joey Gouly @ 2021-10-24 10:18 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Hector Martin, Marc Zyngier, Alyssa Rosenzweig,
	Sven Peter, devicetree, Rob Herring, Mark Kettenis, nd,
	Joey Gouly

Hi all,

Here is the v4 patchset for the Apple pinctrl/GPIO driver.

Changes since v3 [1]:
  - Applied Marc Zyngier's review/patch (with exception noted below)
  - Removed "apple,t8103-pinctrl" compatible from driver
  - Applied Acks/Review tags


With Marc's changes, the irq_chip was being shared between pinctrl
drivers and I was getting the following warning:

  drivers/gpio/gpiolib.c:1456:

    detected irqchip that is shared with multiple gpiochips: please fix
the driver.


So I applied the following diff to Marc's change, to not share the
irq_chips, while still being cleaner overall:

diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c
b/drivers/pinctrl/pinctrl-apple-gpio.c
index 732c347a2bbc..ce037a5c15c1 100644
--- a/drivers/pinctrl/pinctrl-apple-gpio.c
+++ b/drivers/pinctrl/pinctrl-apple-gpio.c
@@ -35,6 +35,7 @@ struct apple_gpio_pinctrl {

        struct pinctrl_desc pinctrl_desc;
        struct gpio_chip gpio_chip;
+       struct irq_chip irq_chip;
        u8 irqgrps[0];
 };

@@ -369,6 +370,8 @@ static int apple_gpio_gpio_register(struct
apple_gpio_pinctrl *pctl)
                return dev_err_probe(pctl->dev, -ENODEV,
                                     "No gpio-controller property\n");

+       pctl->irq_chip = apple_gpio_irqchip;
+
        pctl->gpio_chip.label = dev_name(pctl->dev);
        pctl->gpio_chip.request = gpiochip_generic_request;
        pctl->gpio_chip.free = gpiochip_generic_free;
@@ -385,7 +388,7 @@ static int apple_gpio_gpio_register(struct
apple_gpio_pinctrl *pctl)
        if (girq->num_parents) {
                int i;

-               girq->chip = &apple_gpio_irqchip;
+               girq->chip = &pctl->irq_chip;
                girq->parent_handler = apple_gpio_gpio_irq_handler;

                girq->parents = kmalloc_array(girq->num_parents,

Marc said that hierarchical IRQ domains should solve this problem, but
I'll let him explain more on the list, maybe that should solved in a different
patch series.

There is a branch here with the driver:
  https://gitlab.arm.com/linux-arm/jg-open/-/tree/pinctrl_apple_v4

Thanks,
Joey

note: For those that have been testing this with PCIe etc, you will
probably want to also include the last commit in the following branch, as I
dropped the clock references in the code (due to the switch to power domains):
https://gitlab.arm.com/linux-arm/jg-open/-/commits/pinctrl_apple_v4_clock

[1]
https://lore.kernel.org/linux-gpio/20211016141839.45460-1-joey.gouly@arm.com/

Joey Gouly (4):
  dt-bindings: pinctrl: add #interrupt-cells to apple,pinctrl
  dt-bindings: pinctrl: Add apple,npins property to apple,pinctrl
  pinctrl: add pinctrl/GPIO driver for Apple SoCs
  MAINTAINERS: add pinctrl-apple-gpio to ARM/APPLE MACHINE

Marc Zyngier (1):
  gpio: Allow per-parent interrupt data

 .../bindings/pinctrl/apple,pinctrl.yaml       |  10 +
 MAINTAINERS                                   |   1 +
 drivers/gpio/gpiolib.c                        |   9 +-
 drivers/pinctrl/Kconfig                       |  16 +
 drivers/pinctrl/Makefile                      |   1 +
 drivers/pinctrl/pinctrl-apple-gpio.c          | 535 ++++++++++++++++++
 include/linux/gpio/driver.h                   |  19 +-
 7 files changed, 587 insertions(+), 4 deletions(-)
 create mode 100644 drivers/pinctrl/pinctrl-apple-gpio.c

-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-10-25 23:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-24 10:18 [PATCH v4 0/5] pinctrl/GPIO driver for Apple SoCs Joey Gouly
2021-10-24 10:18 ` [PATCH v4 1/5] gpio: Allow per-parent interrupt data Joey Gouly
2021-10-24 10:18 ` [PATCH v4 2/5] dt-bindings: pinctrl: add #interrupt-cells to apple,pinctrl Joey Gouly
2021-10-24 10:18 ` [PATCH v4 3/5] dt-bindings: pinctrl: Add apple,npins property " Joey Gouly
2021-10-24 10:18 ` [PATCH v4 4/5] pinctrl: add pinctrl/GPIO driver for Apple SoCs Joey Gouly
2021-10-25  9:07   ` Hector Martin
2021-10-25  9:41     ` Joey Gouly
2021-10-25  9:53       ` Hector Martin
2021-10-24 10:18 ` [PATCH v4 5/5] MAINTAINERS: add pinctrl-apple-gpio to ARM/APPLE MACHINE Joey Gouly
2021-10-24 21:34 ` [PATCH v4 0/5] pinctrl/GPIO driver for Apple SoCs Linus Walleij
2021-10-25  9:12 ` Hector Martin
2021-10-25 23:26   ` Linus Walleij
2021-10-25 10:28 ` Marc Zyngier

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).