summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreno.wang <reno.wang@lcfc.corp-partner.google.com>2021-09-29 21:48:44 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-08 23:54:03 +0000
commit8816dd083c434fa9386ba455082c24d10ae2f7b0 (patch)
treec91cfc2647b5da8a7cb5a240b7028526e9aceb87
parentd1ec1326b8f2706ec9446e1be922032dde5906ac (diff)
downloadchrome-ec-8816dd083c434fa9386ba455082c24d10ae2f7b0.tar.gz
taeko/taeland: update fw config structure
1. Update fw config structure 2. Define the default fw config setting for early board BUG=b:194515356 BRANCH=None TEST=make -j BOARD=taeko Signed-off-by: reno.wang <reno.wang@lcfc.corp-partner.google.com> Change-Id: Idff6bae79ec5206e47710352ac1d2da56c933884 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3192741 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: caveh jalali <caveh@chromium.org>
-rw-r--r--board/taeko/fw_config.c21
-rw-r--r--board/taeko/fw_config.h30
2 files changed, 37 insertions, 14 deletions
diff --git a/board/taeko/fw_config.c b/board/taeko/fw_config.c
index 4e450b7dfa..b7d1847914 100644
--- a/board/taeko/fw_config.c
+++ b/board/taeko/fw_config.c
@@ -35,17 +35,15 @@ void board_init_fw_config(void)
if (get_board_id() == 0) {
/*
- * Early boards have a zero'd out FW_CONFIG, so replace
- * it with a sensible default value. If DB_USB_ABSENT2
- * was used as an alternate encoding of DB_USB_ABSENT to
- * avoid the zero check, then fix it.
+ * Early boards doesn't have correct FW_CONFIG, so replace
+ * it with a sensible default value.
*/
- if (fw_config.raw_value == 0) {
- CPRINTS("CBI: FW_CONFIG is zero, using board defaults");
+ CPRINTS("CBI: Using board defaults for early board");
+ if (ec_cfg_has_tabletmode()) {
+ fw_config = fw_config_defaults;
+ fw_config.tabletmode = TABLETMODE_ENABLED;
+ } else
fw_config = fw_config_defaults;
- } else if (fw_config.usb_db == DB_USB_ABSENT2) {
- fw_config.usb_db = DB_USB_ABSENT;
- }
}
}
@@ -63,3 +61,8 @@ bool ec_cfg_has_keyboard_backlight(void)
{
return (fw_config.kb_bl == KEYBOARD_BACKLIGHT_ENABLED);
}
+
+bool ec_cfg_has_tabletmode(void)
+{
+ return (fw_config.tabletmode == TABLETMODE_ENABLED);
+}
diff --git a/board/taeko/fw_config.h b/board/taeko/fw_config.h
index db4c6d60c0..3632dd82a9 100644
--- a/board/taeko/fw_config.h
+++ b/board/taeko/fw_config.h
@@ -16,8 +16,7 @@
enum ec_cfg_usb_db_type {
DB_USB_ABSENT = 0,
- DB_USB3_PS8815 = 1,
- DB_USB_ABSENT2 = 15
+ DB_USB3_PS8815 = 1
};
enum ec_cfg_keyboard_backlight_type {
@@ -25,14 +24,27 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
+enum ec_cfg_tabletmode_type {
+ TABLETMODE_DISABLED = 0,
+ TABLETMODE_ENABLED = 1
+};
+
union taeko_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
+ enum ec_cfg_usb_db_type usb_db : 2;
uint32_t sd_db : 2;
- uint32_t lte_db : 1;
enum ec_cfg_keyboard_backlight_type kb_bl : 1;
uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ /* b/194515356 - Fw config structure
+ * bit8-9: kb_layout
+ * bit10-11: wifi_sar_id,
+ * bit12: nvme
+ * bit13: emmc
+ * bit14: fan
+ */
+ uint32_t reserved_1 : 7;
+ enum ec_cfg_tabletmode_type tabletmode : 1;
+ uint32_t reserved_2 : 16;
};
uint32_t raw_value;
};
@@ -59,4 +71,12 @@ enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void);
*/
bool ec_cfg_has_keyboard_backlight(void);
+/**
+ * Check if the FW_CONFIG has enabled tablet mode.
+ *
+ * @return true if board supports tablet mode, false if the board
+ * doesn't support it.
+ */
+bool ec_cfg_has_tabletmode(void);
+
#endif /* __BOARD_TAEKO_FW_CONFIG_H_ */