summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew King <mathewk@chromium.org>2019-03-05 13:41:33 -0700
committerJett Rink <jettrink@chromium.org>2019-03-08 17:10:21 +0000
commite87f148d10a5dc52dd2895f6567e6f03b8e7ea66 (patch)
tree4a427e9d6c2afbe201b115f73e2973e21783080f
parent1548e3825ba8fd0d2704a67018162d26b18e9010 (diff)
downloadchrome-ec-e87f148d10a5dc52dd2895f6567e6f03b8e7ea66.tar.gz
arcada_ish: Add the gyro to the motion sensor array
The gyro for the LSM6DS3 is needed to get the ACCEL_FIFO working BUG=b:123634700 TEST=built and deployed to arcada device BRANCH=none Change-Id: I164e39dec6e2b9c10e7864fbcdcae41b1bfb8eb2 Signed-off-by: Mathew King <mathewk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1503799 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--board/arcada_ish/board.c31
-rw-r--r--board/arcada_ish/board.h5
2 files changed, 28 insertions, 8 deletions
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c
index 3cddfa393a..ce9aaece6c 100644
--- a/board/arcada_ish/board.c
+++ b/board/arcada_ish/board.c
@@ -28,21 +28,22 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* Sensor config */
-static struct mutex g_base_mutex;
+static struct mutex g_lid_mutex;
/* sensor private data */
static struct lsm6dsm_data lsm6dsm_a_data;
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
- [BASE_ACCEL] = {
- .name = "Base Accel",
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
.active_mask = SENSOR_ACTIVE_S0,
.chip = MOTIONSENSE_CHIP_LSM6DS3,
.type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_BASE,
+ .location = MOTIONSENSE_LOC_LID,
.drv = &lsm6dsm_drv,
- .mutex = &g_base_mutex,
- .drv_data = &lsm6dsm_a_data,
+ .mutex = &g_lid_mutex,
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
+ MOTIONSENSE_TYPE_ACCEL),
.port = I2C_PORT_SENSOR,
.addr = LSM6DSM_ADDR1,
.rot_standard_ref = NULL, /* TODO rotate correctly */
@@ -57,6 +58,24 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
+
+ [LID_GYRO] = {
+ .name = "Lid Gyro",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_LSM6DS3,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &lsm6dsm_drv,
+ .mutex = &g_lid_mutex,
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
+ MOTIONSENSE_TYPE_GYRO),
+ .port = I2C_PORT_SENSOR,
+ .addr = LSM6DSM_ADDR1,
+ .default_range = 1000 | ROUND_UP_FLAG, /* dps */
+ .rot_standard_ref = NULL, /* TODO rotate correctly */
+ .min_frequency = LSM6DSM_ODR_MIN_VAL,
+ .max_frequency = LSM6DSM_ODR_MAX_VAL,
+ },
/* TODO(b/122281217): Add remain sensors */
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
diff --git a/board/arcada_ish/board.h b/board/arcada_ish/board.h
index 0956d1620e..348a92c6d1 100644
--- a/board/arcada_ish/board.h
+++ b/board/arcada_ish/board.h
@@ -33,7 +33,7 @@
#define CONFIG_ACCELGYRO_LSM6DSM /* For LSM6DS3 */
/* TODO(b/123634700): This is temporary until FIFO is supported */
-#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << BASE_ACCEL)
+#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
/* Host command over HECI */
#define CONFIG_HOSTCMD_HECI
@@ -78,7 +78,8 @@
/* Motion sensors */
enum sensor_id {
- BASE_ACCEL,
+ LID_ACCEL,
+ LID_GYRO,
/* TODO(b/122281217): Add remain sensors */
SENSOR_COUNT
};