summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@google.com>2021-08-13 11:32:38 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-20 07:35:44 +0000
commitfc298a0ada0350ae9cb2dab21e790efb4d8c4a36 (patch)
treeb8975d1a9c736d4f16b5a8bfe41d9d848a041945
parent1fb82e8268c4c31b21f910a0682d35a22ee5c45d (diff)
downloadchrome-ec-fc298a0ada0350ae9cb2dab21e790efb4d8c4a36.tar.gz
driver: bmi260: integrate body detection
Body detection is accelerometer agnostics. It was added in BMI260, but not finalized. Add list_activity function to enable/disable body detection. BRANCH=volteer BUG=b:195908820 TEST=Check cros-ec-activity is loaded. Enable proximity event: echo 1 > events/in_proximity_change_either_en Load iio_event_monitor, check we get events when moving device on lap to floor: Event: time: 925239910373, type: proximity, channel: 0, evtype: change, direction: falling Event: time: 945020001791, type: proximity, channel: 0, evtype: change, direction: rising ... Change-Id: I423c7044761d2addac36d435781ea19c1f1b18ed Signed-off-by: Gwendal Grignou <gwendal@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3097151 Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Ching-Kang Yen <chingkang@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
-rw-r--r--driver/accelgyro_bmi260.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/driver/accelgyro_bmi260.c b/driver/accelgyro_bmi260.c
index 7fbbb073cd..1ec042fbed 100644
--- a/driver/accelgyro_bmi260.c
+++ b/driver/accelgyro_bmi260.c
@@ -282,6 +282,18 @@ end_perform_calib:
return ret;
}
+#ifdef CONFIG_GESTURE_HOST_DETECTION
+int list_activities(const struct motion_sensor_t *s,
+ uint32_t *enabled,
+ uint32_t *disabled)
+{
+ struct bmi_drv_data_t *data = BMI_GET_DATA(s);
+ *enabled = data->enabled_activities;
+ *disabled = data->disabled_activities;
+ return EC_RES_SUCCESS;
+}
+#endif
+
#ifdef CONFIG_ACCEL_INTERRUPTS
/**
@@ -580,6 +592,9 @@ const struct accelgyro_drv bmi260_drv = {
#ifdef CONFIG_ACCEL_INTERRUPTS
.irq_handler = irq_handler,
#endif
+#ifdef CONFIG_GESTURE_HOST_DETECTION
+ .list_activities = list_activities,
+#endif
#ifdef CONFIG_BODY_DETECTION
.get_rms_noise = bmi_get_rms_noise,
#endif