Thread (5 messages) 5 messages, 3 authors, 2020-07-24

Re: [PATCH] gpio: max732x: Use irqchip template

From: Sam Protsenko <semen.protsenko@linaro.org>
Date: 2020-07-24 10:50:19

Hi Linus,

On Tue, 21 Jul 2020 at 12:54, Linus Walleij [off-list ref] wrote:
On Sun, Jul 19, 2020 at 6:34 PM Sam Protsenko
[off-list ref] wrote:
quoted
On Fri, 17 Jul 2020 at 17:19, Linus Walleij [off-list ref] wrote:
quoted
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.

Cc: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Linus Walleij <redacted>
quoted
I can test it on my MAX7325 board with BeagleBone Black in a day or
two.
Thanks! No hurry.
quoted
Do you want me to verify your patch on top of linux-mainline or
linux-next?
Either should work.
quoted
Also, is there any specific stuff you want me to look at,
or making sure there are no regressions w.r.t. IRQ from the chip is
enough?
Just that really, that the IRQs happen as before.
Just tested it on my MAX7325 board [1], by adding gpio-keys and
gpio-leds to BBB dts [2]. Alas, the patch seems to be breaking IRQs.
Before the patch, I can see gpio-buttons appear in /proc/interrupts
and dmesg is clear of errors. After applying the patch, no gpio-keys
appear in /proc/interrupts and dmesg is reporting errors like this:

    irq: no irq domain found for max7325@68 !

This is probably because the patch is setting gpio_chip structure
fields after devm_gpiochip_add_data() was executed. Next hacky change
fixes it:

<<<<<<<<<<<<<<<<<< cut here >>>>>>>>>>>>>>>>>
@@ -695,11 +695,11 @@ static int max732x_probe(struct i2c_client *client,
                        return ret;
        }

-       ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
+       ret = max732x_irq_setup(chip, id);
        if (ret)
                return ret;

-       ret = max732x_irq_setup(chip, id);
+       ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
        if (ret)
                return ret;
 <<<<<<<<<<<<<<<<<< cut here >>>>>>>>>>>>>>>>>
I didn't check if it's a correct fix, so the diff above is only to
check the idea. Anyway, if you send v2 I can retest it, as my setup is
ready.

Thanks!

[1] https://github.com/joe-skb7/max7325-pcb
[2] https://github.com/joe-skb7/linux-mainline-bbb-max732x/commits/max732_bbb_test
Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help