diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2016-06-29 18:17:19 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-06-30 20:14:01 -0700 |
commit | adac37bf0c99e90ef4767681ba9f1a293cdae518 (patch) | |
tree | dada0ef9b80312f17b5f573eb125260f1d0cf68b /common/keyboard_scan.c | |
parent | 1457ea2155f118d2e4127babadcdc417ad966db2 (diff) | |
download | chrome-ec-adac37bf0c99e90ef4767681ba9f1a293cdae518.tar.gz |
keyboard_scan: Support boot key recognition with stuck KSI2
For certain board configurations, KSI2 will be stuck asserted for all
scan columns if the power button is held. We must be aware of this case
in order to correctly handle recovery mode key combinations.
BUG=chrome-os-partner:54602
BRANCH=None
TEST=Manual on gru. Do three-key salute, verify EC detects recovery mode.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I03d76e1121107484f79520745858388f6cae096c
Reviewed-on: https://chromium-review.googlesource.com/357590
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/keyboard_scan.c')
-rw-r--r-- | common/keyboard_scan.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 58fe77d677..73a6e6fdaf 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -524,6 +524,21 @@ static int check_key(const uint8_t *state, int index, int mask) allowed_mask[index] |= mask; allowed_mask[KEYBOARD_COL_REFRESH] |= KEYBOARD_MASK_REFRESH; +#ifdef CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 + /* + * Check if KSI2 is asserted for all columns due to power button hold, + * and ignore it if so. + */ + for (c = 0; c < KEYBOARD_COLS; c++) + if ((keyscan_config.actual_key_mask[c] & KEYBOARD_MASK_KSI2) && + !(state[c] & KEYBOARD_MASK_KSI2)) + break; + + if (c == KEYBOARD_COLS) + for (c = 0; c < KEYBOARD_COLS; c++) + allowed_mask[c] |= KEYBOARD_MASK_KSI2; +#endif + for (c = 0; c < KEYBOARD_COLS; c++) { if (state[c] & ~allowed_mask[c]) return 0; /* Disallowed key pressed */ |