Re: [PATCH v11 8/9] gpio: pl061: switch data path to gpio-regmap
From: Andy Shevchenko
Date: Wed Oct 21 2026 - 13:41:47 EST
On Tue, Oct 20, 2026 at 03:54:12PM +0800, Long Zhao via B4 Relay wrote:
> Move get, set and direction onto gpio-regmap. ARM PL061 sets
> GPIO_REGMAP_QUIRK_SET_AFTER_DIR so the output value is written
> after the direction change.
>
> Keep a custom irqchip and irq domain. Create the domain with
> the PL061 private data and let gpio-regmap attach it.
>
> Check the chained-handler regmap_read() return and always run
> chained_irq_exit(). irq_type still ignores MMIO write returns.
>
> irq_set_parent() nests the GPIO irq_desc under the AMBA parent
> for irq_set_wake() and lockdep; checked with PROVE_LOCKING on
> CV75.
...
> static void pl061_irq_handler(struct irq_desc *desc)
> {
> + struct pl061 *pl061 = irq_desc_get_handler_data(desc);
> + struct irq_chip *irqchip = irq_desc_get_chip(desc);
> unsigned long pending;
> unsigned int mis = 0;
> int offset;
> - struct gpio_chip *gc = irq_desc_get_handler_data(desc);
> - struct pl061 *pl061 = gpiochip_get_data(gc);
> - struct irq_chip *irqchip = irq_desc_get_chip(desc);
> + int ret;
>
> chained_irq_enter(irqchip, desc);
>
> - regmap_read(pl061->regmap, GPIOMIS, &mis);
> + ret = regmap_read(pl061->regmap, pl061->data->regs->mis, &mis);
> + if (ret)
> + goto out;
I think error checking is not required as we have mis = 0 still, so
the failed regmap_read() shouldn't change that.
> pending = mis;
> - for_each_set_bit(offset, &pending, PL061_GPIO_NR)
> - generic_handle_domain_irq(gc->irq.domain, offset);
> + for_each_set_bit(offset, &pending, pl061->data->ngpio)
> + generic_handle_domain_irq(pl061->irq_domain, offset);
>
> +out:
> chained_irq_exit(irqchip, desc);
> }
...
> + for (unsigned int i = 0; i < pl061->data->ngpio; i++) {
> + unsigned int virq;
> +
> + virq = irq_find_mapping(pl061->irq_domain, i);
> + if (virq)
Unneeded checkm it's already inside the below call.
> + irq_dispose_mapping(virq);
So, altogether
for (unsigned int i = 0; i < pl061->data->ngpio; i++)
irq_dispose_mapping(irq_find_mapping(pl061->irq_domain, i));
> + }
--
With Best Regards,
Andy Shevchenko