From 01fcc3ec9da695f4db0b631b1f9a96dd462cfcc6 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 30 Aug 2018 16:09:50 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1205203 Reviewed-by: Aseda Aboagye (cherry picked from commit 61b1806c0db895487ee9e687f365d844f5931732) Reviewed-on: https://chromium-review.googlesource.com/1252449 --- driver/accelgyro_bmi160.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'driver') diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index 8966d57261..671ca1f572 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -980,12 +980,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 */ -- cgit v1.2.1