diff options
-rw-r--r-- | board/draco/board.c | 4 | ||||
-rw-r--r-- | board/draco/board.h | 55 | ||||
-rw-r--r-- | board/draco/ec.tasklist | 1 | ||||
-rw-r--r-- | board/draco/gpio.inc | 12 | ||||
-rw-r--r-- | board/draco/sensors.c | 203 |
5 files changed, 12 insertions, 263 deletions
diff --git a/board/draco/board.c b/board/draco/board.c index 6776cc3f7f..f28671a36b 100644 --- a/board/draco/board.c +++ b/board/draco/board.c @@ -13,9 +13,6 @@ #include "gpio.h" #include "gpio_signal.h" #include "hooks.h" -#include "driver/accel_lis2dw12.h" -#include "driver/accelgyro_lsm6dso.h" -#include "driver/als_tcs3400.h" #include "fw_config.h" #include "hooks.h" #include "lid_switch.h" @@ -23,7 +20,6 @@ #include "power.h" #include "registers.h" #include "switch.h" -#include "tablet_mode.h" #include "throttle_ap.h" #include "usbc_config.h" diff --git a/board/draco/board.h b/board/draco/board.h index a3284bcc7c..425c07f9cf 100644 --- a/board/draco/board.h +++ b/board/draco/board.h @@ -37,43 +37,12 @@ #define CONFIG_LED_PWM_LOW_BATT_COLOR EC_LED_COLOR_AMBER /* Sensors */ -#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */ -#define CONFIG_ACCEL_LSM6DSO_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) - -/* Enable sensor fifo, must also define the _SIZE and _THRES */ -#define CONFIG_ACCEL_FIFO -/* FIFO size is in power of 2. */ -#define CONFIG_ACCEL_FIFO_SIZE 256 -/* Depends on how fast the AP boots and typical ODRs */ -#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3) - -/* Sensors without hardware FIFO are in forced mode */ -#define CONFIG_ACCEL_FORCE_MODE_MASK \ - (BIT(LID_ACCEL) | BIT(CLEAR_ALS)) - -/* Lid accel */ -#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 -#define CONFIG_ACCEL_LIS2DWL -#define CONFIG_ACCEL_LIS2DW_AS_BASE -#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL) - -#define CONFIG_ACCEL_INTERRUPTS - -/* Sensor console commands */ -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO +#undef CONFIG_TABLET_MODE +#undef CONFIG_TABLET_MODE_SWITCH +#undef CONFIG_GMR_TABLET_MODE + +/* Buttons */ +#undef CONFIG_VOLUME_BUTTONS /* USB Type A Features */ #define USB_PORT_COUNT 1 @@ -129,7 +98,6 @@ #define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST #define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L #define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L -#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L /* * GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup @@ -141,8 +109,6 @@ #define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL #define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL #define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL -#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL -#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define GPIO_WP_L GPIO_EC_WP_ODL #define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL @@ -226,15 +192,6 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -enum sensor_id { - LID_ACCEL = 0, - BASE_ACCEL, - BASE_GYRO, - CLEAR_ALS, - RGB_ALS, - SENSOR_COUNT -}; - enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C2_NCT38XX, diff --git a/board/draco/ec.tasklist b/board/draco/ec.tasklist index 12b87cfab4..d866e2349e 100644 --- a/board/draco/ec.tasklist +++ b/board/draco/ec.tasklist @@ -17,7 +17,6 @@ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, BASEBOARD_CHARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, BASEBOARD_CHIPSET_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_MUX, usb_mux_task, NULL, VENTI_TASK_STACK_SIZE) \ diff --git a/board/draco/gpio.inc b/board/draco/gpio.inc index ac1dd2280c..f2e2ed4fbb 100644 --- a/board/draco/gpio.inc +++ b/board/draco/gpio.inc @@ -9,12 +9,7 @@ /* INTERRUPT GPIOs: */ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt) -GPIO_INT(EC_ACCEL_INT_R_L, PIN(8, 1), GPIO_SEL_1P8V | GPIO_INT_FALLING, lis2dw12_interrupt) -GPIO_INT(EC_ALS_RGB_INT_R_L, PIN(D, 4), GPIO_INT_FALLING, tcs3400_interrupt) -GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, lsm6dso_interrupt) GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt) -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) GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(GSC_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH | GPIO_HIB_WAKE_LOW, power_button_interrupt) GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, lid_interrupt) @@ -24,7 +19,6 @@ GPIO_INT(SEQ_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_ GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt) GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event) GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt) @@ -178,3 +172,9 @@ UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */ UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */ UNUSED(PIN(6, 6)) /* GPIO66 */ UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */ +UNUSED(PIN(8, 1)) /* GPIO81 */ +UNUSED(PIN(D, 4)) /* GPIOD4 */ +UNUSED(PIN(5, 6)) /* GPIO56 */ +UNUSED(PIN(9, 3)) /* GPIO93 */ +UNUSED(PIN(9, 7)) /* GPIO97 */ +UNUSED(PIN(9, 5)) /* GPIO95 */ diff --git a/board/draco/sensors.c b/board/draco/sensors.c index fd3bed7bd9..1f1597416f 100644 --- a/board/draco/sensors.c +++ b/board/draco/sensors.c @@ -4,13 +4,8 @@ */ #include "common.h" -#include "accelgyro.h" #include "adc.h" -#include "driver/accel_lis2dw12.h" -#include "driver/accelgyro_lsm6dso.h" -#include "driver/als_tcs3400_public.h" #include "hooks.h" -#include "motion_sense.h" #include "temp_sensor.h" #include "thermal.h" #include "temp_sensor/thermistor.h" @@ -48,204 +43,6 @@ struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); -K_MUTEX_DEFINE(g_lid_accel_mutex); -K_MUTEX_DEFINE(g_base_accel_mutex); -static struct stprivate_data g_lis2dw12_data; -static struct lsm6dso_data lsm6dso_data; - -static 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)} -}; - -static 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)} -}; - -/* 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 */ - }, -}; - -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(1.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(1.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(1.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, -}; - -struct motion_sensor_t motion_sensors[] = { - [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LIS2DW12, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &lis2dw12_drv, - .mutex = &g_lid_accel_mutex, - .drv_data = &g_lis2dw12_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LIS2DW12_ADDR0, - .rot_standard_ref = &lid_standard_ref, /* identity matrix */ - .default_range = 2, /* g */ - .min_frequency = LIS2DW12_ODR_MIN_VAL, - .max_frequency = LIS2DW12_ODR_MAX_VAL, - .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, - }, - }, - }, - - [BASE_ACCEL] = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LSM6DSO, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &lsm6dso_drv, - .mutex = &g_base_accel_mutex, - .drv_data = LSM6DSO_ST_DATA(lsm6dso_data, - MOTIONSENSE_TYPE_ACCEL), - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS, - .rot_standard_ref = &base_standard_ref, - .default_range = 4, /* g */ - .min_frequency = LSM6DSO_ODR_MIN_VAL, - .max_frequency = LSM6DSO_ODR_MAX_VAL, - .config = { - [SENSOR_CONFIG_EC_S0] = { - .odr = 13000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - [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_LSM6DSO, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &lsm6dso_drv, - .mutex = &g_base_accel_mutex, - .drv_data = LSM6DSO_ST_DATA(lsm6dso_data, - MOTIONSENSE_TYPE_GYRO), - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS, - .default_range = 1000 | ROUND_UP_FLAG, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = LSM6DSO_ODR_MIN_VAL, - .max_frequency = LSM6DSO_ODR_MAX_VAL, - }, - - [CLEAR_ALS] = { - .name = "Clear Light", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_TCS3400, - .type = MOTIONSENSE_TYPE_LIGHT, - .location = MOTIONSENSE_LOC_CAMERA, - .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_CAMERA, - .drv = &tcs3400_rgb_drv, - .drv_data = &g_tcs3400_rgb_data, - .rot_standard_ref = NULL, - .default_range = 0x10000, /* scale = 1x, uscale = 0 */ - }, -}; -const 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) -{ - /* Enable gpio interrupt for lid accel sensor */ - gpio_enable_interrupt(GPIO_EC_ACCEL_INT_R_L); - /* Enable interrupt for the TCS3400 color light sensor */ - gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_R_L); - /* Enable gpio interrupt for base accelgyro sensor */ - gpio_enable_interrupt(GPIO_EC_IMU_INT_R_L); -} -DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1); - /* Temperature sensor configuration */ const struct temp_sensor_t temp_sensors[] = { [TEMP_SENSOR_1_DDR_SOC] = { |