diff options
-rw-r--r-- | board/grunt/board.h | 3 | ||||
-rw-r--r-- | common/keyboard_scan.c | 16 | ||||
-rw-r--r-- | include/config.h | 6 | ||||
-rw-r--r-- | include/keyboard_config.h | 6 |
4 files changed, 23 insertions, 8 deletions
diff --git a/board/grunt/board.h b/board/grunt/board.h index dd6d3c7886..364527226b 100644 --- a/board/grunt/board.h +++ b/board/grunt/board.h @@ -88,6 +88,9 @@ #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_8042 +#define CONFIG_KEYBOARD_REFRESH_ROW3 +#define CONFIG_KEYBOARD_IGNORE_REFRESH_BOOT_KEY +#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3 #define CONFIG_USB_POWER_DELIVERY #define CONFIG_CMD_PD_CONTROL diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index e63c164100..fee48e6a26 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -542,19 +542,23 @@ static uint32_t check_key_list(const uint8_t *state) /* Make copy of current debounced state. */ memcpy(curr_state, state, sizeof(curr_state)); -#ifdef CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 +#ifdef KEYBOARD_MASK_PWRBTN /* - * Check if KSI2 is asserted for all columns due to power button hold, - * and ignore it if so. + * Check if KSI2 or KSI3 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) && - !(curr_state[c] & KEYBOARD_MASK_KSI2)) + if ((keyscan_config.actual_key_mask[c] & KEYBOARD_MASK_PWRBTN) + && !(curr_state[c] & KEYBOARD_MASK_PWRBTN)) break; if (c == KEYBOARD_COLS) for (c = 0; c < KEYBOARD_COLS; c++) - curr_state[c] &= ~KEYBOARD_MASK_KSI2; + curr_state[c] &= ~KEYBOARD_MASK_PWRBTN; +#endif + +#ifdef CONFIG_KEYBOARD_IGNORE_REFRESH_BOOT_KEY + curr_state[KEYBOARD_COL_REFRESH] &= ~KEYBOARD_MASK_REFRESH; #endif /* Update mask with all boot keys that were pressed. */ diff --git a/include/config.h b/include/config.h index 2a7a3128cc..1c1a56af1c 100644 --- a/include/config.h +++ b/include/config.h @@ -1873,11 +1873,15 @@ #define CONFIG_KEYBOARD_KSO_BASE 0 /* - * For certain board configurations, KSI2 will be stuck asserted for all + * For certain board configurations, KSI2 or KSI3 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 +#undef CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3 + +/* Some boards see the refresh key pressed on boot when triggering recovery. */ +#undef CONFIG_KEYBOARD_IGNORE_REFRESH_BOOT_KEY /* Enable extra debugging output from keyboard modules */ #undef CONFIG_KEYBOARD_DEBUG diff --git a/include/keyboard_config.h b/include/keyboard_config.h index b4aa21ad99..f338d63c7f 100644 --- a/include/keyboard_config.h +++ b/include/keyboard_config.h @@ -63,9 +63,13 @@ #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) #define KEYBOARD_COL_LEFT_SHIFT 7 #define KEYBOARD_ROW_LEFT_SHIFT 5 #define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT) +#ifdef CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 +#define KEYBOARD_MASK_PWRBTN KEYBOARD_ROW_TO_MASK(2) +#elif defined(CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3) +#define KEYBOARD_MASK_PWRBTN KEYBOARD_ROW_TO_MASK(3) +#endif #endif /* __CROS_EC_KEYBOARD_CONFIG_H */ |