summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenji Chen <kenji.chen@intel.com>2014-10-26 21:58:40 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-28 20:55:51 +0000
commit1fbae47011c58b739e03d515b791b5de38b93dad (patch)
treed7e85d99ed474ca37dc20a00ab42d28fca37ff73
parent7f19bd31cd489b0c6df1dd059271678d3d354f05 (diff)
downloadchrome-ec-1fbae47011c58b739e03d515b791b5de38b93dad.tar.gz
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 <kenji.chen@intel.com> Change-Id: I2399e33d2ca3defe8cd9b1f94ab0af1db7f84635 Reviewed-on: https://chromium-review.googlesource.com/226010 Reviewed-by: Mohammed Habibulla <moch@chromium.org>
-rw-r--r--chip/lm4/lpc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 99f212af19..536b31fca3 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);
}