diff options
author | philipchen <philipchen@google.com> | 2017-01-24 14:51:03 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-07 03:02:56 -0700 |
commit | 859a33ff46c78bd47075c9fd57b88b88df593634 (patch) | |
tree | e955323b9ee3f90fe8b1bd1c8547995d8c96f0f8 | |
parent | 25fb7bb3e54b8e68d3e03119a521cfac0a6bb5cb (diff) | |
download | chrome-ec-859a33ff46c78bd47075c9fd57b88b88df593634.tar.gz |
scarlet: remove lid accel and add barometer
Remove lid accelerometer (kx022) driver and dependent code.
Add barometer (bmp280) driver.
BUG=chrome-os-partner:62207
BRANCH=gru
TEST=make BOARD=scarlet
TEST=manually test on gru
Change-Id: I521027b8877b9c45880090b9af736adc339edb2b
Reviewed-on: https://chromium-review.googlesource.com/431878
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524974
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
-rw-r--r-- | board/scarlet/board.c | 56 | ||||
-rw-r--r-- | board/scarlet/board.h | 21 |
2 files changed, 48 insertions, 29 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 1ef6989768..2886a563f0 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -14,11 +14,9 @@ #include "common.h" #include "console.h" #include "ec_commands.h" -#include "driver/accel_bma2x2.h" -#include "driver/accel_kionix.h" -#include "driver/accel_kx022.h" #include "driver/accelgyro_bmi160.h" #include "driver/charger/bd9995x.h" +#include "driver/baro_bmp280.h" #include "driver/tcpm/fusb302.h" #include "extpower.h" #include "gpio.h" @@ -415,12 +413,6 @@ const matrix_3x3_t base_standard_ref = { { 0, 0, FLOAT_TO_FP(-1)} }; -const matrix_3x3_t lid_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - struct bmp280_drv_data_t bmp280_drv_data; struct motion_sensor_t motion_sensors[] = { @@ -448,17 +440,17 @@ struct motion_sensor_t motion_sensors[] = { .odr = 0, .ec_rate = 0, }, - /* EC use accel for angle detection */ + /* Enable accel in S0 */ [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 100 * MSEC, }, - /* EC use accel for angle detection */ + /* Enable accel in S3 */ [SENSOR_CONFIG_EC_S3] = { .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 0, }, - /* Sensor off in S3/S5 */ + /* Sensor off in S5 */ [SENSOR_CONFIG_EC_S5] = { .odr = 0, .ec_rate = 0 @@ -484,10 +476,10 @@ struct motion_sensor_t motion_sensors[] = { .odr = 0, .ec_rate = 0, }, - /* EC does not need in S0 */ + /* Enable gyro in S0 */ [SENSOR_CONFIG_EC_S0] = { - .odr = 0, - .ec_rate = 0, + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S3] = { @@ -501,6 +493,40 @@ struct motion_sensor_t motion_sensors[] = { }, }, }, + [BASE_BARO] = { + .name = "Base Baro", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_BMP280, + .type = MOTIONSENSE_TYPE_BARO, + .location = MOTIONSENSE_LOC_BASE, + .drv = &bmp280_drv, + .drv_data = &bmp280_drv_data, + .port = I2C_PORT_BARO, + .addr = BMP280_I2C_ADDRESS1, + .default_range = 1 << 18, /* 1bit = 4 Pa, 16bit ~= 2600 hPa */ + .config = { + /* AP: by default shutdown all sensors */ + [SENSOR_CONFIG_AP] = { + .odr = 0, + .ec_rate = 0, + }, + /* Enable barometer in S0 */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + /* 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, + }, + }, + }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); #endif /* defined(HAS_TASK_MOTIONSENSE) */ diff --git a/board/scarlet/board.h b/board/scarlet/board.h index c955aff69c..c3922d1656 100644 --- a/board/scarlet/board.h +++ b/board/scarlet/board.h @@ -11,6 +11,7 @@ /* Optional modules */ #define CONFIG_ADC #define CONFIG_CHIPSET_RK3399 +#define CONFIG_CMD_ACCELS #define CONFIG_CMD_RTC #define CONFIG_HOSTCMD_RTC #define CONFIG_HOSTCMD_SPS @@ -83,25 +84,17 @@ #define CONFIG_UART_TX_BUF_SIZE 4096 /* Motion Sensors */ -#define CONFIG_ACCEL_BMA255 -#define CONFIG_ACCEL_KX022 #define CONFIG_ACCELGYRO_BMI160 #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(4) -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_INVALID_CHECK -#define CONFIG_LID_ANGLE_UPDATE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +#define CONFIG_BARO_BMP280 + /* FIFO size is in power of 2. */ #define CONFIG_ACCEL_FIFO 256 #define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) -/* - * Sensor internal FIFO is enabled for BMI160, but not for BMA255. - */ -#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL) -#define CONFIG_TABLET_MODE_SWITCH +/* Sensors without hardware FIFO are in forced mode. */ +#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << BASE_BARO) /* USB PD config */ #define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL @@ -180,7 +173,7 @@ #undef CONFIG_TASK_PROFILING #define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0 -#define I2C_PORT_ACCEL NPCX_I2C_PORT1 +#define I2C_PORT_BARO NPCX_I2C_PORT1 #define I2C_PORT_CHARGER NPCX_I2C_PORT2 #define I2C_PORT_BATTERY NPCX_I2C_PORT3 #define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY @@ -230,7 +223,7 @@ enum power_signal { enum sensor_id { BASE_ACCEL = 0, BASE_GYRO, - LID_ACCEL, + BASE_BARO, }; #include "gpio_signal.h" |