diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-06-10 09:46:12 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-06-13 02:53:42 +0000 |
commit | c86743ce597c4bf1274c57ef497f5723cbe538f4 (patch) | |
tree | 84b8639da39ab6a15701d1b0ee92750e38bd1618 /driver | |
parent | 46644763f0ee0aafd0367c17a19c17d2197a7841 (diff) | |
download | chrome-ec-c86743ce597c4bf1274c57ef497f5723cbe538f4.tar.gz |
accel: Fix BMM150 init sequence
Without this change, after a while, the data from the accelerometer is
garbled, weaker than expected.
BUG=chromium:494270
TEST=Check that with this change, the accelerometer vector is always
around 1G.
BRANCH=smaug
Change-Id: I9bb4acd208e8fa4111fc91e35c4cb5636f9425f4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276666
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/accelgyro_bmi160.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index dd0ca67768..48190a963d 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -449,7 +449,7 @@ static int init(const struct motion_sensor_t *s) struct bmi160_drv_data_t *data = (struct bmi160_drv_data_t *)s->drv_data; if ((data->flags & BMI160_FLAG_SEC_I2C_ENABLED) == 0) { - int ext_page_reg; + int ext_page_reg, pullup_reg; /* Enable secondary interface */ /* * This is not part of the normal configuration but from @@ -477,8 +477,10 @@ static int init(const struct motion_sensor_t *s) &ext_page_reg); raw_write8(s->i2c_addr, BMI160_CMD_EXT_MODE_ADDR, ext_page_reg | BMI160_CMD_PAGING_EN); + raw_read8(s->i2c_addr, BMI160_COM_C_TRIM_ADDR, + &pullup_reg); raw_write8(s->i2c_addr, BMI160_COM_C_TRIM_ADDR, - BMI160_COM_C_TRIM); + pullup_reg | BMI160_COM_C_TRIM); raw_read8(s->i2c_addr, BMI160_CMD_EXT_MODE_ADDR, &ext_page_reg); raw_write8(s->i2c_addr, BMI160_CMD_EXT_MODE_ADDR, |