From a0e46cd164efca0f48ecff3d1d2ffe10309e3fd4 Mon Sep 17 00:00:00 2001 From: Hyungwoo Yang Date: Fri, 19 Mar 2021 23:37:43 -0700 Subject: zephyr: DT: support BMI260 This change is to support BMI260 via DT. The change includes, using DT, - creating BMI260 driver specific data - creating motion sensor entry for BMI260 - creating the BMI260 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang Change-Id: Id5c64df4d2f14a50709ac15855567a67671b8515 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778821 Reviewed-by: Simon Glass --- driver/accelgyro_bmi260.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'driver/accelgyro_bmi260.c') diff --git a/driver/accelgyro_bmi260.c b/driver/accelgyro_bmi260.c index 573f8ce288..21d783fe84 100644 --- a/driver/accelgyro_bmi260.c +++ b/driver/accelgyro_bmi260.c @@ -28,6 +28,26 @@ #define CPRINTF(format, args...) cprintf(CC_ACCEL, format, ## args) #define CPRINTS(format, args...) cprints(CC_ACCEL, format, ## args) +#if defined(CONFIG_ZEPHYR) && defined(CONFIG_ACCEL_INTERRUPTS) +/* + * Get the mostion sensor ID of the BMI260 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 { + * bmi260-int = &base_accel; + * }; + */ +#if DT_NODE_EXISTS(DT_ALIAS(bmi260_int)) +#define CONFIG_ACCELGYRO_BMI260_INT_EVENT \ + TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(bmi260_int))) +#endif +#endif + STATIC_IF(CONFIG_ACCEL_FIFO) volatile uint32_t last_interrupt_timestamp; /* -- cgit v1.2.1