Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
To: Conor Dooley <conor@kernel.org>
Cc: Linus Walleij <linusw@kernel.org>, 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 1/2] dt-bindings: pinctl: amlogic,pinctrl-a4: Add gpio irq property
Date: Mon, 15 Jun 2026 10:47:12 +0800	[thread overview]
Message-ID: <a79e58b5-3a11-4593-847d-ba92527549bf@amlogic.com> (raw)
In-Reply-To: <20260611-ungloved-snowplow-522e7c0b7a51@spud>

Hi Conor,
    Thanks for your review.

On 2026/6/12 01:39, Conor Dooley wrote:
> Subject:
> Re: [PATCH RFC 1/2] dt-bindings: pinctl: amlogic,pinctrl-a4: Add gpio 
> irq property
> From:
> Conor Dooley <conor@kernel.org>
> Date:
> 2026/6/12 01:39
> 
> To:
> xianwei.zhao@amlogic.com
> CC:
> Linus Walleij <linusw@kernel.org>, 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
> 
> 
> 
> On Thu, Jun 11, 2026 at 07:54:33AM +0000, Xianwei Zhao via B4 Relay wrote:
>> From: Xianwei Zhao<xianwei.zhao@amlogic.com>
>>
>> Add the hw-irq property for each GPIO bank and enable interrupt-parent
>> for pinctrl so that gpiod_to_irq() can translate GPIO lines to IRQs.
> Uhhhhh, what? Why can't you just use the normal interrupts property?
> 

The interrupt cannot be used directly because the GPIO bank only 
provides an IRQ base, which does not have a one-to-one mapping with the 
actual hardware interrupts.

On Amlogic SoCs, GPIO interrupts are handled through a mux. Multiple 
GPIO pins are mapped to a limited number of real interrupt sources. The 
implementation can be found here:

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

To use a GPIO interrupt, an unused hardware interrupt must first be 
allocated, and then the corresponding mux register must be configured. 
This allocation and mapping are already implemented in the existing driver.

In that driver, the mapping is performed dynamically rather than simply 
calculating:

irq = irq_start + gpio_offset

If the interrupt is used directly, only the GPIO index can be obtained. 
The real interrupt number cannot be derived by simply adding an offset, 
because the hardware interrupt must be allocated first. Pre-allocating 
all interrupts during initialization would prevent later GPIOs from 
obtaining available interrupt sources.

Perhaps other names would be more appropriate here, such as "irq_start".

>> Signed-off-by: Xianwei Zhao<xianwei.zhao@amlogic.com>
>> ---
>>   Documentation/devicetree/bindings/pinctrl/amlogic,pinctrl-a4.yaml | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/pinctrl/amlogic,pinctrl-a4.yaml b/Documentation/devicetree/bindings/pinctrl/amlogic,pinctrl-a4.yaml
>> index b69db1b95345..65ec9121300e 100644
>> --- a/Documentation/devicetree/bindings/pinctrl/amlogic,pinctrl-a4.yaml
>> +++ b/Documentation/devicetree/bindings/pinctrl/amlogic,pinctrl-a4.yaml
>> @@ -37,6 +37,8 @@ properties:
>>   
>>     ranges: true
>>   
>> +  interrupt-parent: true
>> +
>>   patternProperties:
>>     "^gpio@[0-9a-f]+$":
>>       type: object
>> @@ -65,6 +67,9 @@ patternProperties:
>>         gpio-ranges:
>>           maxItems: 1
>>   
>> +      hw-irq:
>> +        $ref: /schemas/types.yaml#/definitions/uint32
>> +
>>       required:
>>         - reg
>>         - reg-names
>>
>> -- 
>> 2.52.0

  reply	other threads:[~2026-06-15  2:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11  7:54 [PATCH RFC 0/2] pinctrl: Add support gpiod_to_irq 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 17:39   ` Conor Dooley
2026-06-15  2:47     ` Xianwei Zhao [this message]
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 12:51 ` [PATCH RFC 0/2] pinctrl: Add " Linus Walleij
2026-06-15  3:17   ` Xianwei Zhao
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=a79e58b5-3a11-4593-847d-ba92527549bf@amlogic.com \
    --to=xianwei.zhao@amlogic.com \
    --cc=conor+dt@kernel.org \
    --cc=conor@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