summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chen <ben.chen2@quanta.corp-partner.google.com>2021-06-10 13:47:36 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-10 10:15:09 +0000
commit91c208d9a37bfd39e987a706c704c1fa0a01a5a9 (patch)
treefc1b2e994ae40d55e0d58c6cd1a64e6a9e5df0ef
parent3f0a4e0978e1c593d5013d1df846d8ef8d2d31fe (diff)
downloadchrome-ec-91c208d9a37bfd39e987a706c704c1fa0a01a5a9.tar.gz
keyboard_scan: add overridable function for KEYBOARD_ROW_REFRESH
add overridable function, it can use the share EC image where different keyboard layout with respect to the keyboard row on which the refresh key lives. BUG=b:184615827 BRANCH=dedede TEST=make buildall PASS Change-Id: I0dd82c619e09947dd00bef75e352c6266cb1182d Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2952284 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/keyboard_scan.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index bb3ee2a8df..3349566b55 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -609,6 +609,15 @@ static int check_keys_changed(uint8_t *state)
return any_pressed;
}
+static uint8_t keyboard_mask_refresh;
+__overridable uint8_t board_keyboard_row_refresh(void)
+{
+ if (IS_ENABLED(CONFIG_KEYBOARD_REFRESH_ROW3))
+ return 3;
+ else
+ return 2;
+}
+
#ifdef CONFIG_KEYBOARD_BOOT_KEYS
/*
* Returns mask of the boot keys that are pressed, with at most the keys used
@@ -639,7 +648,7 @@ static uint32_t check_key_list(const uint8_t *state)
curr_state[c] &= ~KEYBOARD_MASK_PWRBTN;
#endif
- curr_state[KEYBOARD_COL_REFRESH] &= ~KEYBOARD_MASK_REFRESH;
+ curr_state[KEYBOARD_COL_REFRESH] &= ~keyboard_mask_refresh;
/* Update mask with all boot keys that were pressed. */
k = boot_key_list;
@@ -681,7 +690,7 @@ static uint32_t check_boot_key(const uint8_t *state)
/* If reset was not caused by reset pin, refresh must be held down */
if (!(system_get_reset_flags() & EC_RESET_FLAG_RESET_PIN) &&
- !(state[KEYBOARD_COL_REFRESH] & KEYBOARD_MASK_REFRESH))
+ !(state[KEYBOARD_COL_REFRESH] & keyboard_mask_refresh))
return BOOT_KEY_NONE;
return check_key_list(state);
@@ -717,6 +726,10 @@ const uint8_t *keyboard_scan_get_state(void)
void keyboard_scan_init(void)
{
+ /* Configure refresh key matrix */
+ keyboard_mask_refresh = KEYBOARD_ROW_TO_MASK(
+ board_keyboard_row_refresh());
+
/* Configure GPIO */
keyboard_raw_init();