summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorAlexandru M Stan <amstan@chromium.org>2017-12-04 19:44:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-14 04:06:52 -0700
commitb63595258df33b0c31effe979feb4bfe884cc9fb (patch)
tree3de3e0bf2293c177bf4103cebffde756b1f78b02 /include/motion_sense.h
parente74d21f5bdf7f05f13a3b6d496fe37235cb4fdef (diff)
downloadchrome-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 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 9d727a62de..07687feb5a 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -180,15 +180,18 @@ extern unsigned int motion_min_interval;
extern struct queue motion_sense_fifo;
/**
- * Interrupt function for lid accelerometer.
+ * Add new actual data to the fifo, including a timestamp.
*
* @param data data to insert in the FIFO
* @param sensor sensor the data comes from
- * @valid_data data should be copied into the public sensor vector
+ * @param valid_data data should be copied into the public sensor vector
+ * @param time accurate time (ideally measured in an interrupt) the sample
+ * was taken at
*/
-void motion_sense_fifo_add_unit(struct ec_response_motion_sensor_data *data,
+void motion_sense_fifo_add_data(struct ec_response_motion_sensor_data *data,
struct motion_sensor_t *sensor,
- int valid_data);
+ int valid_data,
+ uint32_t time);
#endif