summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-08-20 15:39:49 -0500
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-21 08:02:05 +0000
commit0539cc2ed5692fd17a120ba6eed8c5ece67be82b (patch)
tree48f66ea4788e5a2ec58f65ddefd62e7a7c92dc47
parent97a4fd2751a47189aeb181da9e5a42ed651e5c33 (diff)
downloadchrome-ec-0539cc2ed5692fd17a120ba6eed8c5ece67be82b.tar.gz
ryu: detect recovery mode and set proper event
When the power button, volume up, and volume down buttons are pressed during boot indicate to the AP that recovery mode is enabled. BUG=chrome-os-partner:31481 BRANCH=None TEST=Benson tested this w/ his magic cables. Change-Id: I2f285d6b8b71708eff53e8b46020e51c96f281a4 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213299 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/ryu/board.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c
index a7ccd8c8da..64b338866b 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -12,6 +12,7 @@
#include "console.h"
#include "gpio.h"
#include "hooks.h"
+#include "host_command.h"
#include "i2c.h"
#include "power.h"
#include "power_button.h"
@@ -38,6 +39,15 @@ void unhandled_evt(enum gpio_signal signal)
static void board_init(void)
{
/*
+ * 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);
+
+ /*
* Enable CC lines after all GPIO have been initialized. Note, it is
* important that this is enabled after the CC_DEVICE_ODL lines are
* set low to specify device mode.