mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
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 TEST=Pass more tests: tests like ..._fastest_batching after _50hz_flush have more change to pass. BUG=chrome-os-partner:39900 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>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
179d5d3c83
commit
5faadc6748
@@ -505,13 +505,6 @@ 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.
|
||||
@@ -519,6 +512,7 @@ void motion_sense_task(void)
|
||||
* - 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)
|
||||
|
||||
@@ -797,8 +797,16 @@ static int load_fifo(struct motion_sensor_t *s)
|
||||
if (s->type != MOTIONSENSE_TYPE_ACCEL)
|
||||
return EC_SUCCESS;
|
||||
|
||||
if (!(data->flags & (BMI160_FIFO_ALL_MASK << BMI160_FIFO_FLAG_OFFSET)))
|
||||
if (!(data->flags &
|
||||
(BMI160_FIFO_ALL_MASK << BMI160_FIFO_FLAG_OFFSET))) {
|
||||
/*
|
||||
* Flush potiential left over:
|
||||
*
|
||||
* When sensor is resumed, we don't want to read old data.
|
||||
*/
|
||||
raw_write8(s->addr, BMI160_CMD_REG, BMI160_CMD_FIFO_FLUSH);
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
do {
|
||||
enum fifo_state state = FIFO_HEADER;
|
||||
|
||||
Reference in New Issue
Block a user