summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-05-16 17:28:27 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-05-16 22:49:42 -0700
commited45aba4bd123325ea8c97220c5f45ed2326b311 (patch)
tree3a495125130e88282131b18f82d7e7796fe40517
parent0f41a73dbf9ac5ec569ab53600b7b8e95453a284 (diff)
downloadchrome-ec-ed45aba4bd123325ea8c97220c5f45ed2326b311.tar.gz
keyboard_scan: Add refresh and power button boot key options
Make Esc+Refresh+Power on Grunt enter Recovery Mode. If Power is released fast: [0.045303 KB init state: -- 02 08 -- -- -- -- -- -- -- -- -- --] Add CONFIG_KEYBOARD_IGNORE_REFRESH_BOOT_KEY to handle this case. If Power is held longer: [0.045448 KB init state: 08 0a 08 08 08 -- 08 -- 08 08 -- 08 08] Add CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3 to handle this case. BUG=b:79758966 BRANCH=none TEST=Esc+Refresh+Power gives recovery screen on Grunt Change-Id: I43a7d485535ff7b0d9bfce59f28c0049ee989818 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1063032 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
-rw-r--r--board/grunt/board.h3
-rw-r--r--common/keyboard_scan.c16
-rw-r--r--include/config.h6
-rw-r--r--include/keyboard_config.h6
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 */