summaryrefslogtreecommitdiff
path: root/driver/accelgyro_lsm6dso.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2022-04-26 09:14:04 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-23 16:44:43 +0000
commit8eaf19cce035fb1f05a2f72de7b423ae05bc489d (patch)
tree61fa2fb8f824bffa4cc9f74dcf145232d9c12dfe /driver/accelgyro_lsm6dso.h
parent377c0edd68556f0a241c485678e1f781b8488b95 (diff)
downloadchrome-ec-8eaf19cce035fb1f05a2f72de7b423ae05bc489d.tar.gz
lsm6dso: Use CONFIG_<driver>_INT_ENABLE
Use CONFIG_<driver>_INT_ENABLE to not include interrupt() and irq_handler() when hardware interrupt are not used. Disable call to motion_sense_fifo() with IS_ENABLED(CONFIG_ACCEL_FIFO). Other use of CONFIG_ACCEL_FIFO are removed: only when a hardware interrupt is configured we enable the sensor FIFO. Otherwise we directly read into the sensor data registers. BUG=b:230401133 BRANCH=asurada,dedede,brya TEST=Build all. Check Zephyr with herobrine. Check on bugzzy. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Id867b00d7b5d63c5662630610a886d6ba0725189 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609349 Reviewed-by: Yuval Peress <peress@google.com>
Diffstat (limited to 'driver/accelgyro_lsm6dso.h')
-rw-r--r--driver/accelgyro_lsm6dso.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/driver/accelgyro_lsm6dso.h b/driver/accelgyro_lsm6dso.h
index 15c17f167a..6b7f1138b6 100644
--- a/driver/accelgyro_lsm6dso.h
+++ b/driver/accelgyro_lsm6dso.h
@@ -209,4 +209,21 @@ extern const struct accelgyro_drv lsm6dso_drv;
void lsm6dso_interrupt(enum gpio_signal signal);
+#if defined(CONFIG_ZEPHYR)
+#if DT_NODE_EXISTS(DT_ALIAS(lsm6dso_int))
+/* Get the motion sensor ID of the LSM6DSO 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 an alias (lsm6dso_int) to get the motion sensor ID. This alias
+ * MUST be defined for this driver to work.
+ * aliases {
+ * lsm6dso-int = &lid_accel;
+ * };
+ */
+#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(lsm6dso_int)))
+#endif
+#endif /* CONFIG_ZEPHYR */
+
#endif /* __CROS_EC_ACCELGYRO_LSM6DSO_H */