From 53baccd1edb0a2667acfe5fad55b338ac0b50b50 Mon Sep 17 00:00:00 2001 From: Josh Tsai Date: Wed, 13 Jul 2022 08:14:26 +0800 Subject: banshee: configure the correct location of the refresh key We change the refresh key from T3 to T2, so need to configure the correct location of the refresh key on different board id. BRANCH=none BUG=b:231265647 TEST=manually triggering recovery on banshee id1 and id2 TEST=evtest check all key is correct Signed-off-by: Josh Tsai Change-Id: Ie01c572c824b6c42d3c515ed14365a3e7c083cdb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3759823 Reviewed-by: Boris Mittelberg Reviewed-by: Elthan Huang Reviewed-by: Jack Rosenthal --- board/banshee/board.c | 13 ++++++++++++- board/banshee/board.h | 1 + board/banshee/keyboard_customization.c | 20 ++++++++++++++++++++ board/banshee/keyboard_customization.h | 8 +++++--- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/board/banshee/board.c b/board/banshee/board.c index 0814f35a9b..fe9feb1a82 100644 --- a/board/banshee/board.c +++ b/board/banshee/board.c @@ -27,6 +27,7 @@ #include "switch.h" #include "throttle_ap.h" #include "usbc_config.h" +#include "keyboard_scan.h" #include "gpio_list.h" /* Must come after other header files. */ @@ -100,10 +101,10 @@ void battery_present_interrupt(enum gpio_signal signal) hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0); } +static uint32_t board_id; static void configure_keyboard(void) { uint32_t cbi_val; - uint32_t board_id = 1; /* Board ID */ if (cbi_get_board_version(&cbi_val) != EC_SUCCESS || @@ -132,6 +133,8 @@ static void configure_keyboard(void) gpio_set_flags(GPIO_EC_KSO_04_INV, GPIO_ODR_HIGH); gpio_set_alternate_function(GPIO_PORT_1, (BIT(5) | BIT(7)), GPIO_ALT_FUNC_DEFAULT); + key_typ.col_refresh = KEYBOARD_COL_ID2_REFRESH; + key_typ.row_refresh = KEYBOARD_ROW_ID2_REFRESH; } board_id_keyboard_col_inverted((int)board_id); @@ -149,3 +152,11 @@ __override void board_pre_task_i2c_peripheral_init(void) /* Configure board specific keyboard */ configure_keyboard(); } + +__override uint8_t board_keyboard_row_refresh(void) +{ + if (board_id < 2) + return KEYBOARD_ROW_ID1_REFRESH; + else + return KEYBOARD_ROW_ID2_REFRESH; +} diff --git a/board/banshee/board.h b/board/banshee/board.h index 2627ce7556..efb010ac28 100644 --- a/board/banshee/board.h +++ b/board/banshee/board.h @@ -35,6 +35,7 @@ #define CONFIG_MP2964 /* KEYBOARD */ +#define CONFIG_KEYBOARD_MULTIPLE #define CONFIG_KEYBOARD_CUSTOMIZATION #define CONFIG_KEYBOARD_VIVALDI diff --git a/board/banshee/keyboard_customization.c b/board/banshee/keyboard_customization.c index 89ffd9cfaa..50c1f9e54b 100644 --- a/board/banshee/keyboard_customization.c +++ b/board/banshee/keyboard_customization.c @@ -10,6 +10,7 @@ #include "keyboard_config.h" #include "keyboard_protocol.h" #include "keyboard_raw.h" +#include "keyboard_scan.h" enum gpio_signal signal; static int colinv; @@ -46,6 +47,25 @@ void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val) scancode_set2[col][row] = val; } +struct keyboard_type key_typ = { + .col_esc = KEYBOARD_COL_ESC, + .row_esc = KEYBOARD_ROW_ESC, + .col_down = KEYBOARD_COL_DOWN, + .row_down = KEYBOARD_ROW_DOWN, + .col_left_shift = KEYBOARD_COL_LEFT_SHIFT, + .row_left_shift = KEYBOARD_ROW_LEFT_SHIFT, + .col_refresh = KEYBOARD_COL_ID1_REFRESH, + .row_refresh = KEYBOARD_ROW_ID1_REFRESH, + .col_right_alt = KEYBOARD_COL_RIGHT_ALT, + .row_right_alt = KEYBOARD_ROW_RIGHT_ALT, + .col_left_alt = KEYBOARD_COL_LEFT_ALT, + .row_left_alt = KEYBOARD_ROW_LEFT_ALT, + .col_key_r = KEYBOARD_COL_KEY_R, + .row_key_r = KEYBOARD_ROW_KEY_R, + .col_key_h = KEYBOARD_COL_KEY_H, + .row_key_h = KEYBOARD_ROW_KEY_H, +}; + void board_id_keyboard_col_inverted(int board_id) { if (board_id == 0) { diff --git a/board/banshee/keyboard_customization.h b/board/banshee/keyboard_customization.h index 59ac28745c..7ccb358cc6 100644 --- a/board/banshee/keyboard_customization.h +++ b/board/banshee/keyboard_customization.h @@ -40,9 +40,11 @@ extern uint8_t keyboard_cols; #define KEYBOARD_COL_LEFT_ALT 3 #define KEYBOARD_ROW_LEFT_ALT 1 #define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT) -#define KEYBOARD_COL_REFRESH 4 -#define KEYBOARD_ROW_REFRESH 6 -#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH) +#define KEYBOARD_COL_ID1_REFRESH 4 +#define KEYBOARD_ROW_ID1_REFRESH 6 +#define KEYBOARD_COL_ID2_REFRESH 5 +#define KEYBOARD_ROW_ID2_REFRESH 2 +#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ID1_REFRESH) #define KEYBOARD_COL_RIGHT_ALT 3 #define KEYBOARD_ROW_RIGHT_ALT 0 #define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT) -- cgit v1.2.1