[PATCH] gpio: ath79: circumvent ghost interrupts
David Bauer
mail at david-bauer.net
Sun Jun 16 10:20:49 EDT 2019
The ath79 gpio driver may emit "ghost interrupts" in case the interrupts
are registered directly after setting the GPIO direction.
This patch adds a short delay before activating interrupts on any line
to make sure no ghost interrupts will be registered.
Signed-off-by: David Bauer <mail at david-bauer.net>
---
drivers/gpio/gpio-ath79.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
index 0a553d676042..238f5bdbe7a8 100644
--- a/drivers/gpio/gpio-ath79.c
+++ b/drivers/gpio/gpio-ath79.c
@@ -12,6 +12,7 @@
*/
#include <linux/gpio/driver.h>
+#include <linux/delay.h>
#include <linux/platform_data/gpio-ath79.h>
#include <linux/of_device.h>
#include <linux/interrupt.h>
@@ -96,6 +97,12 @@ static void ath79_gpio_irq_enable(struct irq_data *data)
u32 mask = BIT(irqd_to_hwirq(data));
unsigned long flags;
+ /*
+ * The input can be unstable after configuring GPIO direction.
+ * Wait a bit to assert the input is stable.
+ */
+ msleep(25);
+
raw_spin_lock_irqsave(&ctrl->lock, flags);
ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_ENABLE, mask, mask);
ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, mask);
--
2.22.0
Best wishes
David
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list