summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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_ */