diff options
-rw-r--r-- | driver/accelgyro_lsm6dsm.c | 7 | ||||
-rw-r--r-- | driver/accelgyro_lsm6dsm.h | 1 | ||||
-rw-r--r-- | include/config.h | 1 | ||||
-rw-r--r-- | include/ec_commands.h | 1 | ||||
-rw-r--r-- | util/ectool.c | 3 |
5 files changed, 11 insertions, 2 deletions
diff --git a/driver/accelgyro_lsm6dsm.c b/driver/accelgyro_lsm6dsm.c index 9e333c95f2..dc9a0ff5aa 100644 --- a/driver/accelgyro_lsm6dsm.c +++ b/driver/accelgyro_lsm6dsm.c @@ -4,7 +4,7 @@ */ /** - * LSM6DSx (x is L or M) accelerometer and gyro module for Chrome EC + * LSM6DSx (x is L/M/3) accelerometer and gyro module for Chrome EC * 3D digital accelerometer & 3D digital gyroscope * This driver supports both devices LSM6DSM and LSM6DSL */ @@ -600,8 +600,11 @@ static int init(const struct motion_sensor_t *s) if (ret != EC_SUCCESS) return EC_ERROR_UNKNOWN; - if (tmp != LSM6DSM_WHO_AM_I) + if (tmp != LSM6DS3_WHO_AM_I && tmp != LSM6DSM_WHO_AM_I) { + /* Unrecognized sensor */ + CPRINTS("Unknown WHO_AM_I value: 0x%x", tmp); return EC_ERROR_ACCESS_DENIED; + } /* * This sensor can be powered through an EC reboot, so the state of the diff --git a/driver/accelgyro_lsm6dsm.h b/driver/accelgyro_lsm6dsm.h index a9191bdfb4..bfbf1fc26c 100644 --- a/driver/accelgyro_lsm6dsm.h +++ b/driver/accelgyro_lsm6dsm.h @@ -69,6 +69,7 @@ /* Who Am I */ #define LSM6DSM_WHO_AM_I_REG 0x0f #define LSM6DSM_WHO_AM_I 0x6a +#define LSM6DS3_WHO_AM_I 0x69 #define LSM6DSM_CTRL1_ADDR 0x10 #define LSM6DSM_XL_ODR_MASK 0xf0 diff --git a/include/config.h b/include/config.h index ec02b51c68..9ebb0bc4de 100644 --- a/include/config.h +++ b/include/config.h @@ -77,6 +77,7 @@ #undef CONFIG_ACCEL_LIS2D_COMMON #undef CONFIG_ACCELGYRO_BMI160 #undef CONFIG_ACCELGYRO_LSM6DS0 +/* Use CONFIG_ACCELGYRO_LSM6DSM for LSM6DSL, LSM6DSM, and/or LSM6DS3 */ #undef CONFIG_ACCELGYRO_LSM6DSM /* Add sensorhub function for LSM6DSM, required if 2nd device attached. */ #undef CONFIG_SENSORHUB_LSM6DSM diff --git a/include/ec_commands.h b/include/ec_commands.h index 60ef2d1812..defa9f7edd 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2432,6 +2432,7 @@ enum motionsensor_chip { MOTIONSENSE_CHIP_LSM6DSM = 14, MOTIONSENSE_CHIP_LIS2DE = 15, MOTIONSENSE_CHIP_LIS2MDL = 16, + MOTIONSENSE_CHIP_LSM6DS3 = 17, MOTIONSENSE_CHIP_MAX, }; diff --git a/util/ectool.c b/util/ectool.c index 33d464138d..cb0de928cb 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -4341,6 +4341,9 @@ static int cmd_motionsense(int argc, char **argv) case MOTIONSENSE_CHIP_LIS2MDL: printf("lis2mdl\n"); break; + case MOTIONSENSE_CHIP_LSM6DS3: + printf("lsm6ds3\n"); + break; default: printf("unknown\n"); } |