summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt_Wang <Matt_Wang@compal.corp-partner.google.com>2021-08-18 10:13:36 +0800
committerCommit Bot <commit-bot@chromium.org>2021-08-18 06:59:47 +0000
commitffdf685340801816a2dd6fcdaafceae7ac8f5490 (patch)
treec7b6f9eac51cb7bc092de4f9e8d948c78a83de7e
parenta8c33859992f1bb39b12650fcf6a5697938e9c14 (diff)
downloadchrome-ec-ffdf685340801816a2dd6fcdaafceae7ac8f5490.tar.gz
driblee: Disable motionsensor
Driblee only 180 SKU so remove the motionsensor code. BUG=b:196929676 BRANCH=keeby TEST=make BOARD=driblee Signed-off-by: Matt_Wang <Matt_Wang@compal.corp-partner.google.com> Change-Id: I76fff7ad4f15ec3fb74268ae91c15e495e7ce4a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3102686 Tested-by: Matt Wang <matt_wang@compal.corp-partner.google.com> Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/driblee/board.c254
-rw-r--r--board/driblee/board.h41
-rw-r--r--board/driblee/ec.tasklist1
-rw-r--r--board/driblee/gpio.inc2
4 files changed, 1 insertions, 297 deletions
diff --git a/board/driblee/board.c b/board/driblee/board.c
index c7f6bb2b05..67ee3cddce 100644
--- a/board/driblee/board.c
+++ b/board/driblee/board.c
@@ -16,11 +16,6 @@
#include "chipset.h"
#include "common.h"
#include "compile_time_macros.h"
-#include "driver/accel_bma2x2.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "driver/accelgyro_icm_common.h"
-#include "driver/accelgyro_icm426xx.h"
-#include "driver/accel_kionix.h"
#include "driver/temp_sensor/thermistor.h"
#include "temp_sensor.h"
#include "driver/bc12/pi3usb9201.h"
@@ -37,7 +32,6 @@
#include "keyboard_raw.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
-#include "motion_sense.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -45,7 +39,6 @@
#include "stdbool.h"
#include "switch.h"
#include "system.h"
-#include "tablet_mode.h"
#include "task.h"
#include "usb_mux.h"
#include "usb_pd.h"
@@ -411,185 +404,6 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
raa489000_set_output_current(port, rp);
}
-/* Sensors */
-static struct mutex g_lid_mutex;
-static struct mutex g_base_mutex;
-
-/* Matrices to rotate accelerometers into the standard reference. */
-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)}
-};
-
-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)}
-};
-
-
-/* BMA253 private data */
-static struct accelgyro_saved_data_t g_bma253_data;
-
-/* BMI160 private data */
-static struct bmi_drv_data_t g_bmi160_data;
-
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-/* ICM426 private data */
-static struct icm_drv_data_t g_icm426xx_data;
-/* KX022 private data */
-static struct kionix_accel_data g_kx022_data;
-
-struct motion_sensor_t kx022_lid_accel = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_KX022,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &kionix_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_kx022_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = KX022_ADDR0_FLAGS,
- .rot_standard_ref = &lid_standard_ref,
- .min_frequency = KX022_ACCEL_MIN_FREQ,
- .max_frequency = KX022_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,
- },
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
-};
-
-struct motion_sensor_t icm426xx_base_accel = {
- .name = "Base Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
- .rot_standard_ref = &base_icm_ref,
- .min_frequency = ICM426XX_ACCEL_MIN_FREQ,
- .max_frequency = ICM426XX_ACCEL_MAX_FREQ,
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 13000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- },
-};
-
-struct motion_sensor_t icm426xx_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_icm_ref,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
-};
-
-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_mutex,
- .drv_data = &g_bma253_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
- .rot_standard_ref = &lid_standard_ref,
- .default_range = 2,
- .min_frequency = BMA255_ACCEL_MIN_FREQ,
- .max_frequency = BMA255_ACCEL_MAX_FREQ,
- .config = {
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
- [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,
- .default_range = 4,
- .min_frequency = BMI_ACCEL_MIN_FREQ,
- .max_frequency = BMI_ACCEL_MAX_FREQ,
- .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_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,
- },
-};
-
-unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
void board_init(void)
{
int on;
@@ -599,33 +413,6 @@ void board_init(void)
check_c0_line();
check_c1_line();
- /* Enable gpio interrupt for base accelgyro sensor */
- gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
- if (get_cbi_fw_config_tablet_mode()) {
- if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM426XX) {
- motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
- motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
- cprints(CC_SYSTEM, "BASE GYRO is ICM426XX");
- } else
- cprints(CC_SYSTEM, "BASE GYRO is BMI160");
-
- if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_KX022) {
- motion_sensors[LID_ACCEL] = kx022_lid_accel;
- cprints(CC_SYSTEM, "LID_ACCEL is KX022");
- } else
- cprints(CC_SYSTEM, "LID_ACCEL is BMA253");
-
- motion_sensor_count = ARRAY_SIZE(motion_sensors);
- /* Enable gpio interrupt for base accelgyro sensor */
- gpio_enable_interrupt(GPIO_BASE_SIXAXIS_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_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- }
-
/* Turn on 5V if the system is on, otherwise turn it off. */
on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
CHIPSET_STATE_SOFT_OFF);
@@ -636,19 +423,6 @@ void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-void motion_interrupt(enum gpio_signal signal)
-{
- switch (get_cbi_ssfc_base_sensor()) {
- case SSFC_SENSOR_ICM426XX:
- icm426xx_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI160:
- default:
- bmi160_interrupt(signal);
- break;
- }
-}
-
__override void ocpc_get_pid_constants(int *kp, int *kp_div,
int *ki, int *ki_div,
int *kd, int *kd_div)
@@ -823,31 +597,3 @@ static void adc_vol_key_press_check(void)
}
}
DECLARE_HOOK(HOOK_TICK, adc_vol_key_press_check, HOOK_PRIO_DEFAULT);
-
-#ifndef TEST_BUILD
-/* This callback disables keyboard when convertibles are fully open */
-void lid_angle_peripheral_enable(int enable)
-{
- int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON);
-
- /*
- * If the lid is in tablet position via other sensors,
- * ignore the lid angle, which might be faulty then
- * disable keyboard.
- */
- if (tablet_get_mode())
- enable = 0;
-
- 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
diff --git a/board/driblee/board.h b/board/driblee/board.h
index 1cbb6bf7e2..cf84d104a2 100644
--- a/board/driblee/board.h
+++ b/board/driblee/board.h
@@ -30,6 +30,7 @@
#undef CONFIG_CMD_CHARGER_DUMP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
+#define CONFIG_MATH_UTIL
/* GPIO for C1 interrupts, for baseboard use */
#define GPIO_USB_C1_INT_ODL GPIO_SUB_USB_C1_INT_ODL
@@ -94,38 +95,6 @@
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
-/* Sensors */
-#define CONFIG_CMD_ACCELS
-#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
-
-/* Lid operates in forced mode, base in FIFO */
-#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
-#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
-#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
-#define CONFIG_ACCEL_INTERRUPTS
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-
-#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_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_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-#define CONFIG_GMR_TABLET_MODE
-
/* Volume Button feature */
#define CONFIG_ADC_BUTTONS
#define CONFIG_VOLUME_BUTTONS
@@ -157,13 +126,6 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
-
enum pwm_channel {
PWM_CH_KBLIGHT,
PWM_CH_COUNT,
@@ -177,6 +139,5 @@ enum battery_type {
};
int board_is_sourcing_vbus(int port);
-void motion_interrupt(enum gpio_signal signal);
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/driblee/ec.tasklist b/board/driblee/ec.tasklist
index d4fb416bce..e8527df171 100644
--- a/board/driblee/ec.tasklist
+++ b/board/driblee/ec.tasklist
@@ -9,7 +9,6 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
diff --git a/board/driblee/gpio.inc b/board/driblee/gpio.inc
index 3d81cd089d..854c2c5b9c 100644
--- a/board/driblee/gpio.inc
+++ b/board/driblee/gpio.inc
@@ -34,8 +34,6 @@ GPIO_INT(EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_
/* Other interrupts */
GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt)
GPIO_INT(EC_WP_OD, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, motion_interrupt)
-GPIO_INT(LID_360_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)
/* I2C Ports */
GPIO(EC_I2C_EEPROM_SCL, PIN(B, 3), GPIO_INPUT)