Re: [PATCH v4 07/10] drivers: pinctrl: msm: setup GPIO irqchip hierarchy

Linus Walleij
2019-04-17T17:38:27Z

On Wed, Apr 17, 2019 at 6:08 PM Lina Iyer <ilina@codeaurora.org> wrote:

> I am thinking of something like this. Would there be any issue in
> setting the type to IRQ_TYPE_SENSE_MASK instead of any one particular
> type?
>
> ---8<-----
> static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
> {
> #ifdef CONFIG_OF_GPIO
> struct irq_fwspec fwspec;
>
> if (chip->of_node) {
> fwspec.fwnode = of_node_to_fwnode(chip->of_node);
> fwspec.param[0] = offset;
> fwspec.param[1] = IRQ_TYPE_SENSE_MASK;
> fwspec.param_count = 2;
> return irq_create_fwspec_mapping(&fwspec);
> }
> #endif
>
> if (!gpiochip_irqchip_irq_valid(chip, offset))
> return -ENXIO;
>
> return irq_create_mapping(chip->irq.domain, offset);

Isn't the real problem that irq_create_mapping() isn't already doing this
for you?

chip->irq.domain is created with irq_domain_add_simple() and after
Thierrys patch with irq_domain_add_hierarchy(), so I think it is simply
that the hierarchical irqdomain helper code needs to go deeper here.

gpiolib needs struct irq_domain_ops for the hierarchical irqdomain
which implements generic versions of .translate(), .alloc() and .free().
I am working on this... albeit slowly :/

Yours,
Linus Walleij