From edcda5390729b5c634c2497b889acabab7956974 Mon Sep 17 00:00:00 2001 From: Girish Mahadevan Date: Mon, 1 Aug 2016 16:51:49 -0600 Subject: [PATCH] serial: msm_serial_hs: Change the wakeup interrupt enable sequence The wakeup variable keeps track of the 2 edge interrupts needed to detect wakeup from deep sleep, when the second edge interrupt is detected the wake byte is injected into the tty buffer. On some boards due to noisy GPIO pins an interrupt is detected as soon as the wakeup irq is enabled and before the variable is reset leading to bogus wakeup bytes being injected into the serial buffer. To protect against this, make sure the wakeup interrupt is enabled after all the state variables are reset to protect against spurious wakeups. Change-Id: I8002a67d8d9cb41709049ff34f35717f3dd0acd0 Acked-by: Yijiang Yuan Signed-off-by: Girish Mahadevan --- drivers/tty/serial/msm_serial_hs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index 51dce6d43890..fa3c9e511663 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c @@ -2213,12 +2213,12 @@ void enable_wakeup_interrupt(struct msm_hs_port *msm_uport) return; if (!(msm_uport->wakeup.enabled)) { - enable_irq(msm_uport->wakeup.irq); - disable_irq(uport->irq); spin_lock_irqsave(&uport->lock, flags); msm_uport->wakeup.ignore = 1; msm_uport->wakeup.enabled = true; spin_unlock_irqrestore(&uport->lock, flags); + disable_irq(uport->irq); + enable_irq(msm_uport->wakeup.irq); } else { MSM_HS_WARN("%s:Wake up IRQ already enabled", __func__); }