diff options
author | Sue Chen <sue.chen@quanta.corp-partner.google.com> | 2020-12-29 17:26:50 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-29 07:17:35 +0000 |
commit | 1421034537f4ff0e26487d63b7e2a7f51645473c (patch) | |
tree | 3d04f18838c712228056d95bc78fa483c1a22f28 /board/lazor | |
parent | 05bd575fee4f2e3adfcc047a3696e6cd40bfe56e (diff) | |
download | chrome-ec-1421034537f4ff0e26487d63b7e2a7f51645473c.tar.gz |
Lazor: Modify motion sensors detection
There is some concern for motion sensors detection by reading I2C in
HOOK_INIT.
1. HOOK_INIT can run in S5. The sensors may not be powered.
-> The motion sensors is powered by PP1800_SENSORS which is powered
by EN_EC_PWR (GPIO85) so the sensors would be powered while the
EC is powered.
2. kionix KX022 is temperamental at power up.
-> Detect lid accel sensor by reading BMA255 instead of KX022.
BUG=b:175663607
BRANCH=trogdor
TEST=Motion sensors are detected correctly on rework board (with KX022
and ICM40608) and original board (with BMA255 and BMI160).
Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
Change-Id: I2b438ea4cd1ca17f3b9dddcc108298cfb635e726
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606166
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'board/lazor')
-rw-r--r-- | board/lazor/board.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/board/lazor/board.c b/board/lazor/board.c index 49d59c10fa..4ae506523d 100644 --- a/board/lazor/board.c +++ b/board/lazor/board.c @@ -330,7 +330,7 @@ static const mat33_fp_t lid_standard_ref_kx022 = { struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_BMA255, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, @@ -361,7 +361,7 @@ struct motion_sensor_t motion_sensors[] = { */ [BASE_ACCEL] = { .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_BASE, @@ -387,7 +387,7 @@ struct motion_sensor_t motion_sensors[] = { }, [BASE_GYRO] = { .name = "Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_GYRO, .location = MOTIONSENSE_LOC_BASE, @@ -406,7 +406,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); struct motion_sensor_t kx022_lid_accel = { .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_KX022, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, @@ -433,7 +433,7 @@ struct motion_sensor_t kx022_lid_accel = { struct motion_sensor_t icm426xx_base_accel = { .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_ICM426XX, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_BASE, @@ -460,7 +460,7 @@ struct motion_sensor_t icm426xx_base_accel = { struct motion_sensor_t icm426xx_base_gyro = { .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_ICM426XX, .type = MOTIONSENSE_TYPE_GYRO, .location = MOTIONSENSE_LOC_BASE, @@ -545,13 +545,12 @@ static void board_detect_motionsensor(void) int val; /* Check lid accel chip */ - ret = i2c_read8(I2C_PORT_SENSOR, KX022_ADDR1_FLAGS, - KX022_WHOAMI, &val); - - if (!ret) + ret = i2c_read8(I2C_PORT_SENSOR, BMA2x2_I2C_ADDR1_FLAGS, + BMA2x2_CHIP_ID_ADDR, &val); + if (ret) motion_sensors[LID_ACCEL] = kx022_lid_accel; - CPRINTS("Lid Accel: %s", ret ? "BMA255" : "KX022"); + CPRINTS("Lid Accel: %s", ret ? "KX022" : "BMA255"); /* Check base accelgyro chip */ ret = icm_read8(&icm426xx_base_accel, ICM426XX_REG_WHO_AM_I, &val); |