Re: [PATCH RFC 0/2] pinctrl: Add support gpiod_to_irq
Linus Walleij <[email protected]>
| Newsgroups | org.infradead.lists.linux-amlogic,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAD++jLk3YdMUSkk71rgT=taQZnEhqgMgGP0dKBPx7_5Bsxmu+g@mail.gmail.com> |
Hi Xianwei, thanks for your patches! On Thu, Jun 11, 2026 at 9:54 AM Xianwei Zhao via B4 Relay <[email protected]> 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 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic