Skip to content

Commit

Permalink
gpio: tegra: Fix wake interrupt
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
Dmitry Osipenko authored and Bartosz Golaszewski committed Feb 15, 2021
1 parent 9067b30 commit 27f8fee
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions drivers/gpio/gpio-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,21 +541,31 @@ 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)];

port = GPIO_PORT(gpio);
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
Expand Down

0 comments on commit 27f8fee

Please sign in to comment.