diff options
author | Yuval Peress <peress@chromium.org> | 2019-05-30 13:54:52 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-06 23:47:08 +0000 |
commit | 4e6d315948367c53116e428828eac19dfbdfb429 (patch) | |
tree | d2feb44ea49f7059c42de41c6a6c085992ed3d6e /driver/als_tcs3400.c | |
parent | 245450a0189391cace7ace17553193cfc10866ce (diff) | |
download | chrome-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/als_tcs3400.c')
-rw-r--r-- | driver/als_tcs3400.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c index 9e7251f711..e08d385a95 100644 --- a/driver/als_tcs3400.c +++ b/driver/als_tcs3400.c @@ -134,7 +134,7 @@ skip_clear_vector_load: #ifdef CONFIG_ACCEL_FIFO vector.sensor_num = s - motion_sensors; - motion_sense_fifo_add_data(&vector, s, 3, last_ts); + motion_sense_fifo_stage_data(&vector, s, 3, last_ts); #endif } @@ -192,8 +192,9 @@ skip_rgb_load: skip_vector_load: #endif vector.sensor_num = rgb_s - motion_sensors; - motion_sense_fifo_add_data(&vector, rgb_s, 3, last_ts); + motion_sense_fifo_stage_data(&vector, rgb_s, 3, last_ts); } + motion_sense_fifo_commit_data(); return EC_SUCCESS; } @@ -209,7 +210,7 @@ void tcs3400_interrupt(enum gpio_signal signal) /* * tcs3400_irq_handler - bottom half of the interrupt stack. * Ran from the motion_sense task, finds the events that raised the interrupt, - * and posts those events via motion_sense_fifo_add_data().. + * and posts those events via motion_sense_fifo_stage_data().. */ static int tcs3400_irq_handler(struct motion_sensor_t *s, uint32_t *event) { |