summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-08-30 20:34:38 +0200
committerCommit Bot <commit-bot@chromium.org>2021-09-30 00:27:36 +0000
commit84aa3cb9dd0643e9fe0dd188163435d6d282aac9 (patch)
treee93a418bea9142c01b5362f6ac5c165e8a8d5073 /include
parent78911f24fdfebf1fa2faf1fcfe2df1aeac897993 (diff)
downloadchrome-ec-84aa3cb9dd0643e9fe0dd188163435d6d282aac9.tar.gz
zephyr: motion: add support for runtime probing of motion sensors
Add possibility to define alternative motion sensors that will be probed on EC boot. This will allow to easily specify different variants of boards with different motion sensors. BRANCH=main BUG=b:194424288 TEST=This commit shouldn't change anything. Build, flash EC and motion sensors should work correctly, detecting tablet mode and orientation changes. Change-Id: Ia2f864854699416abdd188a6bc36e6356e86f6f5 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3129962 Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/accelgyro.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h
index 5d755b7eaa..be6b8061c3 100644
--- a/include/accelgyro.h
+++ b/include/accelgyro.h
@@ -125,6 +125,23 @@ struct accelgyro_drv {
*/
int (*perform_calib)(struct motion_sensor_t *s,
int enable);
+
+ /**
+ * Function that probes if supported chip is present.
+ * This pointer can be NULL if driver doesn't implement probing.
+ *
+ * @s Pointer to sensor data.
+ * @return EC_SUCCESS if the probe was successful, non-zero otherwise.
+ */
+ int (*probe)(const struct motion_sensor_t *s);
+
+ /**
+ * Interrupt handler for GPIO pin.
+ *
+ * @signal Signal which caused interrupt.
+ */
+ void (*interrupt)(enum gpio_signal signal);
+
/**
* handler for interrupts triggered by the sensor: it runs in task and
* process the events that triggered an interrupt.