diff options
author | Bhanu Prakash Maiya <bhanumaiya@google.com> | 2021-08-13 15:48:33 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-14 01:08:00 +0000 |
commit | 892a77f7133c7b7df3922964466588eb1394ff16 (patch) | |
tree | 732ee2cd71ebaa1bd8b6a60177853b3f898350e1 | |
parent | df82a09c409bf3ea3658b7e0fafae3a6fe6d3cd6 (diff) | |
download | chrome-ec-892a77f7133c7b7df3922964466588eb1394ff16.tar.gz |
nipperkin: Remove motion sensor and ANX retimer code
BUG=b:194031783
BRANCH=None
TEST=make BOARD=nipperkin
Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
Change-Id: I5dcf1bd231e472e99761ff5a24ea8de7dc21f069
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095010
Commit-Queue: Diana Z <dzigterman@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | board/nipperkin/board.c | 222 | ||||
-rw-r--r-- | board/nipperkin/board.h | 25 | ||||
-rw-r--r-- | board/nipperkin/board_fw_config.c | 16 | ||||
-rw-r--r-- | board/nipperkin/board_fw_config.h | 1 | ||||
-rw-r--r-- | board/nipperkin/ec.tasklist | 1 | ||||
-rw-r--r-- | board/nipperkin/gpio.inc | 2 |
6 files changed, 3 insertions, 264 deletions
diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c index 54cc3a61a5..3a76bb3175 100644 --- a/board/nipperkin/board.c +++ b/board/nipperkin/board.c @@ -8,12 +8,9 @@ #include "base_fw_config.h" #include "board_fw_config.h" #include "button.h" +#include "chipset.h" #include "common.h" #include "cros_board_info.h" -#include "driver/accelgyro_bmi_common.h" -#include "driver/accelgyro_bmi160.h" -#include "driver/accelgyro_bmi323.h" -#include "driver/accel_bma422.h" #include "driver/retimer/ps8811.h" #include "driver/retimer/ps8818.h" #include "extpower.h" @@ -31,28 +28,6 @@ #include "gpio_list.h" /* Must come after other header files. */ -/* Motion sensor mutex */ -static struct mutex g_lid_mutex; -static struct mutex g_base_mutex; - -/* Motion sensor private data */ -static struct bmi_drv_data_t g_bmi160_data; -static struct bmi3xx_drv_data g_bmi323_data; -static struct accelgyro_saved_data_t g_bma422_data; - -/* Matrix to rotate accelrator into standard reference frame */ -const mat33_fp_t base_standard_ref = { - { FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; - -const mat33_fp_t lid_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; - /* * We have total 30 pins for keyboard connecter {-1, -1} mean * the N/A pin that don't consider it and reserve index 0 area @@ -70,150 +45,9 @@ const int keyboard_factory_scan_pins[][2] = { const int keyboard_factory_scan_pins_used = ARRAY_SIZE(keyboard_factory_scan_pins); -struct motion_sensor_t motion_sensors[] = { - [BASE_ACCEL] = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI323, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi3xx_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi323_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM, - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_ACCEL_MAX_FREQ, - .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 12500 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor on in S3 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 12500 | ROUND_UP_FLAG, - .ec_rate = 0, - }, - }, - }, - [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMA422, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &bma4_accel_drv, - .mutex = &g_lid_mutex, - .drv_data = &g_bma422_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY, - .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMA4_ACCEL_MIN_FREQ, - .max_frequency = BMA4_ACCEL_MAX_FREQ, - .default_range = 2, /* g, enough for laptop. */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 12500 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor on in S3 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 12500 | ROUND_UP_FLAG, - .ec_rate = 0, - }, - }, - }, - [BASE_GYRO] = { - .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI323, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi3xx_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi323_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, - }, -}; -unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -struct motion_sensor_t bmi160_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_SENSOR, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_ACCEL_MAX_FREQ, - .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .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 = 0, - }, - }, -}; - -struct motion_sensor_t bmi160_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, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, -}; - __override enum ec_error_list board_a1_ps8811_retimer_init(const struct usb_mux *me) { - /* Set channel A output swing */ - RETURN_ERROR(ps8811_i2c_field_update( - me, PS8811_REG_PAGE1, PS8811_REG1_USB_CHAN_A_SWING, - PS8811_CHAN_A_SWING_MASK, 0x2 << PS8811_CHAN_A_SWING_SHIFT)); - - /* Set channel B output swing */ - RETURN_ERROR(ps8811_i2c_field_update( - me, PS8811_REG_PAGE1, PS8811_REG1_USB_CHAN_B_SWING, - PS8811_CHAN_B_SWING_MASK, 0x2 << PS8811_CHAN_B_SWING_SHIFT)); - - /* Set channel B de-emphasis to -6dB and pre-shoot to 1.5 dB */ - RETURN_ERROR(ps8811_i2c_field_update( - me, PS8811_REG_PAGE1, PS8811_REG1_USB_CHAN_B_DE_PS_LSB, - PS8811_CHAN_B_DE_PS_LSB_MASK, PS8811_CHAN_B_DE_6_PS_1_5_LSB)); - - RETURN_ERROR(ps8811_i2c_field_update( - me, PS8811_REG_PAGE1, PS8811_REG1_USB_CHAN_B_DE_PS_MSB, - PS8811_CHAN_B_DE_PS_MSB_MASK, PS8811_CHAN_B_DE_6_PS_1_5_MSB)); - return EC_SUCCESS; } @@ -293,62 +127,8 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me, return rv; } -/* - * ANX7491(A1) and ANX7451(C1) are on the same i2c bus. Both default - * to 0x29 for the USB i2c address. This moves ANX7451(C1) USB i2c - * address to 0x2A. ANX7491(A1) will stay at the default 0x29. - */ -uint16_t board_anx7451_get_usb_i2c_addr(const struct usb_mux *me) -{ - ASSERT(me->usb_port == USBC_PORT_C1); - return 0x2a; -} - -/* - * Base Gyro Sensor dynamic configuration - */ -static int base_gyro_config; - -static void board_update_motion_sensor_config(void) -{ - if (board_is_convertible()) { - if (get_board_version() == 1) { - motion_sensors[BASE_ACCEL] = bmi160_base_accel; - motion_sensors[BASE_GYRO] = bmi160_base_gyro; - base_gyro_config = BASE_GYRO_BMI160; - ccprints("BASE GYRO is BMI160"); - } else { - base_gyro_config = BASE_GYRO_BMI323; - ccprints("BASE GYRO is BMI323"); - } - - motion_sensor_count = ARRAY_SIZE(motion_sensors); - /* Enable Base Accel and Gyro interrupt */ - gpio_enable_interrupt(GPIO_6AXIS_INT_L); - } else { - motion_sensor_count = 0; - gmr_tablet_switch_disable(); - /* Base accel is not stuffed, don't allow line to float */ - gpio_set_flags(GPIO_6AXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN); - } -} - -void motion_interrupt(enum gpio_signal signal) -{ - switch (base_gyro_config) { - case BASE_GYRO_BMI160: - bmi160_interrupt(signal); - break; - case BASE_GYRO_BMI323: - default: - bmi3xx_interrupt(signal); - break; - } -} - static void board_init(void) { - board_update_motion_sensor_config(); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/nipperkin/board.h b/board/nipperkin/board.h index dc09530e8e..542324b647 100644 --- a/board/nipperkin/board.h +++ b/board/nipperkin/board.h @@ -16,26 +16,10 @@ /* Keyboard features */ #define CONFIG_KEYBOARD_FACTORY_TEST -/* Sensors */ -#define CONFIG_ACCELGYRO_BMI160 -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_ACCELGYRO_BMI3XX -#define CONFIG_ACCELGYRO_BMI3XX_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_ACCEL_INTERRUPTS -#define CONFIG_ACCEL_BMA4XX - -#define I2C_PORT_ACCEL I2C_PORT_SENSOR - /* EC console commands */ -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO #define CONFIG_CMD_BUTTON /* USB Type C and USB PD defines */ -#define CONFIG_USB_MUX_ANX7451 -#define CONFIG_USBC_RETIMER_ANX7451 /* USB Type A Features */ @@ -54,9 +38,6 @@ #include "gpio_signal.h" #include "registers.h" -/* Motion sensor interrupt */ -void motion_interrupt(enum gpio_signal signal); - /* Battery Types */ enum battery_type { BATTERY_AEC, @@ -65,12 +46,6 @@ enum battery_type { BATTERY_TYPE_COUNT, }; -enum base_accelgyro_type { - BASE_GYRO_NONE = 0, - BASE_GYRO_BMI160 = 1, - BASE_GYRO_BMI323 = 2, -}; - #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ diff --git a/board/nipperkin/board_fw_config.c b/board/nipperkin/board_fw_config.c index c919d82851..82b291e639 100644 --- a/board/nipperkin/board_fw_config.c +++ b/board/nipperkin/board_fw_config.c @@ -21,22 +21,10 @@ bool board_has_kblight(void) enum board_usb_c1_mux board_get_usb_c1_mux(void) { - int usb_db = get_fw_config_field(FW_CONFIG_USB_DB_OFFSET, - FW_CONFIG_USB_DB_WIDTH); - if (usb_db == FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818) - return USB_C1_MUX_PS8818; - if (usb_db == FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451) - return USB_C1_MUX_ANX7451; - return USB_C1_MUX_UNKNOWN; + return USB_C1_MUX_PS8818; }; enum board_usb_a1_retimer board_get_usb_a1_retimer(void) { - int usb_db = get_fw_config_field(FW_CONFIG_USB_DB_OFFSET, - FW_CONFIG_USB_DB_WIDTH); - if (usb_db == FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818) - return USB_A1_RETIMER_PS8811; - if (usb_db == FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451) - return USB_A1_RETIMER_ANX7491; - return USB_A1_RETIMER_UNKNOWN; + return USB_A1_RETIMER_PS8811; }; diff --git a/board/nipperkin/board_fw_config.h b/board/nipperkin/board_fw_config.h index 1de417d77a..1dbb510965 100644 --- a/board/nipperkin/board_fw_config.h +++ b/board/nipperkin/board_fw_config.h @@ -16,7 +16,6 @@ #define FW_CONFIG_USB_DB_OFFSET 0 #define FW_CONFIG_USB_DB_WIDTH 2 #define FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818 0 -#define FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451 1 /* * Form Factor (1 bits) diff --git a/board/nipperkin/ec.tasklist b/board/nipperkin/ec.tasklist index 94ff657db3..ccdff9847c 100644 --- a/board/nipperkin/ec.tasklist +++ b/board/nipperkin/ec.tasklist @@ -13,7 +13,6 @@ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/nipperkin/gpio.inc b/board/nipperkin/gpio.inc index c2db7a2a68..6ce23fec16 100644 --- a/board/nipperkin/gpio.inc +++ b/board/nipperkin/gpio.inc @@ -9,5 +9,3 @@ #include "base_gpio.inc" -GPIO_INT(6AXIS_INT_L, PIN(A, 0), GPIO_INT_FALLING | GPIO_PULL_UP, motion_interrupt) /* 6 Axis IMU */ -GPIO_INT(TABLET_MODE, PIN(C, 1), GPIO_INT_BOTH, gmr_tablet_switch_isr) /* 360 Tablet Mode */ |