diff options
-rw-r--r-- | board/kevin/board.h | 1 | ||||
-rw-r--r-- | common/keyboard_scan.c | 15 | ||||
-rw-r--r-- | include/config.h | 7 | ||||
-rw-r--r-- | include/keyboard_config.h | 1 |
4 files changed, 24 insertions, 0 deletions
diff --git a/board/kevin/board.h b/board/kevin/board.h index dea839bb54..2dc334228a 100644 --- a/board/kevin/board.h +++ b/board/kevin/board.h @@ -45,6 +45,7 @@ #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_MKBP /* Instead of 8042 protocol of keyboard */ +#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 #define CONFIG_LTO #define CONFIG_POWER_BUTTON #define CONFIG_VBOOT_HASH 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 */ diff --git a/include/config.h b/include/config.h index 2db396f0a2..7595c796a1 100644 --- a/include/config.h +++ b/include/config.h @@ -1227,6 +1227,13 @@ */ #define CONFIG_KEYBOARD_KSO_BASE 0 +/* + * 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. + */ +#undef CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 + /* Enable extra debugging output from keyboard modules */ #undef CONFIG_KEYBOARD_DEBUG diff --git a/include/keyboard_config.h b/include/keyboard_config.h index 286b6d7560..6cb1b53a52 100644 --- a/include/keyboard_config.h +++ b/include/keyboard_config.h @@ -59,5 +59,6 @@ #define KEYBOARD_COL_KEY_2 4 #define KEYBOARD_ROW_KEY_2 6 #define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2) +#define KEYBOARD_MASK_KSI2 KEYBOARD_ROW_TO_MASK(2) #endif /* __CROS_EC_KEYBOARD_CONFIG_H */ |