diff options
author | Rajat Jain <rajatja@google.com> | 2020-04-03 00:58:13 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-21 21:32:50 +0000 |
commit | d4105005da492f8e20619cad88fdb15d6dee098f (patch) | |
tree | 44a9dc663c5d0e403ce254ff7d733631e3581b40 /board | |
parent | d2b73ad856c4ba697a2dfd8c4bf4263ffc18a5ce (diff) | |
download | chrome-ec-d4105005da492f8e20619cad88fdb15d6dee098f.tar.gz |
common: Make scancode table always mutable
Since the vivaldi requires the scancode to be mutable, and vivaldi
shall be enabled by default for all boards, thus make the scancode
table to be always mutable and get rid of the config option it hides
behind.
BUG=b:146501925
TEST=Build
BRANCH=firmware-hatch-12672.B
Signed-off-by: Rajat Jain <rajatja@google.com>
Change-Id: Iaedcd6d84caf31c91a61854f96414bcea38f5c2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2133825
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/eve/board.c | 6 | ||||
-rw-r--r-- | board/eve/board.h | 1 | ||||
-rw-r--r-- | board/nami/board.c | 7 | ||||
-rw-r--r-- | board/nami/board.h | 1 | ||||
-rw-r--r-- | board/palkia/keyboard_customization.c | 30 |
5 files changed, 36 insertions, 9 deletions
diff --git a/board/eve/board.c b/board/eve/board.c index 8d1b21ccd6..ef5699e2df 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -494,13 +494,13 @@ static void board_init(void) /* Update AC status to the PCH */ board_update_ac_status(); -#if defined(CONFIG_KEYBOARD_SCANCODE_MUTABLE) && !defined(TEST_BUILD) +#ifndef TEST_BUILD if (board_get_version() == 4) { /* Set F13 to new defined key on EVT */ CPRINTS("Overriding F13 scan code"); - scancode_set2[9][3] = 0xe007; + set_scancode_set2(3, 9, 0xe007); #ifdef CONFIG_KEYBOARD_DEBUG - keycap_label[9][3] = KLLI_F13; + set_keycap_label(3, 9, KLLI_F13); #endif } #endif diff --git a/board/eve/board.h b/board/eve/board.h index 1df410d6ef..8a46d74156 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -73,7 +73,6 @@ #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_KEYBOARD_REFRESH_ROW3 -#define CONFIG_KEYBOARD_SCANCODE_MUTABLE #define CONFIG_TABLET_MODE /* Battery */ diff --git a/board/nami/board.c b/board/nami/board.c index 358b0bbf22..a5d38bd0d8 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -1034,13 +1034,16 @@ static void board_init(void) /* No need to swap scancode_set2[0][3] and [1][0] because both * are mapped to search key. */ } - if (sku & SKU_ID_MASK_UK2) + if (sku & SKU_ID_MASK_UK2) { /* * Observed on Shyvana with UK keyboard, * \|: 0x0061->0x61->0x56 * r-ctrl: 0xe014->0x14->0x1d */ - swap(scancode_set2[0][4], scancode_set2[7][2]); + uint16_t tmp = get_scancode_set2(4, 0); + set_scancode_set2(4, 0, get_scancode_set2(2, 7)); + set_scancode_set2(2, 7, tmp); + } #endif isl923x_set_ac_prochot(CHARGER_SOLO, 3328 /* mA */); diff --git a/board/nami/board.h b/board/nami/board.h index 8159f13c7a..95f5a38ddc 100644 --- a/board/nami/board.h +++ b/board/nami/board.h @@ -32,7 +32,6 @@ #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_KEYBOARD_KEYPAD -#define CONFIG_KEYBOARD_SCANCODE_MUTABLE #define CONFIG_LED_COMMON #define CONFIG_LID_SWITCH #define CONFIG_LOW_POWER_IDLE diff --git a/board/palkia/keyboard_customization.c b/board/palkia/keyboard_customization.c index e83b5ecb99..03c29a5720 100644 --- a/board/palkia/keyboard_customization.c +++ b/board/palkia/keyboard_customization.c @@ -10,7 +10,7 @@ #include "keyboard_protocol.h" #include "keyboard_raw.h" -uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { +static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { {0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, {0x0015, 0x0000, 0x0000, 0x000d, 0x000e, 0x0016, 0x0000, 0x001c}, @@ -29,6 +29,19 @@ uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { {0x0000, 0x000a, 0xe074, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, }; +uint16_t get_scancode_set2(uint8_t row, uint8_t col) +{ + if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) + return scancode_set2[col][row]; + return 0; +} + +void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val) +{ + if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) + scancode_set2[col][row] = val; +} + void board_keyboard_drive_col(int col) { /* Drive all lines to high */ @@ -49,7 +62,7 @@ void board_keyboard_drive_col(int col) } #ifdef CONFIG_KEYBOARD_DEBUG -char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { +static char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { {'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, @@ -83,4 +96,17 @@ char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { {KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, }; + +char get_keycap_label(uint8_t row, uint8_t col) +{ + if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) + return keycap_label[col][row]; + return KLLI_UNKNO; +} + +void set_keycap_label(uint8_t row, uint8_t col, char val) +{ + if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) + keycap_label[col][row] = val; +} #endif |