summaryrefslogtreecommitdiff
path: root/baseboard/volteer/cbi_ec_fw_config.h
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-05-01 15:04:12 -0600
committerCommit Bot <commit-bot@chromium.org>2020-07-02 02:40:18 +0000
commit07833a0fc114e28c200fcee5691c082534344bfe (patch)
tree4eff0da4cc6309f1e1d54c1a5ed659de0b3b740f /baseboard/volteer/cbi_ec_fw_config.h
parent0d0158ea48e25ac4042d7142db1985e5a6a3472f (diff)
downloadchrome-ec-07833a0fc114e28c200fcee5691c082534344bfe.tar.gz
volteer: create common FW_CONFIG layout
Create a common FW_CONFIG layout and access functions for Volteer boards. BUG=b:155497872 BRANCH=none TEST=make buildall TEST=verify FW_CONFIG data on Volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I1ec14db6c816d82115caa5e6179e0258f2904ec4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247616 Reviewed-by: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'baseboard/volteer/cbi_ec_fw_config.h')
-rw-r--r--baseboard/volteer/cbi_ec_fw_config.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/baseboard/volteer/cbi_ec_fw_config.h b/baseboard/volteer/cbi_ec_fw_config.h
new file mode 100644
index 0000000000..c3632e4cda
--- /dev/null
+++ b/baseboard/volteer/cbi_ec_fw_config.h
@@ -0,0 +1,83 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __VOLTEER_CBI_EC_FW_CONFIG_H_
+#define __VOLTEER_CBI_EC_FW_CONFIG_H_
+
+#include "stdbool.h"
+
+/****************************************************************************
+ * CBI FW_CONFIG layout shared by all Volteer boards
+ *
+ * Source of truth is the program/volteer/program.star configuration file.
+ */
+
+enum ec_cfg_usb_db_type {
+ DB_USB_ABSENT = 0,
+ DB_USB4_GEN2 = 1,
+ DB_USB3_ACTIVE = 2,
+ DB_USB4_GEN3 = 3,
+ DB_USB3_PASSIVE = 4,
+ DB_USB3_NO_A = 5,
+ DB_USB_COUNT
+};
+
+/*
+ * Tablet Mode (1 bit), shared by all Volteer boards
+ */
+enum ec_cfg_tabletmode_type {
+ TABLETMODE_DISABLED = 0,
+ TABLETMODE_ENABLED = 1,
+};
+
+union volteer_cbi_fw_config {
+ struct {
+ enum ec_cfg_usb_db_type usb_db : 4;
+ uint32_t thermal : 4;
+ uint32_t audio : 3;
+ enum ec_cfg_tabletmode_type tabletmode : 1;
+ uint32_t lte_db : 2;
+ uint32_t reserved_1 : 2;
+ uint32_t sd_db : 4;
+ uint32_t reserved_2 : 12;
+ };
+ uint32_t raw_value;
+};
+
+/*
+ * Each Volteer board must define the default FW_CONFIG options to use
+ * if the CBI data has not been initialized.
+ */
+extern union volteer_cbi_fw_config fw_config_defaults;
+
+/**
+ * Initialize the FW_CONFIG from CBI data. If the CBI data is not valid, set the
+ * FW_CONFIG to the board specific defaults.
+ */
+void init_fw_config(void);
+
+/**
+ * Read the cached FW_CONFIG. Guaranteed to have valid values.
+ *
+ * @return the FW_CONFIG for the board.
+ */
+union volteer_cbi_fw_config get_fw_config(void);
+
+/**
+ * Get the USB daughter board type from FW_CONFIG.
+ *
+ * @return the USB daughter board type.
+ */
+enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void);
+
+/**
+ * Check if the FW_CONFIG has enabled tablet mode operation.
+ *
+ * @return true if board supports tablet mode, false if the board supports
+ * clamshell operation only.
+ */
+bool ec_cfg_has_tabletmode(void);
+
+#endif /* __VOLTEER_CBI_EC_FW_CONFIG_H_ */