diff mbox series

[1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup

Message ID 20231017033039.1245959-1-haibo.chen@nxp.com
State New
Headers show
Series [1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup | expand

Commit Message

Bough Chen Oct. 17, 2023, 3:30 a.m. UTC
From: Haibo Chen <haibo.chen@nxp.com>

Add flag IRQCHIP_MASK_ON_SUSPEND to make sure gpio irq is masked on
suspend, if lack this flag, current irq arctitecture will not mask
the irq, and these unmasked gpio irq will wrongly wakeup the system
even they are not config as wakeup source.

Also add flag IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND to make sure the gpio
irq which is configed as wakeup source can work as expect.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/gpio/gpio-vf610.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Bartosz Golaszewski Oct. 17, 2023, 10:09 a.m. UTC | #1
On Tue, Oct 17, 2023 at 5:25 AM <haibo.chen@nxp.com> wrote:
>
> From: Haibo Chen <haibo.chen@nxp.com>
>
> Add flag IRQCHIP_MASK_ON_SUSPEND to make sure gpio irq is masked on
> suspend, if lack this flag, current irq arctitecture will not mask
> the irq, and these unmasked gpio irq will wrongly wakeup the system
> even they are not config as wakeup source.
>
> Also add flag IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND to make sure the gpio
> irq which is configed as wakeup source can work as expect.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/gpio/gpio-vf610.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
> index a89ae84a1fa0..77d5b8dd2bd5 100644
> --- a/drivers/gpio/gpio-vf610.c
> +++ b/drivers/gpio/gpio-vf610.c
> @@ -260,7 +260,8 @@ static const struct irq_chip vf610_irqchip = {
>         .irq_unmask = vf610_gpio_irq_unmask,
>         .irq_set_type = vf610_gpio_irq_set_type,
>         .irq_set_wake = vf610_gpio_irq_set_wake,
> -       .flags = IRQCHIP_IMMUTABLE,
> +       .flags = IRQCHIP_IMMUTABLE | IRQCHIP_MASK_ON_SUSPEND
> +                       | IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND,
>         GPIOCHIP_IRQ_RESOURCE_HELPERS,
>  };
>
> --
> 2.34.1
>

Both patches look like fixes, can you add the Fixes: tags?

Bart
Bough Chen Oct. 17, 2023, 10:16 a.m. UTC | #2
> -----Original Message-----
> From: Bartosz Golaszewski <brgl@bgdev.pl>
> Sent: 2023年10月17日 18:10
> To: Bough Chen <haibo.chen@nxp.com>
> Cc: linus.walleij@linaro.org; andy@kernel.org; linux-gpio@vger.kernel.org;
> dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH 1/2] gpio: vf610: mask the gpio irq in system suspend and
> support wakeup
> 
> On Tue, Oct 17, 2023 at 5:25 AM <haibo.chen@nxp.com> wrote:
> >
> > From: Haibo Chen <haibo.chen@nxp.com>
> >
> > Add flag IRQCHIP_MASK_ON_SUSPEND to make sure gpio irq is masked on
> > suspend, if lack this flag, current irq arctitecture will not mask the
> > irq, and these unmasked gpio irq will wrongly wakeup the system even
> > they are not config as wakeup source.
> >
> > Also add flag IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND to make sure the
> gpio
> > irq which is configed as wakeup source can work as expect.
> >
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> >  drivers/gpio/gpio-vf610.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
> > index a89ae84a1fa0..77d5b8dd2bd5 100644
> > --- a/drivers/gpio/gpio-vf610.c
> > +++ b/drivers/gpio/gpio-vf610.c
> > @@ -260,7 +260,8 @@ static const struct irq_chip vf610_irqchip = {
> >         .irq_unmask = vf610_gpio_irq_unmask,
> >         .irq_set_type = vf610_gpio_irq_set_type,
> >         .irq_set_wake = vf610_gpio_irq_set_wake,
> > -       .flags = IRQCHIP_IMMUTABLE,
> > +       .flags = IRQCHIP_IMMUTABLE | IRQCHIP_MASK_ON_SUSPEND
> > +                       | IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND,
> >         GPIOCHIP_IRQ_RESOURCE_HELPERS,  };
> >
> > --
> > 2.34.1
> >
> 
> Both patches look like fixes, can you add the Fixes: tags?

Sure, will send V2 to include fix tag.

Best Regards
Haibo Chen
> 
> Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index a89ae84a1fa0..77d5b8dd2bd5 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -260,7 +260,8 @@  static const struct irq_chip vf610_irqchip = {
 	.irq_unmask = vf610_gpio_irq_unmask,
 	.irq_set_type = vf610_gpio_irq_set_type,
 	.irq_set_wake = vf610_gpio_irq_set_wake,
-	.flags = IRQCHIP_IMMUTABLE,
+	.flags = IRQCHIP_IMMUTABLE | IRQCHIP_MASK_ON_SUSPEND
+			| IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND,
 	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };