diff options
author | Isaac Lee <isaaclee@google.com> | 2021-03-12 23:54:04 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-19 09:32:11 +0000 |
commit | 3bdb82e0c9ec04c16af6932926aba1b9bbffaec0 (patch) | |
tree | 8b1b419295266913705e754d2d460fca84e1e66d | |
parent | 2e951ab34c85d1153a17bea970890da45e512a1b (diff) | |
download | chrome-ec-3bdb82e0c9ec04c16af6932926aba1b9bbffaec0.tar.gz |
dirinboz: add FW_CONFIG support for different keyboard layout
BUG=b:182232569
BRANCH=firmware-zork-13434.B-main
TEST=build all
Change-Id: I567739a9499249d5bdb067e23ee80a957ba7c2e4
Signed-off-by: Isaac Lee <isaaclee@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2755360
(cherry picked from commit fd9ea2bfe6a9b0dbf40ad3aa36409063db15ce06)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2759766
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
-rw-r--r-- | baseboard/zork/cbi_ec_fw_config.c | 9 | ||||
-rw-r--r-- | baseboard/zork/cbi_ec_fw_config.h | 16 | ||||
-rw-r--r-- | board/dirinboz/board.c | 8 |
3 files changed, 33 insertions, 0 deletions
diff --git a/baseboard/zork/cbi_ec_fw_config.c b/baseboard/zork/cbi_ec_fw_config.c index 0eebc188f4..cbb0821c42 100644 --- a/baseboard/zork/cbi_ec_fw_config.c +++ b/baseboard/zork/cbi_ec_fw_config.c @@ -87,3 +87,12 @@ enum ec_cfg_lte_present_type ec_config_lte_present(void) return ((get_cbi_fw_config() & EC_CFG_LTE_PRESENT_MASK) >> EC_CFG_LTE_PRESENT_L); } + +/* + * ec_config_keyboard_layout() will return keyboard layout type. + */ +enum ec_cfg_keyboard_layout_type ec_config_keyboard_layout(void) +{ + return ((get_cbi_fw_config() & EC_CFG_KEYBOARD_LAYOUT_MASK) + >> EC_CFG_KEYBOARD_LAYOUT_L); +} diff --git a/baseboard/zork/cbi_ec_fw_config.h b/baseboard/zork/cbi_ec_fw_config.h index 38c4c2bda2..4888298e3a 100644 --- a/baseboard/zork/cbi_ec_fw_config.h +++ b/baseboard/zork/cbi_ec_fw_config.h @@ -113,6 +113,21 @@ enum ec_cfg_lte_present_type { GENMASK(EC_CFG_LTE_PRESENT_H,\ EC_CFG_LTE_PRESENT_L) +/* + * Keyboard Layout (2 bit) + * + * ec_config_keyboard_layout() will return keyboard layout type. + */ +enum ec_cfg_keyboard_layout_type { + KB_LAYOUT_DEFAULT = 0, + KB_LAYOUT_1 = 1, +}; +#define EC_CFG_KEYBOARD_LAYOUT_L 30 +#define EC_CFG_KEYBOARD_LAYOUT_H 31 +#define EC_CFG_KEYBOARD_LAYOUT_MASK \ + GENMASK(EC_CFG_KEYBOARD_LAYOUT_H,\ + EC_CFG_KEYBOARD_LAYOUT_L) + uint32_t get_cbi_fw_config(void); enum ec_cfg_usb_db_type ec_config_get_usb_db(void); @@ -124,5 +139,6 @@ enum ec_cfg_pwm_keyboard_backlight_type ec_config_has_pwm_keyboard_backlight( enum ec_cfg_lid_angle_tablet_mode_type ec_config_has_lid_angle_tablet_mode( void); enum ec_cfg_lte_present_type ec_config_lte_present(void); +enum ec_cfg_keyboard_layout_type ec_config_keyboard_layout(void); #endif /* _ZORK_CBI_EC_FW_CONFIG__H_ */ diff --git a/board/dirinboz/board.c b/board/dirinboz/board.c index 8a6dec5ac9..07ff55f00c 100644 --- a/board/dirinboz/board.c +++ b/board/dirinboz/board.c @@ -20,6 +20,7 @@ #include "fan_chip.h" #include "gpio.h" #include "hooks.h" +#include "keyboard_8042_sharedlib.h" #include "ioexpander.h" #include "lid_switch.h" #include "power.h" @@ -493,6 +494,13 @@ static void setup_fw_config(void) /* Gyro is not present, don't allow line to float */ gpio_set_flags(GPIO_6AXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN); } + + /* + * If keyboard is US2(KB_LAYOUT_1), we need translate right ctrl + * to backslash(\|) key. + */ + if (ec_config_keyboard_layout() == KB_LAYOUT_1) + set_scancode_set2(4, 0, get_scancode_set2(2, 7)); } DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2); |