summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Granata <egranata@chromium.org>2019-03-14 17:02:47 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-10 17:20:45 +0000
commitdcde9078504e270e31a824dfd221045bd3cea31f (patch)
treee120021dcfb9b72bb34ae9c13e906ee3570abeb7
parentef4e629502eeb56f59d780ec9244864d3040e88e (diff)
downloadchrome-ec-dcde9078504e270e31a824dfd221045bd3cea31f.tar.gz
motion: Split configuration for sensor FIFO and tight timestamps
CONFIG_ACCEL_FIFO was being used both to control the size of the sensor FIFO, and the notion of tight timestamps. The latter is related to the format the EC uses to send sensor event timestamps and not to the size of the FIFO. Split this latter portion into its own configuration flag, CONFIG_SENSOR_TIGHT_TIMESTAMPS. This defaults to enabled, and should be turned on for all new boards. It will be selectively disabled on a few boards where the AP-side filtering this enables does not perform optimally due to jitter issues. BUG=b:123700100 BRANCH=rammus TEST=observe tight_timestamps on the sensor_ring device in kernel be enabled/disabled depending on whether CONFIG_SENSOR_TIGHT_TIMESTAMPS is #undef'ed or not Change-Id: I806ba6bb45a0007512afec9151c57c60d30fd604 Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524666 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1629314 Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1648955
-rw-r--r--common/ec_features.c2
-rw-r--r--common/motion_sense.c2
-rw-r--r--include/config.h24
3 files changed, 27 insertions, 1 deletions
diff --git a/common/ec_features.c b/common/ec_features.c
index 245154630a..ee861dbf20 100644
--- a/common/ec_features.c
+++ b/common/ec_features.c
@@ -125,7 +125,7 @@ uint32_t get_feature_flags1(void)
#ifdef CONFIG_CEC
| EC_FEATURE_MASK_1(EC_FEATURE_CEC)
#endif
-#ifdef CONFIG_ACCEL_FIFO
+#ifdef CONFIG_SENSOR_TIGHT_TIMESTAMPS
| EC_FEATURE_MASK_1(EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS)
#endif
;
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 1fe3aeb064..7b09b1a43e 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -176,7 +176,9 @@ void motion_sense_fifo_add_data(struct ec_response_motion_sensor_data *data,
struct motion_sensor_t *sensor,
int valid_data,
uint32_t time) {
+#ifdef CONFIG_SENSOR_TIGHT_TIMESTAMPS
motion_sense_insert_timestamp(time);
+#endif
motion_sense_fifo_add_unit(data, sensor, valid_data);
}
diff --git a/include/config.h b/include/config.h
index 71038e0c25..b04abeb07c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -119,6 +119,30 @@
/* Specify type of Gyrometers attached. */
#undef CONFIG_GYRO_L3GD20H
+/*
+ * If this is defined, motion_sense sends sensor events to the AP in the format
+ * +-----------+
+ * | Timestamp |
+ * | Payload |
+ * | Timestamp |
+ * | Payload |
+ * | ... |
+ * +-----------+
+ *
+ * If this is not defined, the events will be sent in the format
+ * +-----------+
+ * | Payload |
+ * | Payload |
+ * | Payload |
+ * | ... |
+ * | Timestamp |
+ * +-----------+
+ *
+ * The former format enables improved filtering of sensor event timestamps on
+ * the AP, but comes with stricter jitter requirements.
+ */
+#define CONFIG_SENSOR_TIGHT_TIMESTAMPS
+
/* Sync event driver */
#undef CONFIG_SYNC