From f4b4cb8ef5f2ce35ada73b35596b699bbb161249 Mon Sep 17 00:00:00 2001 From: Michael5 Chen Date: Tue, 3 Nov 2020 21:27:46 +0800 Subject: drobit: Remove G-sensor/Hall-sensor/Volume button function Base on schematic, remove G-sensor/hall-sensor/volume button function. BUG=b:172309606 BRANCH=firmware-volteer-13521.B TEST=make BOARD=drobit Signed-off-by: Michael5 Chen Change-Id: Iafed86fb81a727632c374320681984cf32ea0e3f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2517259 Reviewed-by: Jacky Wang Reviewed-by: Keith Short --- board/drobit/board.c | 11 ++-- board/drobit/board.h | 26 ++------- board/drobit/build.mk | 1 - board/drobit/ec.tasklist | 1 - board/drobit/gpio.inc | 16 +++--- board/drobit/sensors.c | 145 ----------------------------------------------- 6 files changed, 18 insertions(+), 182 deletions(-) delete mode 100644 board/drobit/sensors.c diff --git a/board/drobit/board.c b/board/drobit/board.c index e236cf0128..00e7e20710 100644 --- a/board/drobit/board.c +++ b/board/drobit/board.c @@ -9,8 +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/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" #include "driver/ppc/syv682x.h" @@ -35,7 +33,6 @@ #include "switch.h" #include "system.h" #include "task.h" -#include "tablet_mode.h" #include "throttle_ap.h" #include "uart.h" #include "usb_mux.h" @@ -219,11 +216,11 @@ 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, + .name = "usb_c1_mix", + .port = I2C_PORT_USB_C1_MIX, .kbps = 400, - .scl = GPIO_EC_I2C0_SENSOR_SCL, - .sda = GPIO_EC_I2C0_SENSOR_SDA, + .scl = GPIO_EC_I2C0_USB_C1_MIX_SCL, + .sda = GPIO_EC_I2C0_USB_C1_MIX_SDA, }, { .name = "usb_c0", diff --git a/board/drobit/board.h b/board/drobit/board.h index e596c414a4..2119f67189 100644 --- a/board/drobit/board.h +++ b/board/drobit/board.h @@ -32,21 +32,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) - -/* Sensors without hardware FIFO are in forced mode */ -#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(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 +#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 @@ -83,6 +72,7 @@ /* BC 1.2 */ /* Volume Button feature */ +#undef CONFIG_VOLUME_BUTTONS /* Fan features */ @@ -116,14 +106,10 @@ #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_C1_MIX 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 diff --git a/board/drobit/build.mk b/board/drobit/build.mk index b78172d3cf..279b2e559e 100644 --- a/board/drobit/build.mk +++ b/board/drobit/build.mk @@ -14,4 +14,3 @@ BASEBOARD:=volteer board-y=board.o board-y+=battery.o board-y+=led.o -board-y+=sensors.o diff --git a/board/drobit/ec.tasklist b/board/drobit/ec.tasklist index 292de51cdb..2c9a9e8e32 100644 --- a/board/drobit/ec.tasklist +++ b/board/drobit/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/drobit/gpio.inc b/board/drobit/gpio.inc index 7699dddf85..1e7ff5120f 100644 --- a/board/drobit/gpio.inc +++ b/board/drobit/gpio.inc @@ -25,13 +25,11 @@ 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(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) + /* * Lid g-sensor interrupt unused on Volteer, 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) @@ -46,8 +44,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) @@ -110,6 +106,10 @@ 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_GPIOD4, PIN(D, 4), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO56, PIN(5, 6), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO81, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIO95, PIN(9, 5), GPIO_INPUT | GPIO_PULL_UP) + /* 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) @@ -122,8 +122,8 @@ 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_I2C0_USB_C1_MIX_SCL, PIN(B, 5), GPIO_INPUT) /* Reserved for USB4 retimer port 1 */ +GPIO(EC_I2C0_USB_C1_MIX_SDA, PIN(B, 4), GPIO_INPUT) /* Reserved for USB4 retimer port 1 */ 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) @@ -139,7 +139,7 @@ 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(B, BIT(5) | BIT(4)), 0, MODULE_I2C, 0) /* 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/drobit/sensors.c b/board/drobit/sensors.c deleted file mode 100644 index 8e2db059d6..0000000000 --- a/board/drobit/sensors.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright 2020 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.h" -#include "driver/accelgyro_bmi_common.h" -#include "driver/accelgyro_bmi260.h" -#include "driver/sync.h" -#include "keyboard_scan.h" -#include "hooks.h" -#include "i2c.h" -#include "task.h" -#include "tablet_mode.h" -#include "util.h" - -/******************************************************************************/ -/* Sensors */ -static struct mutex g_lid_accel_mutex; -static struct mutex 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; - -/* 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, - }, -}; -unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static void baseboard_sensors_init(void) -{ - /* Note - BMA253 interrupt unused by EC */ - - /* 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 -- cgit v1.2.1