summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Chao <scott_chao@wistron.corp-partner.google.com>2020-11-03 09:04:43 +0800
committerCommit Bot <commit-bot@chromium.org>2020-11-12 04:12:47 +0000
commit7f0c15e6d2accd3aec28c93ff7add11268e3e6c7 (patch)
tree3a4b8beaee33cfa6e57e0e9caa144c68df7bda49
parenta9691611c515d7ef57aa69d738909d607461b7b1 (diff)
downloadchrome-ec-7f0c15e6d2accd3aec28c93ff7add11268e3e6c7.tar.gz
eldrid: add FW_CONFIG support for different keyboard layout
BUG=b:172133632 BRANCH=firmware-volteer-13521.B-master TEST=make buildall TEST= ectool cbi get = 0x14902 ectool cbi set 0x114902 4 Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: I0decd978bf6c21dddd315857bb1a29ac20dbf276 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2528732 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--baseboard/volteer/cbi_ec_fw_config.c4
-rw-r--r--baseboard/volteer/cbi_ec_fw_config.h15
-rw-r--r--board/eldrid/board.c8
3 files changed, 26 insertions, 1 deletions
diff --git a/baseboard/volteer/cbi_ec_fw_config.c b/baseboard/volteer/cbi_ec_fw_config.c
index 12b96ff5b4..e602691aeb 100644
--- a/baseboard/volteer/cbi_ec_fw_config.c
+++ b/baseboard/volteer/cbi_ec_fw_config.c
@@ -49,3 +49,7 @@ bool ec_cfg_has_numeric_pad(void)
return (fw_config.num_pad == NUMERIC_PAD_ENABLED);
}
+enum ec_cfg_keyboard_layout ec_cfg_keyboard_layout(void)
+{
+ return fw_config.kb_layout;
+}
diff --git a/baseboard/volteer/cbi_ec_fw_config.h b/baseboard/volteer/cbi_ec_fw_config.h
index 5b97f778ec..0a44e1f9e4 100644
--- a/baseboard/volteer/cbi_ec_fw_config.h
+++ b/baseboard/volteer/cbi_ec_fw_config.h
@@ -43,6 +43,11 @@ enum ec_cfg_numeric_pad_type {
NUMERIC_PAD_ENABLED = 1
};
+enum ec_cfg_keyboard_layout {
+ KB_LAYOUT_DEFAULT = 0,
+ KB_LAYOUT_1 = 1
+};
+
union volteer_cbi_fw_config {
struct {
enum ec_cfg_usb_db_type usb_db : 4;
@@ -53,7 +58,8 @@ union volteer_cbi_fw_config {
enum ec_cfg_keyboard_backlight_type kb_bl : 1;
enum ec_cfg_numeric_pad_type num_pad : 1;
uint32_t sd_db : 4;
- uint32_t reserved_2 : 12;
+ enum ec_cfg_keyboard_layout kb_layout : 2;
+ uint32_t reserved_2 : 10;
};
uint32_t raw_value;
};
@@ -108,4 +114,11 @@ bool ec_cfg_has_keyboard_backlight(void);
*/
bool ec_cfg_has_numeric_pad(void);
+/**
+ * Get keyboard type from FW_CONFIG.
+ *
+ * @return the keyboard type.
+ */
+enum ec_cfg_keyboard_layout ec_cfg_keyboard_layout(void);
+
#endif /* __VOLTEER_CBI_EC_FW_CONFIG_H_ */
diff --git a/board/eldrid/board.c b/board/eldrid/board.c
index 12286dc7b9..1ce028d96e 100644
--- a/board/eldrid/board.c
+++ b/board/eldrid/board.c
@@ -24,6 +24,7 @@
#include "fan_chip.h"
#include "gpio.h"
#include "hooks.h"
+#include "keyboard_8042_sharedlib.h"
#include "keyboard_raw.h"
#include "lid_switch.h"
#include "keyboard_scan.h"
@@ -414,6 +415,13 @@ __override void board_cbi_init(void)
if ((!IS_ENABLED(TEST_BUILD) && !ec_cfg_has_numeric_pad()) ||
get_board_id() < 1)
keyboard_raw_set_cols(KEYBOARD_COLS_NO_KEYPAD);
+
+ /*
+ * If keyboard is US2(KB_LAYOUT_1), we need translate right ctrl
+ * to backslash(\|) key.
+ */
+ if (ec_cfg_keyboard_layout() == KB_LAYOUT_1)
+ set_scancode_set2(4, 0, get_scancode_set2(2, 7));
}
/******************************************************************************/