diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2015-06-17 16:03:20 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-06-18 09:23:12 +0000 |
commit | ca5ecf18e4f67c594f9db699bf36a082b5241f62 (patch) | |
tree | 7a7a96499985b7fe3485ff82db15b749000999b0 | |
parent | 313623afeea195e64c1ba0faa6887361137ed8c8 (diff) | |
download | chrome-ec-ca5ecf18e4f67c594f9db699bf36a082b5241f62.tar.gz |
ryu: update recovery key combinations
Update the recovery key combination to: power key + volume up when the
AP is off.
Add a fastboot key combination: power key + volume down when the AP is
off.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=smaug
BUG=chrome-os-partner:41629
TEST=on Ryu, shutdown the AP, press "power+volup" or "power+voldown" and
see the right trace.
Change-Id: I42cf368d42885717758fc4b494af5c8a16fc58b0
Reviewed-on: https://chromium-review.googlesource.com/278323
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/ryu/board.c | 35 | ||||
-rw-r--r-- | include/ec_commands.h | 3 |
2 files changed, 29 insertions, 9 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c index 348dd55c9f..0cbfd80014 100644 --- a/board/ryu/board.c +++ b/board/ryu/board.c @@ -199,15 +199,6 @@ static void board_init(void) gpio_enable_interrupt(GPIO_USBC_BC12_INT_L); /* - * Determine recovery mode is requested by the power, volup, and - * voldown buttons being pressed. - */ - if (power_button_signal_asserted() && - !gpio_get_level(GPIO_BTN_VOLD_L) && - !gpio_get_level(GPIO_BTN_VOLU_L)) - host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY); - - /* * Initialize AP and SH console forwarding USARTs and queues. */ queue_init(&ap_usart_to_usb); @@ -229,6 +220,32 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); +static void board_startup_key_combo(void) +{ + int vold = !gpio_get_level(GPIO_BTN_VOLD_L); + int volu = !gpio_get_level(GPIO_BTN_VOLU_L); + int pwr = power_button_signal_asserted(); + + /* + * Determine recovery mode is requested by the power and + * voldown buttons being pressed (while device was off). + */ + if (pwr && vold && !volu) { + host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY); + CPRINTS("> RECOVERY mode"); + } + + /* + * Determine fastboot mode is requested by the power and + * voldown buttons being pressed (while device was off). + */ + if (pwr && volu && !vold) { + host_set_single_event(EC_HOST_EVENT_KEYBOARD_FASTBOOT); + CPRINTS("> FASTBOOT mode"); + } +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_startup_key_combo, HOOK_PRIO_DEFAULT); + /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { {GPIO_AP_HOLD, 1, "AP_HOLD"}, diff --git a/include/ec_commands.h b/include/ec_commands.h index a0ace7e593..a6441abb25 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -428,6 +428,9 @@ enum host_event_code { /* EC encountered a panic, triggering a reset */ EC_HOST_EVENT_PANIC = 24, + /* Keyboard fastboot combo has been pressed */ + EC_HOST_EVENT_KEYBOARD_FASTBOOT = 25, + /* * The high bit of the event mask is not used as a host event code. If * it reads back as set, then the entire event mask should be |