diff options
author | Yuval Peress <peress@chromium.org> | 2019-10-11 14:53:30 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-16 20:10:59 +0000 |
commit | 2f0be0c8b5dea759ed58d5c218d446c3edc9ade0 (patch) | |
tree | 4f21fa4bbbc202c903239ca9087865c9ff3106d4 /driver/accelgyro_bmi160.c | |
parent | 0cb158dec30f315bbb10429c3b28b6933214bcc1 (diff) | |
download | chrome-ec-2f0be0c8b5dea759ed58d5c218d446c3edc9ade0.tar.gz |
driver: bmi160: Move commit to end of loop
This change moves the motion_sense_fifo_commit_data call
outside of the do...while loop in irq_handler. This is
needed to allow for 1 commit per last_interrupt_timestamp
which makes the commit more efficient and accurate.
BUG=b:137758297,b:140157960
TEST=Ran CTS on Kohaku (this doesn't fix all the issues but
improves the state)
BRANCH=None
Change-Id: Ifd680fb8d6eb47383928e25858898ac828fe4e92
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1856829
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'driver/accelgyro_bmi160.c')
-rw-r--r-- | driver/accelgyro_bmi160.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index 5fd9e3acda..79107cc6ee 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -1027,7 +1027,6 @@ static int load_fifo(struct motion_sensor_t *s, uint32_t last_ts) state = FIFO_HEADER; } } - motion_sense_fifo_commit_data(); return EC_SUCCESS; } @@ -1192,6 +1191,7 @@ static void irq_set_orientation(struct motion_sensor_t *s, static int irq_handler(struct motion_sensor_t *s, uint32_t *event) { uint32_t interrupt; + int8_t has_read_fifo = 0; int rv; if ((s->type != MOTIONSENSE_TYPE_ACCEL) || @@ -1218,13 +1218,18 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event) MOTIONSENSE_ACTIVITY_SIG_MOTION); #endif if (IS_ENABLED(CONFIG_ACCEL_FIFO) && - interrupt & (BMI160_FWM_INT | BMI160_FFULL_INT)) + interrupt & (BMI160_FWM_INT | BMI160_FFULL_INT)) { load_fifo(s, last_interrupt_timestamp); + has_read_fifo = 1; + } #ifdef CONFIG_BMI160_ORIENTATION_SENSOR irq_set_orientation(s, interrupt); #endif } while (interrupt != 0); + if (IS_ENABLED(CONFIG_ACCEL_FIFO) && has_read_fifo) + motion_sense_fifo_commit_data(); + return EC_SUCCESS; } #endif /* CONFIG_ACCEL_INTERRUPTS */ |