[v2] pinctrl: baytrail: Enable glitch filter for GPIOs used as interrupts

Message ID 20180101122357.10465-1-hdegoede@redhat.com
State New
Headers show
Series
  • [v2] pinctrl: baytrail: Enable glitch filter for GPIOs used as interrupts
Related show

Commit Message

Hans de Goede Jan. 1, 2018, 12:23 p.m.
On some systems, some PCB traces attached to GpioInts are routed in such
a way that they pick up enough interference to constantly (many times per
second) trigger.

Enabling glitch-filtering fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Unconditionally enable glitch-filtering for all GpioInts instead of using
 a DMI list, as suggested by Mika Westerberg
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mika Westerberg Jan. 2, 2018, 7:31 a.m. | #1
On Mon, Jan 01, 2018 at 01:23:57PM +0100, Hans de Goede wrote:
> On some systems, some PCB traces attached to GpioInts are routed in such
> a way that they pick up enough interference to constantly (many times per
> second) trigger.
> 
> Enabling glitch-filtering fixes this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Jan. 2, 2018, 9:39 a.m. | #2
On Mon, Jan 1, 2018 at 1:23 PM, Hans de Goede <hdegoede@redhat.com> wrote:

> On some systems, some PCB traces attached to GpioInts are routed in such
> a way that they pick up enough interference to constantly (many times per
> second) trigger.
>
> Enabling glitch-filtering fixes this.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Unconditionally enable glitch-filtering for all GpioInts instead of using
>  a DMI list, as suggested by Mika Westerberg

Patch applied with Mika's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 9c1ca29c60b7..6b52ea1440a6 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -46,6 +46,9 @@ 
 #define BYT_TRIG_POS		BIT(25)
 #define BYT_TRIG_LVL		BIT(24)
 #define BYT_DEBOUNCE_EN		BIT(20)
+#define BYT_GLITCH_FILTER_EN	BIT(19)
+#define BYT_GLITCH_F_SLOW_CLK	BIT(17)
+#define BYT_GLITCH_F_FAST_CLK	BIT(16)
 #define BYT_PULL_STR_SHIFT	9
 #define BYT_PULL_STR_MASK	(3 << BYT_PULL_STR_SHIFT)
 #define BYT_PULL_STR_2K		(0 << BYT_PULL_STR_SHIFT)
@@ -1579,6 +1582,9 @@  static int byt_irq_type(struct irq_data *d, unsigned int type)
 	 */
 	value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG |
 		   BYT_TRIG_LVL);
+	/* Enable glitch filtering */
+	value |= BYT_GLITCH_FILTER_EN | BYT_GLITCH_F_SLOW_CLK |
+		 BYT_GLITCH_F_FAST_CLK;
 
 	writel(value, reg);