Skip to contentSkip to conversation

few bug fix for vf610 gpio driver

PATCH Applied [email protected] 2 participants 4 messages Oct 17, 2023 – Oct 18, 2023 GPIO

lore
Share & tools
lore
#0 lore raw

v2 cover few bug fix for vf610 gpio driver

From: Haibo Chen <[email protected]>

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(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 gpio: vf610: mask the gpio irq in system suspend and support wakeup

From: Haibo Chen <[email protected]>

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")
---
 drivers/gpio/gpio-vf610.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-vf610.c +2 -1
index a89ae84a1fa0..77d5b8dd2bd5 100644
@@ -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,
 };
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 gpio: vf610: config the data value before the direction setting to avoid glitch

In reply to [email protected]

From: Haibo Chen <[email protected]>

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")
---
 drivers/gpio/gpio-vf610.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-vf610.c +2 -2
index 77d5b8dd2bd5..444501c56a3b 100644
@@ -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);
 }
 
Signature · 1 line
2.34.1
#3 lore raw
In reply to [email protected]
Quoted 11 lines · On Tue, Oct 17, 2023 at 12:37 PM <[email protected]> wrote:

From: Haibo Chen <[email protected]>

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

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

--
2.34.1

Applied, thanks!

Bart