summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2012-04-17 16:11:51 +0800
committerLouis Yung-Chieh Lo <yjlou@chromium.org>2012-04-18 10:45:28 +0800
commit755a767c2bac52522595ceb9fec5e651244d0449 (patch)
tree611296c9bb8de9464ee16d1592d412408dcdebe5
parent7a33ee53a6dd0fe6f604b8ce63796c510829ece6 (diff)
downloadchrome-ec-755a767c2bac52522595ceb9fec5e651244d0449.tar.gz
Fixed the bug that reboot_ec resets the keyboard state to disabled.
The reboot_ec command could warm boot the EC while the host is still running. However, this resets the internal state so that the keyboard module is disabled on the EC side. Check the reset cause during the keyboard init code. If it is wrm boot, enable the keyboard (assume the host is on). BUG=chrome-os-partner:9102 TEST=on link 1.0 % ectool version Firmware copy: RO % ectool reboot_ec RO the keyboard keeps working. Change-Id: I0009c561e2cd88789e50f9129b494538e50ee00e
-rw-r--r--common/keyboard.c16
-rw-r--r--common/main.c3
-rw-r--r--include/keyboard.h2
3 files changed, 20 insertions, 1 deletions
diff --git a/common/keyboard.c b/common/keyboard.c
index 65e9b45d40..84d1a64d81 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -13,6 +13,7 @@
#include "lpc.h"
#include "lpc_commands.h"
#include "registers.h"
+#include "system.h"
#include "task.h"
#include "timer.h"
#include "uart.h"
@@ -799,3 +800,18 @@ static int command_keyboard_press(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(kbpress, command_keyboard_press);
+
+
+int keyboard_init(void)
+{
+ /* If the host is still alive during the EC resets (ex. reboot_ec),
+ * we should enable keyboard so that the user can type. */
+ enum system_reset_cause_t reset_cause = system_get_reset_cause();
+ if (reset_cause == SYSTEM_RESET_SOFT_WARM ||
+ reset_cause == SYSTEM_RESET_WATCHDOG ||
+ reset_cause == SYSTEM_RESET_SOFT_COLD ) {
+ i8042_enable_keyboard_irq();
+ }
+
+ return 0;
+}
diff --git a/common/main.c b/common/main.c
index 05ce0e5096..1b72d9f9ab 100644
--- a/common/main.c
+++ b/common/main.c
@@ -99,6 +99,9 @@ int main(void)
#ifdef CONFIG_EOPTION
eoption_init();
#endif
+#ifdef CONFIG_TASK_I8042CMD
+ keyboard_init();
+#endif
#ifdef CONFIG_TASK_KEYSCAN
keyboard_scan_init();
#endif
diff --git a/include/keyboard.h b/include/keyboard.h
index f715ab2bba..bc5aaadfe9 100644
--- a/include/keyboard.h
+++ b/include/keyboard.h
@@ -26,7 +26,7 @@ enum scancode_set_list {
/* The initialize code of keyboard lib. Called by core main. */
-enum ec_error_list keyboard_init(void);
+int keyboard_init(void);
/* Called by keyboard scan code once any key state change (after de-bounce),