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-10-09 00:26:11 +0000
commite5fc1d017d79511c109b0061ac47947c80235913 (patch)
tree5fafadeeac851eca578281fd956d882343accf4b
parent597a892ad331b7b347ce48d2ce9980e7f4d1e948 (diff)
downloadchrome-ec-e5fc1d017d79511c109b0061ac47947c80235913.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 ... Conflicts: driver/accelgyro_bmi260.c: CONFIG_BODY_DETECTION not support 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> (cherry picked from commit fc298a0ada0350ae9cb2dab21e790efb4d8c4a36) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3143632 Tested-by: Rong Chang <rongchang@chromium.org> Reviewed-by: 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 9650d48136..4c1e0b1542 100644
--- a/driver/accelgyro_bmi260.c
+++ b/driver/accelgyro_bmi260.c
@@ -257,6 +257,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
/**
@@ -497,6 +509,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_CMD_I2C_STRESS_TEST_ACCEL