Re: [PATCH v4 1/4] dt-bindings: gpio: realtek: Add realtek,rtd1625-gpio
From: Linus Walleij
Date: Tue Jun 30 2026 - 09:19:08 EST
Hi Yu-Chun,
thanks for your patch!
On Mon, Jun 22, 2026 at 10:33 AM Yu-Chun Lin <eleanor.lin@xxxxxxxxxxx> wrote:
> From: Tzuyi Chang <tychang@xxxxxxxxxxx>
>
> Add the device tree bindings for the Realtek DHC (Digital Home Center)
> RTD1625 GPIO controllers.
>
> The RTD1625 GPIO controller features a per-pin register architecture
> that differs significantly from previous generations. It utilizes
> separate register blocks for GPIO configuration and interrupt control.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
> Signed-off-by: Tzuyi Chang <tychang@xxxxxxxxxxx>
> Signed-off-by: Yu-Chun Lin <eleanor.lin@xxxxxxxxxxx>
(...)
> + interrupt-controller: true
> +
> + "#interrupt-cells":
> + const: 2
> +
> + gpio-ranges: true
> +
> + gpio-controller: true
> +
> + "#gpio-cells":
> + const: 2
After looking at the driver I must challenge this binding.
Your driver is full of (offset % 32) and even (offset % 32) *4 to just
work around the fact that the hardware inherently has 32-pin banks.
Instead of using twocell GPIO and irqs, just use threecell, interrupt-cells
and gpio-cells 3.
First cell is bank, second cell is offset inside each bank.
For Linux specifically there are helpers for dealing with this in gpiolib,
and further you will be able to use the GPIO_GENERIC library,
while this is beside the point for the binding itself.
Yours,
Linus Walleij