diff options
author | Zhuohao Lee <zhuohao@chromium.org> | 2020-02-04 13:32:43 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-13 05:15:12 +0000 |
commit | af32d7eb68444fa5fe7b863e65063d75a3aa5007 (patch) | |
tree | f61fa2efcf6f38fc6cc914c3098a4fcb66cc8dab /board/palkia/keyboard_customization.c | |
parent | afb7e5bf31dd1a1d94f552554103952b0cc74cc6 (diff) | |
download | chrome-ec-af32d7eb68444fa5fe7b863e65063d75a3aa5007.tar.gz |
palkia: add keyboard customization
As the Palkia isn't using chromeos keyboard, we need to
remapping the keyboard matrix for the key event. The
new config option CONFIG_KEYBOARD_CUSTOMIZATION is added
to customize the keyboard matrix in the board layer.
Most of the keys have been remapped except F11-F16, Fn and
win key, we can remap it later.
BUG=b:148034320
BRANCH=firmware-hatch-12672.B
TEST=esc+refresh+power
alt+vol up+r
evtest for all of the keys
Change-Id: Ibb02e3a7f5e022eeca36865e8561393fc326f2af
Signed-off-by: Zhuohao Lee <zhuohao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2035445
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/palkia/keyboard_customization.c')
-rw-r--r-- | board/palkia/keyboard_customization.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/board/palkia/keyboard_customization.c b/board/palkia/keyboard_customization.c new file mode 100644 index 0000000000..e83b5ecb99 --- /dev/null +++ b/board/palkia/keyboard_customization.c @@ -0,0 +1,86 @@ +/* Copyright 2020 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" +#include "keyboard_customization.h" +#include "keyboard_8042_sharedlib.h" +#include "keyboard_config.h" +#include "keyboard_protocol.h" +#include "keyboard_raw.h" + +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}, + {0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0029, 0x0024, 0x000c, 0xe01f, 0x0026, 0x0004, 0x0000}, + {0x0022, 0x001a, 0x0006, 0x0005, 0x001b, 0x001e, 0x001d, 0x0076}, + {0x002a, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b}, + {0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b}, + {0x0049, 0xe072, 0x005d, 0x0044, 0x0009, 0x0046, 0x0000, 0x004b}, + {0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0041, 0x0000, 0x0083, 0x000b, 0x0003, 0x003e, 0x0043, 0x0042}, + {0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0xe06b, 0x0000}, + {0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x004a, 0xe075, 0x004e, 0x0000, 0x0045, 0x004d, 0x0054, 0x004c}, + {0x0052, 0x005a, 0x0000, 0x0000, 0x0055, 0x0066, 0x005b, 0x0023}, + {0x0000, 0x000a, 0xe074, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, +}; + +void board_keyboard_drive_col(int col) +{ + /* Drive all lines to high */ + if (col == KEYBOARD_COLUMN_NONE) + gpio_set_level(GPIO_KBD_KSO4, 0); + + /* Set KBSOUT to zero to detect key-press */ + else if (col == KEYBOARD_COLUMN_ALL) + gpio_set_level(GPIO_KBD_KSO4, 1); + + /* Drive one line for detection */ + else { + if (col == 4) + gpio_set_level(GPIO_KBD_KSO4, 1); + else + gpio_set_level(GPIO_KBD_KSO4, 0); + } +} + +#ifdef CONFIG_KEYBOARD_DEBUG +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, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, + {'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', + '1', KLLI_UNKNO, 'a'}, + {KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, + {KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, + KLLI_SEARC, '3', KLLI_F3, KLLI_UNKNO}, + {'x', 'z', KLLI_F2, KLLI_F1, + 's', '2', 'w', KLLI_ESC}, + {'v', 'b', 'g', 't', + '5', '4', 'r', 'f'}, + {'m', 'n', 'h', 'y', + '6', '7', 'u', 'j'}, + {'.', KLLI_DOWN, '\\', 'o', + KLLI_F10, '9', KLLI_UNKNO, 'l'}, + {KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, + {',', KLLI_UNKNO, KLLI_F7, KLLI_F6, + KLLI_F5, '8', 'i', 'k'}, + {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, + KLLI_UNKNO, KLLI_UNKNO, KLLI_LEFT, KLLI_UNKNO}, + {KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, + {'/', KLLI_UP, '-', KLLI_UNKNO, + '0', 'p', '[', ';'}, + {'\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, + '=', KLLI_B_SPC, ']', 'd'}, + {KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, +}; +#endif |