summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-04-27 10:53:36 +0200
committerCommit Bot <commit-bot@chromium.org>2021-04-29 08:19:21 +0000
commit2adbe4b949041fa54d35fc0f23866948d4c8d27d (patch)
treede97e82a9ff3380cfbdeb93d095f6359abce2b65 /include/motion_sense.h
parent49154e4cb9cfcb9aad9b927766f746a1a1e11a4d (diff)
downloadchrome-ec-2adbe4b949041fa54d35fc0f23866948d4c8d27d.tar.gz
zephyr: Add CBI SSFC support
Some boards support different motion sensors based on the CBI SSFC field stored in EEPROM. The decision about which sensor is made in runtime thus all drivers have to be built-in. Define structure of the SSFC in the device tree("named-cbi-ssfc"), that allows using generic driver instead of board-specific code as it is done in CrosEC. Every SSFC field value("named-cbi-ssfc-value") is associated with an alternative sensor(or sensors) which will be used (instead of the one pointed by 'alternative-for' property) if the value in EEPROM matches. BUG=b:183990188 BRANCH=none TEST=Add alternative motion sensors to the device tree, modify CBI SSFC with 'cbi set 8 value 4', reboot EC and verify that the new sensors are used with the 'accelinfo' command. Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I3b5f3c171005885d96b1fdf14e844aaf862b6818 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2851896 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 29ac220395..d2f6c51e03 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -262,6 +262,11 @@ extern mutex_t g_sensor_mutex;
/* Defined at board level. */
extern struct motion_sensor_t motion_sensors[];
+#ifdef CONFIG_ZEPHYR
+/* Defined for alternative drivers (depends on CBI SSFC) */
+extern struct motion_sensor_t motion_sensors_alt[];
+#endif /* CONFIG_ZEPHYR */
+
#ifdef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
extern unsigned motion_sensor_count;
#else