Message ID | 20210112133010.21397-1-digetx@gmail.com |
---|---|
State | Accepted |
Commit | 27f8feea4091a733b8f6ddfe8090c8b3d7a45a15 |
Headers | show |
Series | [v1,1/2] gpio: tegra: Fix wake interrupt | expand |
On Tue, Jan 12, 2021 at 2:30 PM Dmitry Osipenko <digetx@gmail.com> wrote: > The GPIO bank wake interrupt setting was erroneously removed after > conversion to gpio_irq_chip, thus the wake interrupt programming is > broken now. Secondly, the wake_enb of the GPIO driver should be changed > only after the successful toggling of the IRQ wake-state. Restore the wake > interrupt setting and the programming order. > > Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip") > Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Tue, Jan 12, 2021 at 2:30 PM Dmitry Osipenko <digetx@gmail.com> wrote: > > The GPIO bank wake interrupt setting was erroneously removed after > conversion to gpio_irq_chip, thus the wake interrupt programming is > broken now. Secondly, the wake_enb of the GPIO driver should be changed > only after the successful toggling of the IRQ wake-state. Restore the wake > interrupt setting and the programming order. > > Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip") > Signed-off-by: Dmitry Osipenko <digetx@gmail.com> > --- > drivers/gpio/gpio-tegra.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c > index b8a4fd07c559..6c79e9d2f932 100644 > --- a/drivers/gpio/gpio-tegra.c > +++ b/drivers/gpio/gpio-tegra.c > @@ -541,6 +541,7 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) > struct tegra_gpio_bank *bank; > unsigned int gpio = d->hwirq; > u32 port, bit, mask; > + int err; > > bank = &tgi->bank_info[GPIO_BANK(d->hwirq)]; > > @@ -548,14 +549,23 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) > bit = GPIO_BIT(gpio); > mask = BIT(bit); > > + err = irq_set_irq_wake(tgi->irqs[bank->bank], enable); > + if (err) > + return err; > + > + if (d->parent_data) { > + err = irq_chip_set_wake_parent(d, enable); > + if (err) { > + irq_set_irq_wake(tgi->irqs[bank->bank], !enable); > + return err; > + } > + } > + > if (enable) > bank->wake_enb[port] |= mask; > else > bank->wake_enb[port] &= ~mask; > > - if (d->parent_data) > - return irq_chip_set_wake_parent(d, enable); > - > return 0; > } > #endif > -- > 2.29.2 > Applied, thanks! Bartosz
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index b8a4fd07c559..6c79e9d2f932 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -541,6 +541,7 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) struct tegra_gpio_bank *bank; unsigned int gpio = d->hwirq; u32 port, bit, mask; + int err; bank = &tgi->bank_info[GPIO_BANK(d->hwirq)]; @@ -548,14 +549,23 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) bit = GPIO_BIT(gpio); mask = BIT(bit); + err = irq_set_irq_wake(tgi->irqs[bank->bank], enable); + if (err) + return err; + + if (d->parent_data) { + err = irq_chip_set_wake_parent(d, enable); + if (err) { + irq_set_irq_wake(tgi->irqs[bank->bank], !enable); + return err; + } + } + if (enable) bank->wake_enb[port] |= mask; else bank->wake_enb[port] &= ~mask; - if (d->parent_data) - return irq_chip_set_wake_parent(d, enable); - return 0; } #endif
The GPIO bank wake interrupt setting was erroneously removed after conversion to gpio_irq_chip, thus the wake interrupt programming is broken now. Secondly, the wake_enb of the GPIO driver should be changed only after the successful toggling of the IRQ wake-state. Restore the wake interrupt setting and the programming order. Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip") Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- drivers/gpio/gpio-tegra.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)