diff options
author | Latchia <latchiamaran.senram@bosch.corp-partner.google.com> | 2021-11-01 23:49:04 +0530 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-04 03:03:01 +0000 |
commit | 9cad791c3ae5a46470a3822b2345e4ad4a43d305 (patch) | |
tree | 2f65b1741bb86eb19b96c31ba63ef3f8a05a5b09 | |
parent | 19552a15af11e6a0d3fc1498aabf8338c8804b80 (diff) | |
download | chrome-ec-9cad791c3ae5a46470a3822b2345e4ad4a43d305.tar.gz |
driver: bmi3xx: Fix base accelerometer streaming issue
The configuration of sensor has to be saved before writing
offsets and it has to be written back.
Instead of writing back the saved configurations,
there was a call to read back the configs again.
This patch has the correct write API call.
BRANCH=none
BUG=b:200776764
TEST=1. make BOARD=guybrush -j
2. Flash EC binary on the gurbrush proto 2 device
3. In kernel run:
ectool motionsense
cd /sys/bus/iio/devices/iio\:device2 && cat location
echo 0 > in_accel_x_calibbias
ectool motionsense # this should work
Signed-off-by: Latchiamaran Senram <latchiamaran.senram@bosch.corp-partner.google.com>
Change-Id: If8a20f50df8287fb49dec242f6ee9030e8bbe5d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3255475
Tested-by: Chih-Yao Chuang <jasonchuang@google.com>
Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
-rw-r--r-- | driver/accelgyro_bmi3xx.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/driver/accelgyro_bmi3xx.c b/driver/accelgyro_bmi3xx.c index ee9b30a9cf..febe97a7aa 100644 --- a/driver/accelgyro_bmi3xx.c +++ b/driver/accelgyro_bmi3xx.c @@ -481,7 +481,7 @@ int set_accel_offset(const struct motion_sensor_t *s, intv3_t v) /* Set the power mode as suspend */ RETURN_ERROR(bmi3_read_n(s, BMI3_REG_ACC_CONF, saved_conf, 6)); - /* Ignore two i2c sync bytes and store consecutive bytes in reg_data */ + /* Disable accelerometer and gyroscope */ reg_data[0] = saved_conf[2]; reg_data[1] = 0x00; reg_data[2] = saved_conf[4]; @@ -505,9 +505,6 @@ int set_accel_offset(const struct motion_sensor_t *s, intv3_t v) RETURN_ERROR(bmi3_write_n(s, BMI3_FEATURE_ENGINE_DMA_TX_DATA, reg_data, 6)); - /* Restore ACC_CONF by storing saved_conf data */ - RETURN_ERROR(bmi3_read_n(s, BMI3_REG_ACC_CONF, saved_conf, 6)); - /* Update the offset to the sensor engine */ reg_data[0] = (uint8_t)(BMI3_CMD_USR_GAIN_OFFS_UPDATE & BMI3_SET_LOW_BYTE); @@ -517,6 +514,9 @@ int set_accel_offset(const struct motion_sensor_t *s, intv3_t v) RETURN_ERROR(bmi3_write_n(s, BMI3_REG_CMD, reg_data, 2)); + /* Restore ACC_CONF by storing saved_conf data */ + RETURN_ERROR(bmi3_write_n(s, BMI3_REG_ACC_CONF, &saved_conf[2], 4)); + return EC_SUCCESS; } |