mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
To: Linus Walleij <linusw@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFC 0/2] pinctrl: Add support gpiod_to_irq
Date: Mon, 15 Jun 2026 11:17:41 +0800	[thread overview]
Message-ID: <2bb2c0e8-29e1-444b-851b-a9932f547c6a@amlogic.com> (raw)
In-Reply-To: <CAD++jLk3YdMUSkk71rgT=taQZnEhqgMgGP0dKBPx7_5Bsxmu+g@mail.gmail.com>

Hi Linus,
    Thank you for your advice and review.

On 2026/6/11 20:51, Linus Walleij wrote:
> 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@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.
> 

I read the document (Documentation/driver-api/gpio/driver.rst) you 
pointed me to and found that the corresponding implementation has 
already been added in this file:

https://github.com/torvalds/linux/blob/master/drivers/irqchip/irq-meson-gpio.c

However, it is implemented as a standalone irqchip and is not integrated 
with the GPIO controller.

In this patch, I implemented the GPIO-to-IRQ conversion through 
gpiod_to_irq(). Users can still obtain the interrupt directly through 
the interrupt property, for example:

interrupts-extended = <&gpio_intc 16 1>;

The purpose of this change is to make GPIO-to-IRQ conversion easier for 
users who do not want to know the actual interrupt number. The interrupt 
mapping is not fixed and varies between different SoCs, so users should 
not need to handle the hardware interrupt allocation details.


> Yours,
> Linus Walleij

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-06-15  3:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11  7:54 Xianwei Zhao via B4 Relay
2026-06-11  7:54 ` [PATCH RFC 1/2] dt-bindings: pinctl: amlogic,pinctrl-a4: Add gpio irq property Xianwei Zhao via B4 Relay
2026-06-11  8:06   ` sashiko-bot
2026-06-11 17:39   ` Conor Dooley
2026-06-15  2:47     ` Xianwei Zhao
2026-06-15  5:32       ` Krzysztof Kozlowski
2026-06-16  2:54         ` Xianwei Zhao
2026-06-15 16:52   ` Conor Dooley
2026-06-16  2:56     ` Xianwei Zhao
2026-06-11  7:54 ` [PATCH RFC 2/2] pinctrl: meson: amlogic-a4: support gpiod_to_irq Xianwei Zhao via B4 Relay
2026-06-11  8:02   ` sashiko-bot
2026-06-11 12:51 ` [PATCH RFC 0/2] pinctrl: Add " Linus Walleij
2026-06-15  3:17   ` Xianwei Zhao [this message]
2026-06-15 12:59     ` Linus Walleij
2026-06-16  2:45       ` Xianwei Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bb2c0e8-29e1-444b-851b-a9932f547c6a@amlogic.com \
    --to=xianwei.zhao@amlogic.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®