summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2018-08-30 16:09:50 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-02-12 01:51:41 +0000
commit7966c58c64bcd95e2f11481a993650e13207980d (patch)
tree0a6b06633a8dede9a7bcec49953663571be82a17
parent512606a2c4b2c378cd197b52c4793ad2f7e4ddb0 (diff)
downloadchrome-ec-7966c58c64bcd95e2f11481a993650e13207980d.tar.gz
FIXUP: driver: bmi160: harden interrupt and fifo processing
Actually 5ms is needed to reset interrupt of activity like significant motion. When processing FIFO, the interrupt will go down once the FIFO is processed, but for activity, there is no easy way for the bit to go down. See https://electronics.stackexchange.com/questions/299188/how-to-program-bmi160-inertial-measuremen-unit-to-latch-detection-flags BUG=b:73557414,b:80284952 BRANCH=scarlet,poppy,nocturne TEST=Without this change, the interrupt bitfield in the the interrupt routine never goes back to 0. Check the sensor is not getting stuck. Change-Id: I986547787183377938ab08afe52fb2871d5c7c71 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1205203 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 61b1806c0db895487ee9e687f365d844f5931732) Reviewed-on: https://chromium-review.googlesource.com/1252449 (cherry picked from commit 01fcc3ec9da695f4db0b631b1f9a96dd462cfcc6) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1387598 Reviewed-by: Enrico Granata <egranata@chromium.org> Commit-Queue: Enrico Granata <egranata@chromium.org> Tested-by: Enrico Granata <egranata@chromium.org>
-rw-r--r--driver/accelgyro_bmi160.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index bb7076230f..b0e4b497e4 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -1019,12 +1019,11 @@ static int config_interrupt(const struct motion_sensor_t *s)
#endif
#ifdef CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT
- ret = raw_write8(s->port, s->addr, BMI160_INT_LATCH,
- BMI160_LATCH_FOREVER);
+ ret = raw_write8(s->port, s->addr, BMI160_INT_LATCH, BMI160_LATCH_5MS);
#else
/* Also, configure int2 as an external input. */
ret = raw_write8(s->port, s->addr, BMI160_INT_LATCH,
- BMI160_INT2_INPUT_EN | BMI160_LATCH_FOREVER);
+ BMI160_INT2_INPUT_EN | BMI160_LATCH_5MS);
#endif
/* configure int1 as an interrupt */