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
This commit is contained in:
Louis Yung-Chieh Lo
2012-04-17 16:11:51 +08:00
parent 7a33ee53a6
commit 755a767c2b
3 changed files with 20 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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),