diff options
author | Alexandru M Stan <amstan@chromium.org> | 2017-12-04 19:44:42 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-14 04:06:52 -0700 |
commit | b63595258df33b0c31effe979feb4bfe884cc9fb (patch) | |
tree | 3de3e0bf2293c177bf4103cebffde756b1f78b02 /driver/accel_lis2dh.c | |
parent | e74d21f5bdf7f05f13a3b6d496fe37235cb4fdef (diff) | |
download | chrome-ec-b63595258df33b0c31effe979feb4bfe884cc9fb.tar.gz |
motion: Lower jitter of Sensor->EC timestamp
Instead getting the time for each sample in the task code, we should be
getting it as soon as the sensor reported it added it to its fifo (so
sensor just finished integration).
Because of that each sensor should provide the time when it provides a
sample, ideally from an accurate spot like an interrupt.
Deprecate motion_sense_fifo_add_unit (without a timestamp) in favour of
motion_sense_fifo_add_data (which adds the timestamps). Update all
relevant sensors to use the new api.
Note: for now I focused on the BMI160, where I actually made it get the
time in the interrupt. The other sensors were made to use the new api,
but still don't record the time in the right place (though it's not any
worse than before).
BUG=b:67743747
TEST=In the kernel, fifo_info->info.timestamp still has sane values.
TEST=CTS should still pass
BRANCH=master
Change-Id: I9829343f8702e00cc19f9c88134fa1f258c9e1e9
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/807331
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'driver/accel_lis2dh.c')
-rw-r--r-- | driver/accel_lis2dh.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/driver/accel_lis2dh.c b/driver/accel_lis2dh.c index 6cb2ff87ce..0393d95429 100644 --- a/driver/accel_lis2dh.c +++ b/driver/accel_lis2dh.c @@ -11,6 +11,7 @@ #include "common.h" #include "console.h" #include "hooks.h" +#include "hwtimer.h" #include "i2c.h" #include "math_util.h" #include "task.h" @@ -197,7 +198,12 @@ static int load_fifo(struct motion_sensor_t *s) vect.data[2] = axis[2]; vect.flags = 0; vect.sensor_num = 0; - motion_sense_fifo_add_unit(&vect, s, 3); + motion_sense_fifo_add_data(&vect, s, 3, + __hw_clock_source_read()); + /* + * TODO: get time at a more accurate spot. + * Like in lis2dh_interrupt + */ } } while(!done); |