linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] gpio: tegra: Fix wake interrupt
@ 2021-01-12 13:30 Dmitry Osipenko
  2021-01-12 13:30 ` [PATCH v1 2/2] gpio: tegra: Add dependency on GPIOLIB_IRQCHIP Dmitry Osipenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2021-01-12 13:30 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Matt Merhar
  Cc: linux-tegra, linux-gpio, linux-kernel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] gpio: tegra: Add dependency on GPIOLIB_IRQCHIP
  2021-01-12 13:30 [PATCH v1 1/2] gpio: tegra: Fix wake interrupt Dmitry Osipenko
@ 2021-01-12 13:30 ` 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
  2 siblings, 2 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2021-01-12 13:30 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Linus Walleij, Matt Merhar
  Cc: linux-tegra, linux-gpio, linux-kernel

Add dependency on GPIOLIB_IRQCHIP in order to fix driver compilation.

Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip")
Reported-by: Matt Merhar <mattmerhar@protonmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 75f6c37620ea..0cd1f91e4a19 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -597,6 +597,7 @@ config GPIO_TEGRA
 	default ARCH_TEGRA
 	depends on ARCH_TEGRA || COMPILE_TEST
 	depends on OF_GPIO
+	select GPIOLIB_IRQCHIP
 	help
 	  Say yes here to support GPIO pins on NVIDIA Tegra SoCs.
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] gpio: tegra: Fix wake interrupt
  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:51 ` Bartosz Golaszewski
  2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2021-01-18 13:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Matt Merhar, linux-tegra,
	open list:GPIO SUBSYSTEM, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] gpio: tegra: Add dependency on GPIOLIB_IRQCHIP
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2021-01-18 13:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Bartosz Golaszewski, Matt Merhar, linux-tegra,
	open list:GPIO SUBSYSTEM, linux-kernel

On Tue, Jan 12, 2021 at 2:30 PM Dmitry Osipenko <digetx@gmail.com> wrote:

> Add dependency on GPIOLIB_IRQCHIP in order to fix driver compilation.
>
> Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip")
> Reported-by: Matt Merhar <mattmerhar@protonmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] gpio: tegra: Fix wake interrupt
  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 ` [PATCH v1 1/2] gpio: tegra: Fix wake interrupt Linus Walleij
@ 2021-01-19 12:51 ` Bartosz Golaszewski
  2 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2021-01-19 12:51 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan, Linus Walleij,
	Matt Merhar, linux-tegra, linux-gpio, LKML

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] gpio: tegra: Add dependency on GPIOLIB_IRQCHIP
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2021-01-19 12:52 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan, Linus Walleij,
	Matt Merhar, linux-tegra, linux-gpio, LKML

On Tue, Jan 12, 2021 at 2:30 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>
> Add dependency on GPIOLIB_IRQCHIP in order to fix driver compilation.
>
> Fixes: efcdca286eef ("gpio: tegra: Convert to gpio_irq_chip")
> Reported-by: Matt Merhar <mattmerhar@protonmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/gpio/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 75f6c37620ea..0cd1f91e4a19 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -597,6 +597,7 @@ config GPIO_TEGRA
>         default ARCH_TEGRA
>         depends on ARCH_TEGRA || COMPILE_TEST
>         depends on OF_GPIO
> +       select GPIOLIB_IRQCHIP
>         help
>           Say yes here to support GPIO pins on NVIDIA Tegra SoCs.
>
> --
> 2.29.2
>

Applied, thanks!

Bartosz

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-19 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).