summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorBruce <Bruce.Wan@quantatw.com>2016-10-21 14:50:37 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-10-23 01:00:03 -0700
commit0ef87a741c2be6f5688ea1bea618085a3907cf5c (patch)
tree5b7ff7c0014039b1544c8d3ca2a3c2baf0d2b67f /board
parenta0e1cd054a0f5f7723a2db8907d8617d08460fa4 (diff)
downloadchrome-ec-0ef87a741c2be6f5688ea1bea618085a3907cf5c.tar.gz
Pyro: Fix sensors order for devices with BM160 and LPC mode.
When the kernel reads sensor data via LPC, it expects the order to be: - ACCEL - ACCEL - GYRO (other sensors data are read through EC commands) BMI160 expects ACCEL, GYRO and MAG to be next to each other. Reorganize motion_sensor array to fit these 2 requirements: If BMI160 in the lid: - BASE_ACCEL - LID_ACCEL - LID_GYRO ... If BMI160 in the base: - LID_ACCEL - BASE_ACCEL - BASE_GRYO ... BUG=none BRANCH=none TEST=make buildall Change-Id: If89cf29d28b70e9a46dde8a3301a1942b3a1dd8b Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/401206 Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com> Tested-by: Keith Tzeng <keith.tzeng@quantatw.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/pyro/board.c77
-rw-r--r--board/pyro/board.h11
2 files changed, 44 insertions, 44 deletions
diff --git a/board/pyro/board.c b/board/pyro/board.c
index 54cf7f0554..8ad3dc67af 100644
--- a/board/pyro/board.c
+++ b/board/pyro/board.c
@@ -721,11 +721,42 @@ struct kionix_accel_data g_kx022_data;
/* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Pyro */
struct motion_sensor_t motion_sensors[] = {
- /*
- * Note: bmi160: supports accelerometer and gyro sensor
- * Requirement: accelerometer sensor must init before gyro sensor
- * DO NOT change the order of the following table.
- */
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_KX022,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &kionix_accel_drv,
+ .mutex = &g_lid_mutex,
+ .drv_data = &g_kx022_data,
+ .port = I2C_PORT_LID_ACCEL,
+ .addr = KX022_ADDR1,
+ .rot_standard_ref = NULL, /* Identity matrix. */
+ .default_range = 2, /* g, enough for laptop. */
+ .config = {
+ /* AP: by default use EC settings */
+ [SENSOR_CONFIG_AP] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ /* unused */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ [SENSOR_CONFIG_EC_S5] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ },
+ },
+
[BASE_ACCEL] = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0,
@@ -837,42 +868,6 @@ struct motion_sensor_t motion_sensors[] = {
},
},
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_KX022,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &kionix_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_kx022_data,
- .port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
- .rot_standard_ref = NULL, /* Identity matrix. */
- .default_range = 2, /* g, enough for laptop. */
- .config = {
- /* AP: by default use EC settings */
- [SENSOR_CONFIG_AP] = {
- .odr = 0,
- .ec_rate = 0,
- },
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- /* unused */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 0,
- .ec_rate = 0,
- },
- [SENSOR_CONFIG_EC_S5] = {
- .odr = 0,
- .ec_rate = 0,
- },
- },
- },
-
[BASE_BARO] = {
.name = "Base Baro",
.active_mask = SENSOR_ACTIVE_S0,
diff --git a/board/pyro/board.h b/board/pyro/board.h
index 043b990358..4908317a94 100644
--- a/board/pyro/board.h
+++ b/board/pyro/board.h
@@ -243,12 +243,17 @@ enum als_id {
ALS_COUNT
};
-/* Motion sensors */
+/*
+ * Motion sensors:
+ * When reading through IO memory is set up for sensors (LPC is used),
+ * the first 2 entries must be accelerometers, then gyroscope.
+ * For BMI160, accel, gyro and compass sensors must be next to each other.
+ */
enum sensor_id {
- BASE_ACCEL = 0,
+ LID_ACCEL = 0,
+ BASE_ACCEL,
BASE_GYRO,
BASE_MAG,
- LID_ACCEL,
BASE_BARO,
};