summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-01-06 10:52:21 +0800
committerCommit Bot <commit-bot@chromium.org>2022-01-25 05:35:02 +0000
commitfd1aa766715330611c8c5bc534b39ef7d7061a08 (patch)
tree8e2c86ca97572f84d61852f23b0f5cddd3279dfb /driver
parent62dcaaa6eeade768107383d7bf8d358691d1ae18 (diff)
downloadchrome-ec-fd1aa766715330611c8c5bc534b39ef7d7061a08.tar.gz
zephyr: sensor: support BMI323
Porting the dts from cros-ec to zephyr. BUG=b:213280143 TEST=enabled on kingler, and can be probed BRANCH=none Change-Id: I7f11f062d59d17c0f96a43f4cd3e19c759e41847 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3369164 Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'driver')
-rw-r--r--driver/accelgyro_bmi3xx.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/driver/accelgyro_bmi3xx.h b/driver/accelgyro_bmi3xx.h
index afd6855bc0..945a00e2d0 100644
--- a/driver/accelgyro_bmi3xx.h
+++ b/driver/accelgyro_bmi3xx.h
@@ -259,4 +259,24 @@ extern const struct accelgyro_drv bmi3xx_drv;
void bmi3xx_interrupt(enum gpio_signal signal);
+#if defined(CONFIG_ZEPHYR) && defined(CONFIG_ACCEL_INTERRUPTS)
+/*
+ * Get the motion sensor ID of the BMI3xx sensor that
+ * generates the interrupt.
+ * The interrupt is converted to the event and transferred to motion
+ * sense task that actually handles the interrupt.
+ *
+ * Here, we use alias to get the motion sensor ID
+ *
+ * e.g) base_accel is the label of a child node in /motionsense-sensors
+ * aliases {
+ * bmi3xx-int = &base_accel;
+ * };
+ */
+#if DT_NODE_EXISTS(DT_ALIAS(bmi3xx_int))
+#define CONFIG_ACCELGYRO_BMI3XX_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(bmi3xx_int)))
+#endif
+#endif
+
#endif /* __CROS_EC_ACCELGYRO_BMI3XX_H */