linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] few bug fix for vf610 gpio driver
@ 2023-10-17 10:42 haibo.chen
  2023-10-17 10:42 ` [PATCH v2 1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup haibo.chen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: haibo.chen @ 2023-10-17 10:42 UTC (permalink / raw)
  To: linus.walleij, brgl
  Cc: andy, stefan, shawn.guo, aisheng.dong, linux-gpio, linux-imx,
	haibo.chen

From: Haibo Chen <haibo.chen@nxp.com>

Change for V2:
  add the fix tag for each patch.

Haibo Chen (2):
  gpio: vf610: mask the gpio irq in system suspend and support wakeup
  gpio: vf610: config the data value before the direction setting to
    avoid glitch

 drivers/gpio/gpio-vf610.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.34.1


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

* [PATCH v2 1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup
  2023-10-17 10:42 [PATCH v2 0/2] few bug fix for vf610 gpio driver haibo.chen
@ 2023-10-17 10:42 ` haibo.chen
  2023-10-17 10:42 ` [PATCH v2 2/2] gpio: vf610: config the data value before the direction setting to avoid glitch haibo.chen
  2023-10-18  9:03 ` [PATCH v2 0/2] few bug fix for vf610 gpio driver Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: haibo.chen @ 2023-10-17 10:42 UTC (permalink / raw)
  To: linus.walleij, brgl
  Cc: andy, stefan, shawn.guo, aisheng.dong, linux-gpio, linux-imx,
	haibo.chen

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.

Fixes: 7f2691a19627 ("gpio: vf610: add gpiolib/IRQ chip driver for Vybrid")
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


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

* [PATCH v2 2/2] gpio: vf610: config the data value before the direction setting to avoid glitch
  2023-10-17 10:42 [PATCH v2 0/2] few bug fix for vf610 gpio driver haibo.chen
  2023-10-17 10:42 ` [PATCH v2 1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup haibo.chen
@ 2023-10-17 10:42 ` haibo.chen
  2023-10-18  9:03 ` [PATCH v2 0/2] few bug fix for vf610 gpio driver Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: haibo.chen @ 2023-10-17 10:42 UTC (permalink / raw)
  To: linus.walleij, brgl
  Cc: andy, stefan, shawn.guo, aisheng.dong, linux-gpio, linux-imx,
	haibo.chen

From: Haibo Chen <haibo.chen@nxp.com>

We find a glitch when config the pad as output high. To avoid this
glitch, move the data value setting before direction config in the
function vf610_gpio_direction_output().

Fixes: 659d8a62311f ("gpio: vf610: add imx7ulp support")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/gpio/gpio-vf610.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 77d5b8dd2bd5..444501c56a3b 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -140,14 +140,14 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
 	unsigned long mask = BIT(gpio);
 	u32 val;
 
+	vf610_gpio_set(chip, gpio, value);
+
 	if (port->sdata->have_paddr) {
 		val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR);
 		val |= mask;
 		vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
 	}
 
-	vf610_gpio_set(chip, gpio, value);
-
 	return pinctrl_gpio_direction_output(chip->base + gpio);
 }
 
-- 
2.34.1


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

* Re: [PATCH v2 0/2] few bug fix for vf610 gpio driver
  2023-10-17 10:42 [PATCH v2 0/2] few bug fix for vf610 gpio driver haibo.chen
  2023-10-17 10:42 ` [PATCH v2 1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup haibo.chen
  2023-10-17 10:42 ` [PATCH v2 2/2] gpio: vf610: config the data value before the direction setting to avoid glitch haibo.chen
@ 2023-10-18  9:03 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2023-10-18  9:03 UTC (permalink / raw)
  To: haibo.chen
  Cc: linus.walleij, andy, stefan, shawn.guo, aisheng.dong, linux-gpio,
	linux-imx

On Tue, Oct 17, 2023 at 12:37 PM <haibo.chen@nxp.com> wrote:
>
> From: Haibo Chen <haibo.chen@nxp.com>
>
> Change for V2:
>   add the fix tag for each patch.
>
> Haibo Chen (2):
>   gpio: vf610: mask the gpio irq in system suspend and support wakeup
>   gpio: vf610: config the data value before the direction setting to
>     avoid glitch
>
>  drivers/gpio/gpio-vf610.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> --
> 2.34.1
>

Applied, thanks!

Bart

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

end of thread, other threads:[~2023-10-18  9:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-17 10:42 [PATCH v2 0/2] few bug fix for vf610 gpio driver haibo.chen
2023-10-17 10:42 ` [PATCH v2 1/2] gpio: vf610: mask the gpio irq in system suspend and support wakeup haibo.chen
2023-10-17 10:42 ` [PATCH v2 2/2] gpio: vf610: config the data value before the direction setting to avoid glitch haibo.chen
2023-10-18  9:03 ` [PATCH v2 0/2] few bug fix for vf610 gpio driver 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).