summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chen <ben.chen2@quanta.corp-partner.google.com>2021-03-30 16:24:38 +0800
committerCommit Bot <commit-bot@chromium.org>2021-04-06 03:10:42 +0000
commit9f01d098243c450ebe64bd1cdfc5d281293b8683 (patch)
tree8d5c64870db29b8b546371ac6707732cc6ae98f8
parent4e8183abbc4f473f19d5a1c2ec2e17820387334a (diff)
downloadchrome-ec-9f01d098243c450ebe64bd1cdfc5d281293b8683.tar.gz
spherion: remove motion sensor function
Not supports tablet mode, disable motion sensor function. BUG=b:183064682 BRANCH=asurada TEST=check ec console don't initialize motion sensors. Change-Id: Ibeadb05849bb7e4bdd8bb780be805ef1d057e945 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2794201 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
-rw-r--r--baseboard/asurada/baseboard.h2
-rw-r--r--board/spherion/board.c117
-rw-r--r--board/spherion/board.h25
-rw-r--r--board/spherion/ec.tasklist1
-rw-r--r--board/spherion/gpio.inc11
5 files changed, 6 insertions, 150 deletions
diff --git a/baseboard/asurada/baseboard.h b/baseboard/asurada/baseboard.h
index 26e75ea97d..4fc286a9b1 100644
--- a/baseboard/asurada/baseboard.h
+++ b/baseboard/asurada/baseboard.h
@@ -146,6 +146,7 @@
#define CONFIG_UART_TX_BUF_SIZE 4096
/* Sensor */
+#ifdef HAS_TASK_MOTIONSENSE
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_CMD_ACCELS
@@ -153,6 +154,7 @@
#define CONFIG_ACCEL_FIFO_SIZE 256
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCEL_INTERRUPTS
+#endif
/* SPI / Host Command */
#define CONFIG_SPI
diff --git a/board/spherion/board.c b/board/spherion/board.c
index 2c924f0ce0..9f1fcd5280 100644
--- a/board/spherion/board.c
+++ b/board/spherion/board.c
@@ -30,7 +30,6 @@
#include "i2c.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
-#include "motion_sense.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -51,122 +50,6 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-/* Initialize board. */
-static void board_init(void)
-{
- /* Enable motion sensor interrupt */
- gpio_enable_interrupt(GPIO_BASE_IMU_INT_L);
- gpio_enable_interrupt(GPIO_LID_ACCEL_INT_L);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-/* Sensor */
-static struct mutex g_base_mutex;
-static struct mutex g_lid_mutex;
-
-static struct bmi_drv_data_t g_bmi160_data;
-static struct stprivate_data g_lis2dwl_data;
-
-/* Matrix to rotate accelerometer into standard reference frame */
-/* for Spherion */
-static 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)},
-};
-
-static void update_rotation_matrix(void)
-{
- if (board_get_version() >= 2) {
- motion_sensors[BASE_ACCEL].rot_standard_ref =
- &base_standard_ref;
- motion_sensors[BASE_GYRO].rot_standard_ref =
- &base_standard_ref;
- }
-}
-DECLARE_HOOK(HOOK_INIT, update_rotation_matrix, HOOK_PRIO_INIT_ADC + 2);
-
-struct motion_sensor_t motion_sensors[] = {
- /*
- * 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 = "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_ACCEL,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .rot_standard_ref = NULL, /* identity matrix */
- .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 = {
- /* Sensor on 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 = "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_ACCEL,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = NULL, /* identity matrix */
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
- },
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LIS2DWL,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &lis2dw12_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_lis2dwl_data,
- .int_signal = GPIO_LID_ACCEL_INT_L,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .rot_standard_ref = NULL, /* 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 = 12500 | ROUND_UP_FLAG,
- },
- /* Sensor on for lid angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
-};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
/* PWM */
/*
diff --git a/board/spherion/board.h b/board/spherion/board.h
index fea15a0f4e..677fd2eda8 100644
--- a/board/spherion/board.h
+++ b/board/spherion/board.h
@@ -38,24 +38,6 @@
#define CONFIG_CMD_STACKOVERFLOW
/* Sensor */
-#define CONFIG_GMR_TABLET_MODE
-#define CONFIG_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
-
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_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_LID_ANGLE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-#define CONFIG_LID_ANGLE_UPDATE
/* SPI / Host Command */
#undef CONFIG_HOSTCMD_DEBUG_MODE
@@ -75,13 +57,6 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum sensor_id {
- BASE_ACCEL = 0,
- BASE_GYRO,
- LID_ACCEL,
- SENSOR_COUNT,
-};
-
enum pwm_channel {
PWM_CH_KBLIGHT,
PWM_CH_COUNT,
diff --git a/board/spherion/ec.tasklist b/board/spherion/ec.tasklist
index 75dbb1a828..c92920ade6 100644
--- a/board/spherion/ec.tasklist
+++ b/board/spherion/ec.tasklist
@@ -12,7 +12,6 @@
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(PDCMD, pd_command_task, NULL, 1024) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
diff --git a/board/spherion/gpio.inc b/board/spherion/gpio.inc
index 89abf26d37..5794a456dc 100644
--- a/board/spherion/gpio.inc
+++ b/board/spherion/gpio.inc
@@ -13,8 +13,6 @@ GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH | GPIO_PULL_UP |
GPIO_HIB_WAKE_HIGH, power_button_interrupt) /* H1_EC_PWR_BTN_ODL */
GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
lid_interrupt)
-GPIO_INT(TABLET_MODE_L, PIN(J, 7), GPIO_INT_BOTH,
- gmr_tablet_switch_isr)
/* Chipset interrupts */
GPIO_INT(AP_EC_WARM_RST_REQ, PIN(D, 3), GPIO_INT_RISING | GPIO_SEL_1P8V,
@@ -29,11 +27,6 @@ GPIO_INT(PMIC_EC_PWRGD, PIN(F, 3),
GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V, power_signal_interrupt)
/* Sensor Interrupts */
-GPIO_INT(BASE_IMU_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- bmi160_interrupt)
-GPIO_INT(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- lis2dw12_interrupt)
-GPIO(ALS_RGB_INT_ODL, PIN(F, 0), GPIO_INPUT)
/* USB-C interrupts */
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(D, 1), GPIO_INT_BOTH, ppc_interrupt)
@@ -127,6 +120,10 @@ GPIO(PACKET_MODE_EN, PIN(A, 3), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(UNUSED_GPIOA0, PIN(A, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(UNUSED_GPIOA1, PIN(A, 1), GPIO_INPUT | GPIO_PULL_UP)
GPIO(UNUSED_GPIOA2, PIN(A, 2), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(UNUSED_GPIOF0, PIN(F, 0), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(UNUSED_GPIOJ2, PIN(J, 2), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(UNUSED_GPIOJ3, PIN(J, 3), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(UNUSED_GPIOJ7, PIN(J, 7), GPIO_INPUT | GPIO_PULL_UP)
/* b/160218054: behavior not defined */
/* *_ODL pin has external pullup so don't pull it down. */