summaryrefslogtreecommitdiff
path: root/driver/accelgyro_bmi160.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-05-30 13:54:52 -0600
committerCommit Bot <commit-bot@chromium.org>2019-06-06 23:47:08 +0000
commit4e6d315948367c53116e428828eac19dfbdfb429 (patch)
treed2feb44ea49f7059c42de41c6a6c085992ed3d6e /driver/accelgyro_bmi160.c
parent245450a0189391cace7ace17553193cfc10866ce (diff)
downloadchrome-ec-4e6d315948367c53116e428828eac19dfbdfb429.tar.gz
common: motion_sense: Spread timestamps in motion sense fifo
This changes moves the specialized logic for timestamp spreading away from the accelgyro_lsm6dsm and into the main motion_sense loop. The motion_sense_fifo_add_data function was replaced by a stage equivalent, and a commit function was added. Similarly, internal static functions for motion_sense.c were renamed to use the stage terminology. The idea is: When a sensor is read, it might provide more than one measurement though the only known timestamp is the one that caused the interrupt. Staging this data allows us to use the same fifo queue space that the entries would consume eventually anyway without making the entries readable. Upon commit, the timestamp entries are spread if needed. Note that if tight timestamps are disabled, the commit becomes a simple tail move. BUG=chromium:966506 BRANCH=None TEST=Ran CTS on arcada. Change-Id: Ib7d0a75c9c56fc4e275aed794058a5eca58ff47f Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1637416 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/accelgyro_bmi160.c')
-rw-r--r--driver/accelgyro_bmi160.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 933838251f..d06d3f7d99 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -842,7 +842,7 @@ static int bmi160_decode_header(struct motion_sensor_t *accel,
vector.data[Y] = v[Y];
vector.data[Z] = v[Z];
vector.sensor_num = s - motion_sensors;
- motion_sense_fifo_add_data(&vector, s, 3,
+ motion_sense_fifo_stage_data(&vector, s, 3,
last_ts);
*bp += (i == MOTIONSENSE_TYPE_MAG ? 8 : 6);
}
@@ -994,6 +994,7 @@ static int load_fifo(struct motion_sensor_t *s, uint32_t last_ts)
state = FIFO_HEADER;
}
}
+ motion_sense_fifo_commit_data();
return EC_SUCCESS;
}
#endif /* CONFIG_ACCEL_FIFO */