[PATCH RFC 0/2] pinctrl: Add support gpiod_to_irq
Linus Walleij
linusw at kernel.org
Thu Jun 11 05:51:20 PDT 2026
Hi Xianwei,
thanks for your patches!
On Thu, Jun 11, 2026 at 9:54 AM Xianwei Zhao via B4 Relay
<devnull+xianwei.zhao.amlogic.com at kernel.org> wrote:
> Some users need to obtain an IRQ directly from a GPIO descriptor through gpiod_to_irq().
> Add the required DT binding and implementation to support this use case.
> Since this introduces a new DT property, the property is kept optional to
> maintain compatibility with existing SoCs and DTS files.
To me it looks like you have just re-implemented hierarchical
irqs.
Look into the section "Infrastructure helpers for GPIO irqchips"
in Documentation/driver-api/gpio/driver.rst, especially towards
the end.
Solve this by using GPIOLIB_IRQCHIP and a custom
child_to_parent_hwirq() callback to translate the GPIO into
an IRQ.
To just implement gpiod_to_irq() without any irqchip abstraction
is also broken: you can't force all users to just use this way
to get an IRQ it's excessively restricting.
Add
interrupt-controller: true
"#interrupt-cells":
const: 2
to the pinctrl node as well so that DT users can simply request
the IRQ from the irqchip inside of the pin controller. It will
be hierarchical and lightweight but an irqchip nevertheless.
The GPIOLIB_IRQCHIP approach will help you to get this
right.
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list