From 8a1f1b045a2bffc0c3bf3941709acf4ba99d32e7 Mon Sep 17 00:00:00 2001 From: Kenji Chen Date: Sun, 26 Oct 2014 21:58:40 +0800 Subject: EC:KBC: Wait until LPC host senses the IRQ and gets the character. BRANCH=master BUG=chrome-os-partner:29139 TEST=Buiid an EC FW image and run on Rambi to test if key loss is improved and any side effect somes with this change. Need more test units to confirm this. Signed-off-by: Kenji Chen Change-Id: I2399e33d2ca3defe8cd9b1f94ab0af1db7f84635 Reviewed-on: https://chromium-review.googlesource.com/225557 Reviewed-by: Randall Spangler Reviewed-by: Mohammed Habibulla --- chip/lm4/lpc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index 8f8c5434a4..6bab4fb761 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -92,11 +92,16 @@ static void keyboard_irq_assert(void) * following falling edge, regardless of the line state before this * function call. */ + uint64_t tstop = get_time().val + MSEC; gpio_set_level(CONFIG_KEYBOARD_IRQ_GPIO, 1); udelay(4); /* Generate a falling edge */ gpio_set_level(CONFIG_KEYBOARD_IRQ_GPIO, 0); - udelay(4); + /* Wait for host senses the interrupt and gets the char. */ + do { + if (get_time().val > tstop) + break; + } while (lpc_keyboard_has_char()); /* Set signal high, now that we've generated the edge */ gpio_set_level(CONFIG_KEYBOARD_IRQ_GPIO, 1); } -- cgit v1.2.1