summaryrefslogtreecommitdiff
path: root/board/gimble
diff options
context:
space:
mode:
authorWill Tsai <will_tsai@wistron.corp-partner.google.com>2021-10-20 18:46:55 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-26 06:47:35 +0000
commit25eb59a5f383722682052657a25ccdeb474efee2 (patch)
tree0bf8cc39a0733055a6d0284d805ee3d14c3e13f6 /board/gimble
parenta89ace5637548f0fb10ebf8cc414620287e3c015 (diff)
downloadchrome-ec-25eb59a5f383722682052657a25ccdeb474efee2.tar.gz
gimble: add FW_CONFIG support for different keyboard layout
Also refer to https://chrome-internal.googlesource.com/chromeos/project /brya/gimble/+/refs/heads/main/config.star#19 for the bit assignments. BUG=b:193395012 BRANCH=none TEST=make -j BOARD=gimble Signed-off-by: Will Tsai <will_tsai@wistron.corp-partner.google.com> Change-Id: I6558028190d94559b89533fb02bcc475a4ed6475 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3233470 Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: YH Lin <yueherngl@chromium.org> Commit-Queue: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'board/gimble')
-rw-r--r--board/gimble/board.c8
-rw-r--r--board/gimble/fw_config.c5
-rw-r--r--board/gimble/fw_config.h19
3 files changed, 30 insertions, 2 deletions
diff --git a/board/gimble/board.c b/board/gimble/board.c
index 6483d8ca6d..26b61d4b03 100644
--- a/board/gimble/board.c
+++ b/board/gimble/board.c
@@ -21,6 +21,7 @@
#include "driver/accelgyro_lsm6dsm.h"
#include "fw_config.h"
#include "hooks.h"
+#include "keyboard_8042_sharedlib.h"
#include "lid_switch.h"
#include "power_button.h"
#include "power.h"
@@ -49,6 +50,13 @@ BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
__override void board_cbi_init(void)
{
config_usb_db_type();
+
+ /*
+ * 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));
}
/* Called on AP S3 -> S0 transition */
diff --git a/board/gimble/fw_config.c b/board/gimble/fw_config.c
index fb8acb635d..1589811ad0 100644
--- a/board/gimble/fw_config.c
+++ b/board/gimble/fw_config.c
@@ -54,6 +54,11 @@ union brya_cbi_fw_config get_fw_config(void)
return fw_config;
}
+enum ec_cfg_keyboard_layout ec_cfg_keyboard_layout(void)
+{
+ return fw_config.kb_layout;
+}
+
enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void)
{
return fw_config.usb_db;
diff --git a/board/gimble/fw_config.h b/board/gimble/fw_config.h
index 6e4eb3ef58..32631f7b77 100644
--- a/board/gimble/fw_config.h
+++ b/board/gimble/fw_config.h
@@ -25,14 +25,22 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
+enum ec_cfg_keyboard_layout {
+ KB_LAYOUT_DEFAULT = 0,
+ KB_LAYOUT_1 = 1
+};
+
union brya_cbi_fw_config {
struct {
enum ec_cfg_usb_db_type usb_db : 4;
uint32_t sd_db : 2;
- uint32_t lte_db : 1;
+ uint32_t reserved_0 : 1;
enum ec_cfg_keyboard_backlight_type kb_bl : 1;
uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ uint32_t cellular_db : 2;
+ uint32_t wifi_sar_id : 1;
+ enum ec_cfg_keyboard_layout kb_layout : 2;
+ uint32_t reserved_1 : 16;
};
uint32_t raw_value;
};
@@ -45,6 +53,13 @@ union brya_cbi_fw_config {
union brya_cbi_fw_config get_fw_config(void);
/**
+ * Get keyboard type from FW_CONFIG.
+ *
+ * @return the keyboard type.
+ */
+enum ec_cfg_keyboard_layout ec_cfg_keyboard_layout(void);
+
+/**
* Get the USB daughter board type from FW_CONFIG.
*
* @return the USB daughter board type.