From 1d518fb85cd7163a2fc390871046d8d6c398ed57 Mon Sep 17 00:00:00 2001 From: Alexandru M Stan Date: Thu, 30 Nov 2017 20:43:15 -0800 Subject: motion_sense: Lower jitter of EC->AP timestamp When the EC sends an interrupt to the AP notifying it of new accelerometer data we need to make sure the spot we record the timestamp of the event is virtually identical to the spot the AP records the same point in time. Therefore a better spot for that is right next to the gpio toggling of the interrupt line. BUG=b:67743747 TEST=In the kernel, fifo_info->info.timestamp still has sane values. TEST=CTS should still pass BRANCH=master Change-Id: Ic77101a045123e779f576c46b401c765304976fd Signed-off-by: Alexandru M Stan Reviewed-on: https://chromium-review.googlesource.com/802976 Reviewed-by: Gwendal Grignou Reviewed-by: Randall Spangler --- include/ec_commands.h | 4 +++- include/mkbp_event.h | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ec_commands.h b/include/ec_commands.h index cf7148e535..efbb23f785 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2323,7 +2323,9 @@ struct __ec_todo_packed ec_response_motion_sense_fifo_info { uint16_t size; /* Amount of space used in the fifo */ uint16_t count; - /* Timestamp recorded in us */ + /* Timestamp recorded in us. + * aka accurate timestamp when host event was triggered. + */ uint32_t timestamp; /* Total amount of vector lost */ uint16_t total_lost; diff --git a/include/mkbp_event.h b/include/mkbp_event.h index cad43444b5..68e29c0cd4 100644 --- a/include/mkbp_event.h +++ b/include/mkbp_event.h @@ -8,6 +8,15 @@ #ifndef __CROS_EC_MKBP_EVENT_H #define __CROS_EC_MKBP_EVENT_H +/* + * Last time the host received an interrupt. + * + * Retrieved via __hw_clock_source_read() as close as possible + * to the interrupt source. Intended to be virtually the same time the + * first line of the AP hard irq for the EC interrupt. + */ +extern uint32_t mkbp_last_event_time; + /* * Sends an event to the AP. * -- cgit v1.2.1