summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2012-03-16 15:59:43 +0800
committerLouis Yung-Chieh Lo <yjlou@chromium.org>2012-03-20 11:07:19 +0800
commitf8f802cbb8ad553dee8ba3fb713c7a926f369095 (patch)
treee1484115ceb537dee5ac531d3ce1ffba45def547
parente68844824b078df55c8ee19aec5d4b685d4898f5 (diff)
downloadchrome-ec-f8f802cbb8ad553dee8ba3fb713c7a926f369095.tar.gz
Keyboard wakeup.
The final piece links the keyboard press and x86_power module. BUG=chrome-os-partner:8523 TEST=on the link board. wait for 15 minutes to make host suspend. touch any key to wake up host. Change-Id: Ie6ae840ae546731daea48ab457fdc056feb5a685
-rw-r--r--common/keyboard.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/keyboard.c b/common/keyboard.c
index 54386ac2ec..78864755cb 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -10,6 +10,8 @@
#include "console.h"
#include "keyboard.h"
#include "i8042.h"
+#include "lpc.h"
+#include "lpc_commands.h"
#include "registers.h"
#include "timer.h"
#include "uart.h"
@@ -214,6 +216,19 @@ static void clean_underlying_buffer(void) {
}
+/* TODO: Move this implementation to platform-dependent files.
+ * We don't do it now because not every board implement x86_power.c
+ * bds: no CONFIG_LPC and no CONFIG_TASK_X86POWER
+ * daisy(variants): no CONFIG_LPC and no CONFIG_TASK_X86POWER
+ * crosbug.com/p/8523
+ */
+static void keyboard_wakeup(void) {
+#ifdef CONFIG_LPC
+ lpc_set_host_events(EC_LPC_HOST_EVENT_MASK(EC_LPC_HOST_EVENT_KEY_PRESSED));
+#endif
+}
+
+
void keyboard_state_changed(int row, int col, int is_pressed) {
uint8_t scan_code[MAX_SCAN_CODE_LEN];
int32_t len;
@@ -234,6 +249,10 @@ void keyboard_state_changed(int row, int col, int is_pressed) {
* assertion in the debug stage. */
ASSERT(ret == EC_SUCCESS);
}
+
+ if (is_pressed) {
+ keyboard_wakeup();
+ }
}