diff options
author | Ryan Zhang <Ryan.Zhang@quanta.corp-partner.google.com> | 2017-03-13 19:33:31 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2017-03-15 00:31:31 +0000 |
commit | 643276c51bb8c94ebe41ff446575ef298fa6d9a4 (patch) | |
tree | 8397c47b10bd4cf7c2cb48e32cec8ab1d70059ea | |
parent | 84330af47220cbc82537fc8cdae924531d3f2961 (diff) | |
download | chrome-ec-643276c51bb8c94ebe41ff446575ef298fa6d9a4.tar.gz |
Sand:remove unsupport functions
+ remove Gyro related config
+ remove Accel related config
BUG=None
BRANCH=firmware-reef-9042.B
TEST=`make -j BOARD=reef`, system can power up.
Change-Id: I36a0090f8ea1c2f5b0843001be5d06669b25da92
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/454419
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
-rw-r--r-- | board/sand/board.c | 180 | ||||
-rw-r--r-- | board/sand/board.h | 59 | ||||
-rw-r--r-- | board/sand/ec.tasklist | 1 | ||||
-rw-r--r-- | board/sand/gpio.inc | 8 |
4 files changed, 1 insertions, 247 deletions
diff --git a/board/sand/board.c b/board/sand/board.c index 7cff166ac4..a2b0ad7fa4 100644 --- a/board/sand/board.c +++ b/board/sand/board.c @@ -14,10 +14,6 @@ #include "charger.h" #include "chipset.h" #include "console.h" -#include "driver/accel_kionix.h" -#include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" -#include "driver/baro_bmp280.h" #include "driver/charger/bd9995x.h" #include "driver/tcpm/anx74xx.h" #include "driver/tcpm/ps8751.h" @@ -29,11 +25,7 @@ #include "host_command.h" #include "i2c.h" #include "keyboard_scan.h" -#include "lid_angle.h" #include "lid_switch.h" -#include "math_util.h" -#include "motion_sense.h" -#include "motion_lid.h" #include "power.h" #include "power_button.h" #include "pwm.h" @@ -138,10 +130,6 @@ const struct i2c_port_t i2c_ports[] = { GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA}, {"tcpc1", NPCX_I2C_PORT0_1, 400, GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA}, - {"accelgyro", I2C_PORT_GYRO, 400, - GPIO_EC_I2C_GYRO_SCL, GPIO_EC_I2C_GYRO_SDA}, - {"sensors", NPCX_I2C_PORT2, 400, - GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA}, {"batt", NPCX_I2C_PORT3, 100, GPIO_EC_I2C_POWER_SCL, GPIO_EC_I2C_POWER_SDA}, }; @@ -167,34 +155,6 @@ struct i2c_stress_test i2c_stress_tests[] = { }, #endif -/* NPCX_I2C_PORT1 */ -#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL - { - .port = I2C_PORT_GYRO, - .addr = BMI160_ADDR0, - .i2c_test = &bmi160_i2c_stress_test_dev, - }, -#endif - -/* NPCX_I2C_PORT2 */ -#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL - { - .port = I2C_PORT_BARO, - .addr = BMP280_I2C_ADDRESS1, - .i2c_test = &bmp280_i2c_stress_test_dev, - }, - { - .port = I2C_PORT_LID_ACCEL, - .addr = KX022_ADDR1, - .i2c_test = &kionix_i2c_stress_test_dev, - }, -#endif -#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS - { - .i2c_test = &opt3001_i2c_stress_test_dev, - }, -#endif - /* NPCX_I2C_PORT3 */ #ifdef CONFIG_CMD_I2C_STRESS_TEST_BATTERY { @@ -466,9 +426,6 @@ static void board_init(void) { /* Enable charger interrupts */ gpio_enable_interrupt(GPIO_CHARGER_INT_L); - - /* Enable Gyro interrupts */ - gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); } /* PP3300 needs to be enabled before TCPC init hooks */ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_FIRST); @@ -694,143 +651,6 @@ void board_hibernate_late(void) gpio_set_flags_by_mask(0x1, 0x80, GPIO_INPUT | GPIO_PULL_DOWN); } -/* Motion sensors */ -/* Mutexes */ -static struct mutex g_base_mutex; - -/* Matrix to rotate accelrator into standard reference frame */ -const matrix_3x3_t base_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - -const matrix_3x3_t mag_standard_ref = { - { FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; - -struct kionix_accel_data g_kx022_data; -struct bmi160_drv_data_t g_bmi160_data; -struct bmp280_drv_data_t bmp280_drv_data; - - -/* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Sand */ -struct motion_sensor_t motion_sensors[] = { - [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, - .port = I2C_PORT_GYRO, - .addr = BMI160_ADDR0, - .rot_standard_ref = &base_standard_ref, - .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, - }, - /* Sensor on for lid angle detection */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0 - }, - }, - }, - - [BASE_GYRO] = { - .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_BMI160, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi160_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi160_data, - .port = I2C_PORT_GYRO, - .addr = BMI160_ADDR0, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_standard_ref, - .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, - }, - }, - }, - - [BASE_MAG] = { - .name = "Base Mag", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_BMI160, - .type = MOTIONSENSE_TYPE_MAG, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi160_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi160_data, - .port = I2C_PORT_GYRO, - .addr = BMI160_ADDR0, - .default_range = 1 << 11, /* 16LSB / uT, fixed */ - .rot_standard_ref = &mag_standard_ref, - .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, - }, - }, - }, -}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - void board_hibernate(void) { /* diff --git a/board/sand/board.h b/board/sand/board.h index 3d94333d42..2232a519c2 100644 --- a/board/sand/board.h +++ b/board/sand/board.h @@ -16,10 +16,7 @@ #undef CONFIG_HOSTCMD_DEBUG_MODE #define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF - /* EC console commands */ -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO #define CONFIG_CMD_BATT_MFG_ACCESS #define CONFIG_CMD_CHARGER_ADC_AMON_BMON #define CONFIG_CHARGER_SENSE_RESISTOR 10 @@ -143,19 +140,6 @@ #define CONFIG_WLAN_POWER_ACTIVE_LOW #define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER -/* - * During shutdown sequence TPS65094x PMIC turns off the sensor rails - * asynchronously to the EC. If we access the sensors when the sensor power - * rails are off we get I2C errors. To avoid this issue, defer switching - * the sensors rate if in S3. By the time deferred function is serviced if - * the chipset is in S5 we can back out from switching the sensor rate. - * - * Time taken by V1P8U rail to go down from S3 is 30ms to 60ms hence defer - * the sensor switching after 60ms. - */ -#undef CONFIG_MOTION_SENSE_SUSPEND_DELAY_US -#define CONFIG_MOTION_SENSE_SUSPEND_DELAY_US (MSEC * 60) - #define CONFIG_FLASH_SIZE 524288 #define CONFIG_SPI_FLASH_REGS #define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */ @@ -175,34 +159,12 @@ #define NPCX_TACH_SEL2 0 /* 0:GPIO40/A4 1:GPIO93/D3 as TACH */ /* I2C ports */ -#define I2C_PORT_GYRO NPCX_I2C_PORT1 #define I2C_PORT_BATTERY NPCX_I2C_PORT3 #define I2C_PORT_CHARGER NPCX_I2C_PORT3 -/* Accelerometer and Gyroscope are the same device. */ -#define I2C_PORT_ACCEL I2C_PORT_GYRO /* Sensors */ #define CONFIG_MKBP_EVENT #define CONFIG_MKBP_USE_HOST_EVENT -#define CONFIG_ACCELGYRO_BMI160 -#define CONFIG_ACCEL_INTERRUPTS -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(4) -#define CONFIG_MAG_BMI160_BMM150 -#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */ -#define CONFIG_MAG_CALIBRATE -#define CONFIG_ACCEL_KX022 -#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1 -#define CONFIG_BARO_BMP280 -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL - -/* FIFO size is in power of 2. */ -#define CONFIG_ACCEL_FIFO 1024 - -/* Depends on how fast the AP boots and typical ODRs */ -#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) - #ifndef __ASSEMBLER__ @@ -244,27 +206,6 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -/* Light sensors */ -enum als_id { - ALS_OPT3001 = 0, - - ALS_COUNT -}; - -/* - * 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 { - LID_ACCEL = 0, - BASE_ACCEL, - BASE_GYRO, - BASE_MAG, - BASE_BARO, -}; - enum sand_board_version { BOARD_VERSION_UNKNOWN = -1, BOARD_VERSION_1, diff --git a/board/sand/ec.tasklist b/board/sand/ec.tasklist index 032ef34171..349bce0c47 100644 --- a/board/sand/ec.tasklist +++ b/board/sand/ec.tasklist @@ -25,7 +25,6 @@ TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG, usb_charger_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ TASK_NOTEST(PDCMD, pd_command_task, NULL, TASK_STACK_SIZE) \ diff --git a/board/sand/gpio.inc b/board/sand/gpio.inc index 32d1a3cde9..3b1ea74da6 100644 --- a/board/sand/gpio.inc +++ b/board/sand/gpio.inc @@ -32,14 +32,9 @@ GPIO_INT(LID_OPEN, PIN(6, 7), GPIO_INT_BOTH, lid_interrupt) GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH | GPIO_SEL_1P8V, switch_interrupt) /* EC_WP_ODL */ -GPIO_INT(BASE_SIXAXIS_INT_L, PIN(9, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V, - bmi160_interrupt) - /* I2C GPIOs will be set to alt. function later. */ GPIO(EC_I2C_GYRO_SDA, PIN(8, 7), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(EC_I2C_GYRO_SCL, PIN(9, 0), GPIO_INPUT | GPIO_SEL_1P8V) -GPIO(EC_I2C_SENSOR_SDA, PIN(9, 1), GPIO_INPUT | GPIO_SEL_1P8V) -GPIO(EC_I2C_SENSOR_SCL, PIN(9, 2), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(EC_I2C_USB_C0_PD_SDA, PIN(B, 4), GPIO_INPUT) GPIO(EC_I2C_USB_C0_PD_SCL, PIN(B, 5), GPIO_INPUT) GPIO(EC_I2C_USB_C1_PD_SDA, PIN(B, 2), GPIO_INPUT) @@ -71,6 +66,7 @@ GPIO(EC_BRD_ID_EN_ODL, PIN(3, 5), GPIO_INPUT) GPIO(NC_36, PIN(3, 6), GPIO_INPUT | GPIO_PULL_UP) /* NC */ GPIO(NC_82, PIN(8, 2), GPIO_INPUT | GPIO_PULL_UP) /* NC */ GPIO(NC_83, PIN(8, 3), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(NC_93, PIN(9, 3), GPIO_INPUT | GPIO_PULL_UP) /* NC */ GPIO(NC_C7, PIN(C, 7), GPIO_INPUT | GPIO_PULL_UP) /* NC */ GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT) @@ -156,8 +152,6 @@ GPIO(KBD_KSO2, PIN(1, 7), GPIO_KB_OUTPUT_COL2) ALTERNATE(PIN(4, 4), 6, MODULE_ADC, 0) /* TEMP_SENSOR_AMB (FIXME: alt function 6?) */ ALTERNATE(PIN(4, 5), 6, MODULE_ADC, 0) /* TEMP_SENSOR_CHARGER (FIXME: alt function?) */ -ALTERNATE(PIN_MASK(8, 0x80), 1, MODULE_I2C, 0) /* GPIO87 for EC_I2C_GYRO_SDA */ -ALTERNATE(PIN_MASK(9, 0x01), 1, MODULE_I2C, 0) /* GPIO90 for EC_I2C_GYRO_SCL */ ALTERNATE(PIN_MASK(B, 0x30), 1, MODULE_I2C, 0) /* GPIOB5-B4 for EC_I2C_USB_C0_PD_SDA/SCL */ ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* GPOPB3-B2 for EC_I2C_USB_C1_PD_SDA/SCL */ ALTERNATE(PIN_MASK(D, 0x03), 1, MODULE_I2C, 0) /* GPIOD1-D0 for EC_I2C_POWER_SDA/SCL */ |