driver: bmi160: fix FIFO pollution at boot

FIFO should not collect events of suspended sensors.
It could still happen at boot, when sensors are set up suspended.

BRANCH=smaug
TEST=Check for invalid FIFO events in HAL code.
BUG=none

Change-Id: Ie363afc3f3263bb10e03a8d0a8ee34b8b92bb6b4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288200
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Gwendal Grignou
2015-07-23 14:54:14 -07:00
committed by ChromeOS Commit Bot
parent 14bd917343
commit 60482a8179

View File

@@ -569,10 +569,7 @@ static int config_interrupt(const struct motion_sensor_t *s)
ret = raw_write8(s->i2c_addr, BMI160_FIFO_CONFIG_1,
BMI160_FIFO_TAG_INT1_EN |
BMI160_FIFO_TAG_INT2_EN |
BMI160_FIFO_HEADER_EN |
BMI160_FIFO_MAG_EN |
BMI160_FIFO_ACC_EN |
BMI160_FIFO_GYR_EN);
BMI160_FIFO_HEADER_EN);
#endif
/* Set double tap interrupt and fifo*/
@@ -905,14 +902,14 @@ static int init(const struct motion_sensor_t *s)
*/
bmm150_mag_access_ctrl(s->i2c_addr, 0);
}
#endif
#ifdef CONFIG_ACCEL_INTERRUPTS
if (s->type == MOTIONSENSE_TYPE_ACCEL)
ret = config_interrupt(s);
#endif
set_range(s, s->runtime_config.range, 0);
set_data_rate(s, s->runtime_config.odr, 0);
#ifdef CONFIG_ACCEL_INTERRUPTS
ret = config_interrupt(s);
#endif
/* Fifo setup is done elsewhere */
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d odr:%d]\n",
s->name, s->type, s->runtime_config.range,
s->runtime_config.odr);