diff options
Diffstat (limited to 'board/caroline/board.c')
-rw-r--r-- | board/caroline/board.c | 225 |
1 files changed, 83 insertions, 142 deletions
diff --git a/board/caroline/board.c b/board/caroline/board.c index f93e0daaf8..27f5989250 100644 --- a/board/caroline/board.c +++ b/board/caroline/board.c @@ -510,153 +510,94 @@ const matrix_3x3_t lid_standard_ref = { struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMA255, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &bma2x2_accel_drv, - .mutex = &g_lid_mutex, - .drv_data = &g_bma255_data, - .addr = BMA2x2_I2C_ADDR1, - .rot_standard_ref = &lid_standard_ref, - .default_range = 8, /* g, to support tablet mode */ - .min_frequency = BMA255_ACCEL_MIN_FREQ, - .max_frequency = BMA255_ACCEL_MAX_FREQ, - .config = { - /* AP: by default use EC settings */ - [SENSOR_CONFIG_AP] = { - .odr = 0, - .ec_rate = 0, + .name = "Lid Accel", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_BMA255, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_LID, + .drv = &bma2x2_accel_drv, + .mutex = &g_lid_mutex, + .drv_data = &g_bma255_data, + .addr = BMA2x2_I2C_ADDR1, + .rot_standard_ref = &lid_standard_ref, + .default_range = 8, /* g, to support tablet mode */ + .min_frequency = BMA255_ACCEL_MIN_FREQ, + .max_frequency = BMA255_ACCEL_MAX_FREQ, + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + /* Sensor on in S3 */ + [SENSOR_CONFIG_EC_S3] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, }, - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor on in S3 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor off in S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0, - }, - }, }, - [BASE_ACCEL] = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI160, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi160_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi160_data, - .addr = BMI160_ADDR0, - .rot_standard_ref = &base_standard_ref, - .default_range = 8, /* g, to support tablet mode */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, - .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, - }, - /* Sensor on in S3 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor off in S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0 - }, - }, + .name = "Base Accel", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_BMI160, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_BASE, + .drv = &bmi160_drv, + .mutex = &g_base_mutex, + .drv_data = &g_bmi160_data, + .addr = BMI160_ADDR0, + .rot_standard_ref = &base_standard_ref, + .default_range = 8, /* g, to support tablet mode */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + /* Sensor on in S3 */ + [SENSOR_CONFIG_EC_S3] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + }, }, - [BASE_GYRO] = { - .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI160, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi160_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi160_data, - .addr = BMI160_ADDR0, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, - .config = { - /* AP: by default shutdown all sensors */ - [SENSOR_CONFIG_AP] = { - .odr = 0, - .ec_rate = 0, - }, - /* EC does not need in S0 */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 0, - .ec_rate = 0, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0, - }, - }, + .name = "Base Gyro", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_BMI160, + .type = MOTIONSENSE_TYPE_GYRO, + .location = MOTIONSENSE_LOC_BASE, + .drv = &bmi160_drv, + .mutex = &g_base_mutex, + .drv_data = &g_bmi160_data, + .addr = BMI160_ADDR0, + .default_range = 1000, /* dps */ + .rot_standard_ref = &base_standard_ref, + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, + }, + [LID_ALS] = { + .name = "Light", + .active_mask = SENSOR_ACTIVE_S0, + .chip = MOTIONSENSE_CHIP_BH1730, + .type = MOTIONSENSE_TYPE_LIGHT, + .location = MOTIONSENSE_LOC_LID, + .drv = &bh1730_drv, + .drv_data = &g_bh1730_data, + .addr = BH1730_I2C_ADDR, + .rot_standard_ref = NULL, + .default_range = 65535, + .min_frequency = 10, + .max_frequency = 10, + .config = { + [SENSOR_CONFIG_EC_S0] = { + .odr = 100000, + .ec_rate = 0, + }, + }, }, - [LID_ALS] = { - .name = "Light", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_BH1730, - .type = MOTIONSENSE_TYPE_LIGHT, - .location = MOTIONSENSE_LOC_LID, - .drv = &bh1730_drv, - .drv_data = &g_bh1730_data, - .addr = BH1730_I2C_ADDR, - .rot_standard_ref = NULL, - .default_range = 65535, - .min_frequency = 10, - .max_frequency = 10, - .config = { - /* AP: by default shutdown all sensors */ - [SENSOR_CONFIG_AP] = { - .odr = 0, - .ec_rate = 0, - }, - [SENSOR_CONFIG_EC_S0] = { - .odr = 100000, - .ec_rate = 0, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0, - }, - }, - }, }; #ifdef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT @@ -667,7 +608,7 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); /* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */ const struct motion_sensor_t *motion_als_sensors[] = { - &motion_sensors[LID_ALS], + &motion_sensors[LID_ALS], }; BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT); #endif /* HAS_TASK_MOTIONSENSE */ |