diff options
author | Sue Chen <sue.chen@quanta.corp-partner.google.com> | 2021-04-01 16:27:01 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-06 08:08:16 +0000 |
commit | b6087ec2b65ab1d48b0084fe61e025115fd5dbd6 (patch) | |
tree | 77bc2df07d7aee67e4dc6cad2de9ddc59d25fb4a /board | |
parent | ec49b902e78db1cb4b6e1462f21bffb49507c624 (diff) | |
download | chrome-ec-b6087ec2b65ab1d48b0084fe61e025115fd5dbd6.tar.gz |
Cozmo: Remove motion sensors
For Cozmo is clamshell, it doesn't have motion sensors.
BUG=b:183454206
BRANCH=icarus
TEST=make BOARD=icarus
Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
Change-Id: I3da637bdc5a5ea4a11e1b715fdd8bff030e388b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799331
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/icarus/board.c | 188 | ||||
-rw-r--r-- | board/icarus/board.h | 23 | ||||
-rw-r--r-- | board/icarus/ec.tasklist | 1 | ||||
-rw-r--r-- | board/icarus/gpio.inc | 3 |
4 files changed, 4 insertions, 211 deletions
diff --git a/board/icarus/board.c b/board/icarus/board.c index eea38ef5ee..defdfd1187 100644 --- a/board/icarus/board.c +++ b/board/icarus/board.c @@ -14,10 +14,6 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi_common.h" -#include "driver/accelgyro_icm_common.h" -#include "driver/accelgyro_icm426xx.h" #include "driver/battery/max17055.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" @@ -232,190 +228,6 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); -/* Motion sensors */ -/* Mutexes */ -static struct mutex g_lid_mutex; -static struct mutex g_base_mutex; - -/* Rotation matrixes */ -static const mat33_fp_t base_bmi160_ref = { - {FLOAT_TO_FP(1), 0, 0}, - {0, FLOAT_TO_FP(1), 0}, - {0, 0, FLOAT_TO_FP(1)} -}; - -static const mat33_fp_t base_icm426xx_ref = { - {0, FLOAT_TO_FP(-1), 0}, - {FLOAT_TO_FP(1), 0, 0}, - {0, 0, FLOAT_TO_FP(1)} -}; - -/* sensor private data */ -static struct kionix_accel_data g_kx022_data; -static struct bmi_drv_data_t g_bmi160_data; -static struct icm_drv_data_t g_icm426xx_data; - -enum base_accelgyro_type { - BASE_GYRO_NONE = 0, - BASE_GYRO_BMI160 = 1, - BASE_GYRO_ICM426XX = 2, -}; - -struct motion_sensor_t motion_sensors[] = { - [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .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_SENSORS, - .i2c_spi_addr_flags = KX022_ADDR1_FLAGS, - .rot_standard_ref = NULL, /* Identity matrix. */ - .default_range = 2, /* g, enough to calculate lid angle. */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - /* Sensor on for lid angle detection */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - }, - }, - /* - * Note: bmi160: supports accelerometer and gyro sensor - * Requirement: accelerometer sensor must init before gyro sensor - * DO NOT change the order of the following table. - */ - [BASE_ACCEL] = { - .name = "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_SENSORS, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .rot_standard_ref = &base_bmi160_ref, - .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/ - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_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 for angle detection */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - }, - }, - [BASE_GYRO] = { - .name = "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, - .port = I2C_PORT_SENSORS, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_bmi160_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, - }, -}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -struct motion_sensor_t icm426xx_base_accel = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_ICM426XX, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &icm426xx_drv, - .mutex = &g_base_mutex, - .drv_data = &g_icm426xx_data, - .port = I2C_PORT_SENSORS, - .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS, - .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/ - .rot_standard_ref = &base_icm426xx_ref, - .min_frequency = ICM426XX_ACCEL_MIN_FREQ, - .max_frequency = ICM426XX_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - }, -}; - -struct motion_sensor_t icm426xx_base_gyro = { - .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_ICM426XX, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &icm426xx_drv, - .mutex = &g_base_mutex, - .drv_data = &g_icm426xx_data, - .port = I2C_PORT_SENSORS, - .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_icm426xx_ref, - .min_frequency = ICM426XX_GYRO_MIN_FREQ, - .max_frequency = ICM426XX_GYRO_MAX_FREQ, -}; - -static int base_accelgyro_config; - -void motion_interrupt(enum gpio_signal signal) -{ - switch (base_accelgyro_config) { - case BASE_GYRO_ICM426XX: - icm426xx_interrupt(signal); - break; - case BASE_GYRO_BMI160: - default: - bmi160_interrupt(signal); - break; - } -} - -static void board_detect_motionsensor(void) -{ - int val; - /* Check base accelgyro chip */ - if (base_accelgyro_config != BASE_GYRO_NONE) - return; - - icm_read8(&icm426xx_base_accel, ICM426XX_REG_WHO_AM_I, &val); - if (val == ICM426XX_CHIP_ICM40608) { - motion_sensors[BASE_ACCEL] = icm426xx_base_accel; - motion_sensors[BASE_GYRO] = icm426xx_base_gyro; - } - base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) - ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160; - CPRINTS("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608) - ? "ICM40608" : "BMI160"); -} -DECLARE_HOOK(HOOK_INIT, board_detect_motionsensor, HOOK_PRIO_DEFAULT); - /* Vconn control for integrated ITE TCPC */ void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled) { diff --git a/board/icarus/board.h b/board/icarus/board.h index e4644d97c2..bf90e35ff7 100644 --- a/board/icarus/board.h +++ b/board/icarus/board.h @@ -45,26 +45,9 @@ #define CONFIG_USB_MUX_IT5205 -/* Motion Sensors */ -#define CONFIG_ACCEL_KX022 /* Lid accel */ -#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ -#define CONFIG_ACCEL_INTERRUPTS -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) - -/* ICM426XX Base accel/gyro */ -#define CONFIG_ACCELGYRO_ICM426XX -#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) - -#define CONFIG_ALS -#define CONFIG_CMD_ACCEL_INFO - -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL - -#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) +#undef CONFIG_ACCEL_FIFO +#undef CONFIG_ACCEL_FIFO_SIZE +#undef CONFIG_ACCEL_FIFO_THRES /* I2C ports */ #define I2C_PORT_BC12 IT83XX_I2C_CH_C diff --git a/board/icarus/ec.tasklist b/board/icarus/ec.tasklist index 8d4f451072..e8ad538bc2 100644 --- a/board/icarus/ec.tasklist +++ b/board/icarus/ec.tasklist @@ -11,7 +11,6 @@ TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/icarus/gpio.inc b/board/icarus/gpio.inc index e2fe2bb448..cf380a0c26 100644 --- a/board/icarus/gpio.inc +++ b/board/icarus/gpio.inc @@ -19,8 +19,6 @@ GPIO_INT(PMIC_EC_RESETB, PIN(F, 3), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL power_signal_interrupt) GPIO_INT(WARM_RESET_REQ, PIN(D, 3), GPIO_INT_RISING | GPIO_PULL_DOWN | GPIO_SEL_1P8V, chipset_reset_request_interrupt) -GPIO_INT(ACCEL_INT_ODL, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, - motion_interrupt) GPIO_INT_RO(BOOTBLOCK_EN_L, PIN(J, 1), GPIO_INT_RISING | GPIO_SEL_1P8V, emmc_ap_jump_to_bl) GPIO_INT(SPI0_CS, PIN(M, 5), GPIO_INT_FALLING, @@ -36,6 +34,7 @@ GPIO_INT(AP_EC_WATCHDOG_L, PIN(C, 7), GPIO_INT_FALLING | GPIO_SEL_1P8V, GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_FALLING, uart_deepsleep_interrupt) /* UART_DEBUG_TX_EC_RX */ /* Unimplemented interrupts */ +GPIO(ACCEL_INT_ODL, PIN(J, 2), GPIO_INPUT) GPIO(TABLET_MODE_L, PIN(J, 7), GPIO_INPUT) GPIO(VOLUME_DOWN_L, PIN(D, 5), GPIO_INPUT) GPIO(VOLUME_UP_L, PIN(D, 6), GPIO_INPUT) |