linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Matt Merhar <mattmerhar@protonmail.com>,
	linux-tegra <linux-tegra@vger.kernel.org>,
	linux-gpio <linux-gpio@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] gpio: tegra: Fix wake interrupt
Date: Tue, 19 Jan 2021 13:51:56 +0100	[thread overview]
Message-ID: <CAMpxmJWMYN2M-kGXiFbBVMiOtTwbMegvCJDyVLge0Y=ZHChJEg@mail.gmail.com> (raw)
In-Reply-To: <20210112133010.21397-1-digetx@gmail.com>

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

      parent reply	other threads:[~2021-01-19 14:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 13:30 [PATCH v1 1/2] gpio: tegra: Fix wake interrupt Dmitry Osipenko
2021-01-12 13:30 ` [PATCH v1 2/2] gpio: tegra: Add dependency on GPIOLIB_IRQCHIP Dmitry Osipenko
2021-01-18 13:39   ` Linus Walleij
2021-01-19 12:52   ` Bartosz Golaszewski
2021-01-18 13:39 ` [PATCH v1 1/2] gpio: tegra: Fix wake interrupt Linus Walleij
2021-01-19 12:51 ` Bartosz Golaszewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMpxmJWMYN2M-kGXiFbBVMiOtTwbMegvCJDyVLge0Y=ZHChJEg@mail.gmail.com' \
    --to=bgolaszewski@baylibre.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mattmerhar@protonmail.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).