diff options
author | Keith Short <keithshort@chromium.org> | 2019-03-13 12:22:36 -0600 |
---|---|---|
committer | Vadim Bendebury <vbendeb@chromium.org> | 2019-09-21 19:11:20 -0700 |
commit | 2fe7f933f42a59b71d56427f95dd4e46784ba670 (patch) | |
tree | d65e9076b4eea7d546d92f8da10e9be39a6ae670 | |
parent | 81414a7b5ce5bfbb864a19e830b2b21bf35463aa (diff) | |
download | chrome-ec-2fe7f933f42a59b71d56427f95dd4e46784ba670.tar.gz |
cr50: Update to VENDOR_CC_GET_PWR_BTN (take two)
Change the VENDOR_CC_GET_PWR_BTN behavior to report the live state of
the power button. On Wilco devices, the AP needs to poll for both a
power button press and release prior to booting an untrusted OS.
The falling edge of the power button is still latched, so the first call
to VENDOR_CC_GET_PWR_BTN command will return a button state of 1 if this
call is made within 10 seconds. Once the latched state is clear,
VENDOR_CC_GET_PWR_BTN returns the live state of the power button.
BUG=b:128431787
BRANCH=cr50
TEST=Added test code into vboot recovery screen to poll
VENDOR_CC_GET_PWR_BTN command for a power button press and a power
button release.
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1534337
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Matt Delco <delco@google.com>
(cherry picked from commit 63bf8f8ba87b23378391b147f1b3e9fdcf3d8dc5)
Change-Id: I09050707b2c7a699bfd4512dacdb5b65ac5cbcf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644275
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit a952a460f2e2e3ddb7efb30824bb9cbf6c46d3e2)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1705696
(cherry picked from commit 2345fbba68129dfdf36dc7c27ed7de3edaf30aca)
-rw-r--r-- | board/cr50/power_button.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/board/cr50/power_button.c b/board/cr50/power_button.c index 83379ae167..5f46a4d0a6 100644 --- a/board/cr50/power_button.c +++ b/board/cr50/power_button.c @@ -140,7 +140,18 @@ static enum vendor_cmd_rc vc_get_pwr_btn(enum vendor_cmd_cc code, size_t input_size, size_t *response_size) { - if (pop_check_presence(1) == POP_TOUCH_YES) + /* + * The AP uses VENDOR_CC_GET_PWR_BTN to poll both for the press and + * release of the power button. + * + * pop_check_presence(1) returns true if a new power button press was + * recorded in the last 10 seconds. + * + * Indicate button release if no new presses have been recorded and the + * current button state is not pressed. + */ + if (pop_check_presence(1) == POP_TOUCH_YES || + rbox_powerbtn_is_pressed()) *(uint8_t *)buf = 1; else *(uint8_t *)buf = 0; |