summaryrefslogtreecommitdiff
path: root/include/lpc.h
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2012-05-09 01:05:15 +0800
committerLouis Yung-Chieh Lo <yjlou@chromium.org>2012-05-17 10:26:16 +0800
commit1cb328dc0c429233b7731d4e9eb1a8f03d4f6f8d (patch)
treec7f1f2353878f32cb3a7b2ffd7099286cc1d0404 /include/lpc.h
parent546aeddc977cbbfc6fa2a041f6d1c94d7b5eb987 (diff)
downloadchrome-ec-1cb328dc0c429233b7731d4e9eb1a8f03d4f6f8d.tar.gz
Fix some behaviors of keyboard command handlers.
The phenomenon is that there is a char on-hold in port 0x60 and the kernel never picks it up. Hence the keyboard cannnot be recognized after resume. It comes from multiple reasons: 1. The command I8042_CMD_RESET_BAT(0xff) and I8042_CMD_ENABLE(0xf4) didn't clean the buffer. 2. clean_underlying_buffer() has clean the queue, but forgot to clean the TOH (TO Host). Add keyboard_clean_buffer() to clean the TOH (To Host). 3. When KB interrupt is just enabled, the IRQ didn't sent if there is a char queued in buffer already. keyboard_resume_interrupt() solves this. 4. Not all keyboard reset should reset the buffer. Only the enable/disble of controller RAM should NOT reset buffer. Other enable/disable should clean the buffer. 5. i8042 commands (those commands to port 0x64) should NOT return ACK even the parameter byte(s) goes to port 0x60. 6. Keyboard was disabled by kernel, but key stroke still sent to host (this needs the BIOS to fix). Also fix the minor issues: 1. I8042_CMD_RESEND should not return I8042_RET_ACK. 2. I8042_DIS_KB/I8042_ENA_KB should effect the controller RAM content. 3. only send out the scan code when keyboard is enabled. 4. add kblog command for future debug (disabled by default because it neeeds 1KB of memory). Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> BUG=chrome-os-partner:9525 TEST=tested on link. Start from S0. 1. Run powerd_suspend. 2. Expect system is in S3. 3. Press any key to wake up system. 4. Expect system is up and keyboard is working. 5. repeat for 20+ times. Change-Id: I1c48822687d7c1f7ef0e8d8bca54bf9b05fd785f
Diffstat (limited to 'include/lpc.h')
-rw-r--r--include/lpc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/lpc.h b/include/lpc.h
index 45e777689a..e9f5cad690 100644
--- a/include/lpc.h
+++ b/include/lpc.h
@@ -25,6 +25,12 @@ int lpc_keyboard_has_char(void);
/* Send a byte to host via port 0x60 and asserts IRQ if specified. */
void lpc_keyboard_put_char(uint8_t chr, int send_irq);
+/* Clear the keyboard buffer. */
+void lpc_keyboard_clear_buffer(void);
+
+/* Send an IRQ to host if there is a byte in buffer already. */
+void lpc_keyboard_resume_irq(void);
+
/* Return non-zero if the COMx interface has received a character. */
int lpc_comx_has_char(void);