Re: [RFC PATCH] gpio: mt7621: fix interrupt banks mapping on gpio chips
From: Bartosz Golaszewski
Date: Tue May 26 2026 - 07:41:30 EST
On Fri, May 22, 2026 at 9:29 AM Sergio Paracuellos
<sergio.paracuellos@xxxxxxxxx> wrote:
>
> Regarding the issue reported by Vicente[0], we have been trying different
> things and we are still having issues to make this work. I have noticed
> that the gpio-brcmstb is similar to our use case sharing one interrupt
> for all the banks and also using gpio chips instances with 32 pins each.
> That said, I tried to setup mt7621 driver in the same way as you can see
> on the following proposed code. With these changes, we are able to make
> properly working the previous problem with the touchscreen that was
> registered on bank 2 instead of bank 0. Now it is properly registered
> on bank 0 and interrupts works perfect and the device is properly
> working. However, every single gpio-keys fail to claim the IRQ HW as
> follows:
>
> mt7621_gpio 10000600.gpio: Mapping irq 41 for gpio line 38 (bank 1)
> gpio gpiochip1: (10000600.gpio-bank1): unable to lock HW IRQ 38 for IRQ
At which line in gpiolib.c does this fail exactly?
> genirq: Failed to request resources for S3 (irq 41) on irqchip mt7621-gpio
> gpio-keys keys: error -EINVAL: request_irq(41) gpio_keys_gpio_isr 0x0 S3
> gpio-keys keys: Unable to claim irq 41; error -22
> gpio-keys keys: probe with driver gpio-keys failed with error -22
>
> So IIUC the kernel is saying that the gpio chip is not IRQ-capable somehow.
>
> Once I touch the irq field just setting up the irq_chip_ops on gpio chip to bypass
> this issue:
>
> gpio_irq_chip_set_chip(&rg->chip.gc.irq, &mt7621_irq_chip);
>
> the kernel stops calling our custom to_irq callback and calls gpiochip_to_irq
> callback instead and also warning as follows:
>
> gpio gpiochip0: (10000600.gpio-bank0): to_irq is redefined in
> gpiochip_irqchip_add_allocated_domain and you shouldn't rely on it
> gpio gpiochip1: (10000600.gpio-bank1): to_irq is redefined in
> gpiochip_irqchip_add_allocated_domain and you shouldn't rely on it
> gpio gpiochip2: (10000600.gpio-bank2): to_irq is redefined in
> gpiochip_irqchip_add_allocated_domain and you shouldn't rely on it
>
Are you calling gpiochip_add_irqchip() in your changes?
Bart