summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-08-07 22:44:57 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-08-01 16:37:40 +0000
commite6b7080d5c3ac4c2243ad5dbfe7f2caf97c6e110 (patch)
tree0cd32261b177bedbdf595d7273d944964bf39905
parent687d6518655a4ab88bdd18f77c0c361adbba41ba (diff)
downloadchrome-ec-e6b7080d5c3ac4c2243ad5dbfe7f2caf97c6e110.tar.gz
BACKPORT: motion_sense: Force flush when sensor disabled.
When sensor is disabled, HAL will not send flush request to EC. However, when sensor is reenabled, only new events are expected. When we have a change in frequency, we have to request the host to query all the current events. Flush the FIFO when events are not needed because all sensors are disabled. BRANCH=smaug, cyan TEST=Pass more tests: tests like ..._fastest_batching after _50hz_flush have more change to pass. BUG=chrome-os-partner:39900, b:27849483 Change-Id: I1a8fc3784e3e6be260b23103b28e336e242f14cd Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291991 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit 5faadc6748d556375c1effd56dac226f2a773ad1) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359328
-rw-r--r--common/motion_sense.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 4855a68d93..4e7f63ea83 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -506,19 +506,13 @@ void motion_sense_task(void)
ts_end_task = get_time();
#ifdef CONFIG_ACCEL_FIFO
/*
- * If ODR of any sensor changed, insert a timestamp to be ease
- * calculation of each events.
- */
- if (event & TASK_EVENT_MOTION_ODR_CHANGE)
- motion_sense_insert_timestamp();
-
- /*
* Ask the host to flush the queue if
* - a flush event has been queued.
* - the queue is almost full,
* - we haven't done it for a while.
*/
if (fifo_flush_needed ||
+ event & TASK_EVENT_MOTION_ODR_CHANGE ||
queue_space(&motion_sense_fifo) < CONFIG_ACCEL_FIFO_THRES ||
(ts_end_task.val - ts_last_int.val) > accel_interval) {
if (!fifo_flush_needed)