diff options
author | Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> | 2021-06-15 14:19:29 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-22 01:38:46 +0000 |
commit | 6c57ffb1cdf0c8b2ce618ca35ce2d36bbac1ad58 (patch) | |
tree | ea54982325befdcbf6263b4f94ed080c39c79ba0 /board/chronicler | |
parent | 52d234a3451310ce1f67e6d75cc3e39736c1c8ab (diff) | |
download | chrome-ec-6c57ffb1cdf0c8b2ce618ca35ce2d36bbac1ad58.tar.gz |
Chronicler: Remove unused sensors
This commit remove sensors and tablet mode, since Chronicler doesn't
support that.
BUG=b:191064600
BRANCH=volteer
TEST=Verified boot without sensors initial.
Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Change-Id: Icecae77ba5897ba08a21417c731301b48ac26230
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2962196
Reviewed-by: Raymond Wong <wongraymond@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board/chronicler')
-rw-r--r-- | board/chronicler/board.c | 11 | ||||
-rw-r--r-- | board/chronicler/board.h | 42 | ||||
-rw-r--r-- | board/chronicler/build.mk | 1 | ||||
-rw-r--r-- | board/chronicler/ec.tasklist | 1 | ||||
-rw-r--r-- | board/chronicler/gpio.inc | 25 | ||||
-rw-r--r-- | board/chronicler/sensors.c | 244 |
6 files changed, 13 insertions, 311 deletions
diff --git a/board/chronicler/board.c b/board/chronicler/board.c index 78209ce7be..2021a21726 100644 --- a/board/chronicler/board.c +++ b/board/chronicler/board.c @@ -9,9 +9,6 @@ #include "common.h" #include "accelgyro.h" #include "cbi_ec_fw_config.h" -#include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi260.h" -#include "driver/als_tcs3400.h" #include "driver/retimer/bb_retimer.h" #include "driver/sync.h" #include "driver/tcpm/ps8xxx.h" @@ -28,7 +25,6 @@ #include "switch.h" #include "system.h" #include "task.h" -#include "tablet_mode.h" #include "throttle_ap.h" #include "uart.h" #include "usb_pd.h" @@ -137,13 +133,6 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { { - .name = "sensor", - .port = I2C_PORT_SENSOR, - .kbps = 400, - .scl = GPIO_EC_I2C0_SENSOR_SCL, - .sda = GPIO_EC_I2C0_SENSOR_SDA, - }, - { .name = "usb_c0", .port = I2C_PORT_USB_C0, .kbps = 1000, diff --git a/board/chronicler/board.h b/board/chronicler/board.h index c8fc4b464d..4aef940684 100644 --- a/board/chronicler/board.h +++ b/board/chronicler/board.h @@ -37,29 +37,10 @@ /* Keyboard features */ /* Sensors */ -/* BMA253 accelerometer in base */ -#define CONFIG_ACCEL_BMA255 - -/* BMI260 accel/gyro in base */ -#define CONFIG_ACCELGYRO_BMI260 -#define CONFIG_ACCELGYRO_BMI260_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) - -/* TCS3400 ALS */ -#define CONFIG_ALS -#define ALS_COUNT 1 -#define CONFIG_ALS_TCS3400 -#define CONFIG_ALS_TCS3400_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS) - -/* Sensors without hardware FIFO are in forced mode */ -#define CONFIG_ACCEL_FORCE_MODE_MASK \ - (BIT(LID_ACCEL) | BIT(CLEAR_ALS)) - -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_UPDATE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +#undef CONFIG_TABLET_MODE +#undef CONFIG_GMR_TABLET_MODE +#undef CONFIG_ACCEL_FIFO +#undef CONFIG_ACCEL_FIFO_SIZE /* USB Type C and USB PD defines */ #define CONFIG_USB_PD_PORT_MAX_COUNT 2 @@ -95,6 +76,7 @@ /* BC 1.2 */ /* Volume Button feature */ +#undef CONFIG_VOLUME_BUTTONS /* Fan features */ @@ -131,14 +113,9 @@ #define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL #define GPIO_WP_L GPIO_EC_WP_L #define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL -#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL -#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL -#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L /* I2C Bus Configuration */ #define CONFIG_I2C -#define I2C_PORT_ACCEL I2C_PORT_SENSOR -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 #define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 #define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0 #define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0 @@ -177,15 +154,6 @@ enum pwm_channel { PWM_CH_COUNT }; -enum sensor_id { - LID_ACCEL = 0, - BASE_ACCEL, - BASE_GYRO, - CLEAR_ALS, - RGB_ALS, - SENSOR_COUNT, -}; - void board_reset_pd_mcu(void); #ifdef CONFIG_KEYBOARD_FACTORY_TEST diff --git a/board/chronicler/build.mk b/board/chronicler/build.mk index 7bcf78ecad..c0daa31eaa 100644 --- a/board/chronicler/build.mk +++ b/board/chronicler/build.mk @@ -16,5 +16,4 @@ board-y+=battery.o board-y+=cbi.o board-y+=led.o board-y+=keyboard.o -board-y+=sensors.o board-y+=usbc_config.o diff --git a/board/chronicler/ec.tasklist b/board/chronicler/ec.tasklist index e76bd368eb..c7a977f0ff 100644 --- a/board/chronicler/ec.tasklist +++ b/board/chronicler/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, 0, 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(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/chronicler/gpio.inc b/board/chronicler/gpio.inc index 39181828c6..dc00e3eddf 100644 --- a/board/chronicler/gpio.inc +++ b/board/chronicler/gpio.inc @@ -24,16 +24,6 @@ GPIO_INT(PG_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(PG_EC_DSW_PWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(PG_EC_ALL_SYS_PWRGD, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt) -/* Sensor Interrupts */ -GPIO_INT(EC_IMU_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi260_interrupt) -GPIO_INT(EC_ALS_RGB_INT_L, PIN(D, 4), GPIO_INT_FALLING, tcs3400_interrupt) -GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) -/* - * Lid g-sensor interrupt unused on Chronicler, configure as regular input for - * power saving. - */ -GPIO(EC_ACCEL_INT, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP) - /* USB-C interrupts */ GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_BOTH, tcpc_alert_event) GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_BOTH, tcpc_alert_event) @@ -46,10 +36,6 @@ GPIO_INT(USB_C1_MIX_INT_ODL, PIN(0, 3), GPIO_INT_BOTH, bc12_interrupt) /* HDMI interrupts */ -/* Volume button interrupts */ -GPIO_INT(EC_VOLDN_BTN_ODL, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) -GPIO_INT(EC_VOLUP_BTN_ODL, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) - /* Power Sequencing Signals */ GPIO(EN_PP3300_A, PIN(A, 3), GPIO_OUT_LOW) GPIO(EN_PP5000_A, PIN(A, 4), GPIO_OUT_LOW) @@ -121,6 +107,14 @@ GPIO(UNUSED_GPIO41, PIN(4, 1), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIOF2, PIN(F, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO96, PIN(9, 6), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO34, PIN(3, 4), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO56, PIN(5, 6), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOD4, PIN(D, 4), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO95, PIN(9, 5), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO81, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO93, PIN(9, 3), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO97, PIN(9, 7), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOB5, PIN(B, 5), GPIO_INPUT | GPIO_SEL_1P8V) /* Unused I2C port, Set input only */ +GPIO(UNUSED_GPIOB4, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V) /* Unused I2C port, Set input only */ /* Only connected to test points */ GPIO(EC_KB_BL_EN, PIN(8, 6), GPIO_INPUT | GPIO_PULL_UP) GPIO(EC_ESPI_ALERT_L, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP) @@ -133,8 +127,6 @@ GPIO(EC_ESPI_ALERT_L, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP) GPIO(EC_EDP_BL_EN, PIN(D, 3), GPIO_OUT_HIGH) /* I2C pins - Alternate function below configures I2C module on these pins */ -GPIO(EC_I2C0_SENSOR_SCL, PIN(B, 5), GPIO_INPUT | GPIO_SEL_1P8V) -GPIO(EC_I2C0_SENSOR_SDA, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(EC_I2C1_USB_C0_SCL, PIN(9, 0), GPIO_INPUT) GPIO(EC_I2C1_USB_C0_SDA, PIN(8, 7), GPIO_INPUT) GPIO(EC_I2C2_USB_C1_SCL, PIN(9, 2), GPIO_INPUT) @@ -150,7 +142,6 @@ GPIO(EC_I2C7_EEPROM_PWR_SDA_R, PIN(B, 2), GPIO_INPUT) GPIO(EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT) /* Alternate functions GPIO definitions */ -ALTERNATE(PIN_MASK(B, BIT(5) | BIT(4)), 0, MODULE_I2C, (GPIO_INPUT | GPIO_SEL_1P8V)) /* I2C0 */ ALTERNATE(PIN_MASK(9, BIT(0) | BIT(2) | BIT(1)), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */ ALTERNATE(PIN_MASK(8, BIT(7)), 0, MODULE_I2C, 0) /* I2C1 SDA */ ALTERNATE(PIN_MASK(D, BIT(1) | BIT(0)), 0, MODULE_I2C, 0) /* I2C3 */ diff --git a/board/chronicler/sensors.c b/board/chronicler/sensors.c deleted file mode 100644 index c744e2a29f..0000000000 --- a/board/chronicler/sensors.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer family-specific sensor configuration */ -#include "common.h" -#include "accelgyro.h" -#include "driver/accel_bma2x2_public.h" -#include "driver/accelgyro_bmi_common_public.h" -#include "driver/accelgyro_bmi260_public.h" -#include "driver/als_tcs3400_public.h" -#include "keyboard_scan.h" -#include "hooks.h" -#include "i2c.h" -#include "task.h" -#include "tablet_mode.h" -#include "util.h" - -/******************************************************************************/ -/* Sensors */ -K_MUTEX_DEFINE(g_lid_accel_mutex); -K_MUTEX_DEFINE(g_base_mutex); - -/* BMA253 private data */ -static struct accelgyro_saved_data_t g_bma253_data; - -/* BMI260 private data */ -static struct bmi_drv_data_t g_bmi260_data; - -/* TCS3400 private data */ -static struct als_drv_data_t g_tcs3400_data = { - .als_cal.scale = 1, - .als_cal.uscale = 0, - .als_cal.offset = 0, - .als_cal.channel_scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc from VPD */ - .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */ - }, -}; - -/* - * TODO: b/146166425 need to calibrate ALS/RGB sensor. At default settings, - * shining phone flashlight on sensor pegs all readings at 0xFFFF. - */ -static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { - .calibration.rgb_cal[X] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0), - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - } - }, - .calibration.rgb_cal[Y] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0), - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - }, - }, - .calibration.rgb_cal[Z] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0), - .scale = { - .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) - } - }, - .calibration.irt = INT_TO_FP(1), - .saturation.again = TCS_DEFAULT_AGAIN, - .saturation.atime = TCS_DEFAULT_ATIME, -}; - -/* Rotation matrix for the lid accelerometer */ -static const mat33_fp_t lid_standard_ref = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; - -const mat33_fp_t base_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - -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_accel_mutex, - .drv_data = &g_bma253_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS, - .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMA255_ACCEL_MIN_FREQ, - .max_frequency = BMA255_ACCEL_MAX_FREQ, - .default_range = 2, /* g, to support tablet mode */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - /* Sensor on in S3 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - }, - }, - [BASE_ACCEL] = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI260, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi260_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi260_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS, - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_ACCEL_MAX_FREQ, - .default_range = 4, /* g */ - .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_BMI260, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi260_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi260_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, - }, - [CLEAR_ALS] = { - .name = "Clear Light", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_TCS3400, - .type = MOTIONSENSE_TYPE_LIGHT, - .location = MOTIONSENSE_LOC_BASE, - .drv = &tcs3400_drv, - .drv_data = &g_tcs3400_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS, - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - .min_frequency = TCS3400_LIGHT_MIN_FREQ, - .max_frequency = TCS3400_LIGHT_MAX_FREQ, - .config = { - /* Run ALS sensor in S0 */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 1000, - }, - }, - }, - - [RGB_ALS] = { - /* - * RGB channels read by CLEAR_ALS and so the i2c port and - * address do not need to be defined for RGB_ALS. - */ - .name = "RGB Light", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_TCS3400, - .type = MOTIONSENSE_TYPE_LIGHT_RGB, - .location = MOTIONSENSE_LOC_BASE, - .drv = &tcs3400_rgb_drv, - .drv_data = &g_tcs3400_rgb_data, - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - }, -}; -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[CLEAR_ALS], -}; -BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT); - -static void baseboard_sensors_init(void) -{ - /* Note - BMA253 interrupt unused by EC */ - - /* Enable interrupt for the TCS3400 color light sensor */ - gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_L); - /* Enable interrupt for the BMI260 accel/gyro sensor */ - gpio_enable_interrupt(GPIO_EC_IMU_INT_L); -} -DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_DEFAULT); - -#ifndef TEST_BUILD -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif |