mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
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>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user