From 96b65354878587df434becfbc5d707a687c85fa4 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 12 Nov 2015 00:45:27 -0800 Subject: motion: fix oversampling formula Overly complex previous formula could lead the EC to throw all samples between 2 timestamps and put 2 event within one timestamp. That would confuse the kernel. If the motion sense task is delayed while this happen, the delta between the 2 samples could be so long that CTS test cts.SingleSensorTests would fail. BRANCH=smaug BUG=b:24367625 TEST=Loops of cts.SingleSensorTests pass. Change-Id: I29e6bf354ccb7ecf741a91116854d6abe07558dc Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/312364 Reviewed-by: Vincent Palatin --- include/motion_sense.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/motion_sense.h') diff --git a/include/motion_sense.h b/include/motion_sense.h index 7dd9fd747d..89203dd040 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -108,8 +108,11 @@ struct motion_sensor_t { /* * Allow EC to request an higher frequency for the sensors than the AP. + * We will downsample according to oversampling_ratio, or ignore the + * samples altogether if oversampling_ratio is 0. */ - fp_t oversampling; + uint16_t oversampling; + uint16_t oversampling_ratio; /* * How many vector events are lost in the FIFO since last time -- cgit v1.2.1