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, };