summaryrefslogtreecommitdiff
path: root/baseboard/volteer
diff options
context:
space:
mode:
authorxiong.huang <xiong.huang@bitland.corp-partner.google.com>2020-04-20 20:46:18 +0800
committerCommit Bot <commit-bot@chromium.org>2020-05-06 08:31:42 +0000
commit78f281827f03f83ec70a3b7b335d8b71f94b6525 (patch)
tree64514568ac68617955003bb180f715c7819ffd10 /baseboard/volteer
parent32b54e8ad9d09f994c301d6d6ec822692bb1919a (diff)
downloadchrome-ec-78f281827f03f83ec70a3b7b335d8b71f94b6525.tar.gz
malefor: enable lid angle
Enable lid angle function to make peripherals get correct state on convertible SKUs. BUG=b:152434719 BRANCH=none TEST=boot malefor, test keyboard function when hinge is at 135, 180, 270, 360 degree when set bit #4 of CBI fw_config. No sensor data when clear bit #4 of CBI fw_config. Signed-off-by: xiong.huang <xiong.huang@bitland.corp-partner.google.com> Change-Id: I83797a4d4a16b2c2903ac7c6d9cc5597a9855ac0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2156685 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'baseboard/volteer')
-rw-r--r--baseboard/volteer/baseboard.c17
-rw-r--r--baseboard/volteer/baseboard.h17
2 files changed, 33 insertions, 1 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index ee8cf8fc72..0964f53122 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -581,12 +581,27 @@ static void config_db_usb3(void)
}
static uint8_t board_id;
+static uint32_t fw_config;
uint8_t get_board_id(void)
{
return board_id;
}
+uint32_t get_fw_config(void)
+{
+ return fw_config;
+}
+
+/*
+ * ec_config_has_tablet_mode() will return 1 is present or 0
+ */
+enum ec_cfg_tablet_mode_type ec_config_has_tablet_mode(void)
+{
+ return ((get_fw_config() & EC_CFG_TABLET_MODE_MASK)
+ >> EC_CFG_TABLET_MODE_L);
+}
+
__overridable void config_volteer_gpios(void)
{
}
@@ -614,11 +629,11 @@ static void cbi_init(void)
config_volteer_gpios();
/* FW config */
-
if (cbi_get_fw_config(&cbi_val) != EC_SUCCESS) {
CPRINTS("CBI: Read FW config failed, assuming USB4");
usb_db_val = USB_DB_USB4;
} else {
+ fw_config = cbi_val;
usb_db_val = CBI_FW_CONFIG_USB_DB_TYPE(cbi_val);
}
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h
index 7ce7acd673..f68fc431f6 100644
--- a/baseboard/volteer/baseboard.h
+++ b/baseboard/volteer/baseboard.h
@@ -279,6 +279,21 @@ enum usb_db_id {
#define CBI_FW_CONFIG_USB_DB_TYPE(bits) \
(((bits) & CBI_FW_CONFIG_USB_DB_MASK) >> CBI_FW_CONFIG_USB_DB_SHIFT)
+/*
+ * Tablet Mode (1 bit)
+ *
+ * ec_config_has_tablet_mode() will return 1 is present or 0
+ */
+enum ec_cfg_tablet_mode_type {
+ TABLET_MODE_NO = 0,
+ TABLET_MODE_YES = 1,
+};
+#define EC_CFG_TABLET_MODE_L 11
+#define EC_CFG_TABLET_MODE_H 11
+#define EC_CFG_TABLET_MODE_MASK \
+ GENMASK(EC_CFG_TABLET_MODE_H,\
+ EC_CFG_TABLET_MODE_L)
+
extern enum gpio_signal ps8xxx_rst_odl;
void board_reset_pd_mcu(void);
@@ -297,6 +312,8 @@ unsigned char get_board_id(void);
*/
__override_proto void config_volteer_gpios(void);
+enum ec_cfg_tablet_mode_type ec_config_has_tablet_mode(void);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BASEBOARD_H */