summaryrefslogtreecommitdiff
path: root/board/coachz
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-09-14 16:08:57 -0700
committerCommit Bot <commit-bot@chromium.org>2020-09-17 01:47:04 +0000
commit25d17cfdf5829eedb6d7ebbfeb54b39ff17bf9e5 (patch)
tree9ebb41d2aca20698026176f7b99e9c0a488a0e88 /board/coachz
parentcb442c95b69fa0c687e8179dc30e098fc147dad0 (diff)
downloadchrome-ec-25d17cfdf5829eedb6d7ebbfeb54b39ff17bf9e5.tar.gz
Coachz: Relocate the sensors and remove the base one
The main board is inside the lid, instead of the base. So relocate the sensors, remove the base sensor, and remove the logic of calculating the lid angle. BRANCH=None BUG=b:167884598 TEST=Built the Coachz image. Change-Id: Ib3cf3c871c541cddaf3fda7df4bf478615b829a7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2410853 Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Diffstat (limited to 'board/coachz')
-rw-r--r--board/coachz/board.c72
-rw-r--r--board/coachz/board.h24
-rw-r--r--board/coachz/gpio.inc3
3 files changed, 13 insertions, 86 deletions
diff --git a/board/coachz/board.c b/board/coachz/board.c
index 19b6a24f10..70ad1f0de8 100644
--- a/board/coachz/board.c
+++ b/board/coachz/board.c
@@ -217,69 +217,35 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
};
/* Mutexes */
-static struct mutex g_base_mutex;
static struct mutex g_lid_mutex;
static struct bmi_drv_data_t g_bmi160_data;
-static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
+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 lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 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_mutex,
- .drv_data = &g_bma255_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
- .rot_standard_ref = &lid_standard_ref,
- .default_range = 2, /* g, to support lid angle calculation. */
- .min_frequency = BMA255_ACCEL_MIN_FREQ,
- .max_frequency = BMA255_ACCEL_MAX_FREQ,
- .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,
- },
- },
- },
/*
* 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",
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
.active_mask = SENSOR_ACTIVE_S0_S3_S5,
.chip = MOTIONSENSE_CHIP_BMI160,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi160_drv,
- .mutex = &g_base_mutex,
+ .mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
+ .rot_standard_ref = &lid_standard_ref,
.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,
@@ -289,44 +255,24 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
- [BASE_GYRO] = {
+ [LID_GYRO] = {
.name = "Gyro",
.active_mask = SENSOR_ACTIVE_S0_S3_S5,
.chip = MOTIONSENSE_CHIP_BMI160,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi160_drv,
- .mutex = &g_base_mutex,
+ .mutex = &g_lid_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,
+ .rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI_GYRO_MIN_FREQ,
.max_frequency = BMI_GYRO_MAX_FREQ,
},
};
-unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-#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 (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
+const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Initialize board. */
static void board_init(void)
diff --git a/board/coachz/board.h b/board/coachz/board.h
index 83279a045b..5749d68bd7 100644
--- a/board/coachz/board.h
+++ b/board/coachz/board.h
@@ -39,30 +39,13 @@
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
-/* Sensors */
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-
-/* BMI160 Base accel/gyro */
+/* BMI160 Lid accel/gyro */
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
-/* BMA253 lid accel */
-#define CONFIG_ACCEL_BMA255
-#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(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
-
-#define CONFIG_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-#define CONFIG_GMR_TABLET_MODE
-#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
-
/* GPIO alias */
#define GPIO_AC_PRESENT GPIO_ACOK_OD
#define GPIO_WP_L GPIO_EC_WP_ODL
@@ -83,8 +66,7 @@ enum adc_channel {
/* Motion sensors */
enum sensor_id {
LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
+ LID_GYRO,
SENSOR_COUNT,
};
diff --git a/board/coachz/gpio.inc b/board/coachz/gpio.inc
index 2c6e41148d..a86f0775f0 100644
--- a/board/coachz/gpio.inc
+++ b/board/coachz/gpio.inc
@@ -40,7 +40,6 @@ GPIO_INT(WARM_RESET_L, PIN(F, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V, chipset_wa
GPIO_INT(AP_EC_SPI_CS_L, PIN(5, 3), GPIO_INT_FALLING | GPIO_PULL_DOWN, shi_cs_event) /* EC SPI Chip Select */
/* Sensor interrupts */
-GPIO_INT(TABLET_MODE_L, PIN(C, 6), GPIO_INT_BOTH, gmr_tablet_switch_isr)
GPIO_INT(ACCEL_GYRO_INT_L, PIN(A, 0), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt) /* Accelerometer/gyro interrupt */
/*
@@ -72,10 +71,10 @@ GPIO(EN_PP5000_A, PIN(6, 7), GPIO_OUT_LOW) /* Enable PP5000 */
GPIO(EC_BL_DISABLE_L, PIN(B, 6), GPIO_OUT_LOW) /* Backlight disable signal from EC */
/* Sensors */
-GPIO(LID_ACCEL_INT_L, PIN(5, 6), GPIO_INPUT) /* Lid accel sensor interrupt */
/* Control the gate for trackpad IRQ. High closes the gate.
* This is always set low so that the OS can manage the trackpad. */
GPIO(TRACKPAD_INT_GATE, PIN(7, 4), GPIO_OUT_LOW)
+GPIO(REVERSE_DOCK_EC, PIN(C, 6), GPIO_INPUT)
/* USB-C */
GPIO(USB_C0_PD_RST_L, PIN(F, 1), GPIO_ODR_HIGH) /* Port-0 TCPC chip reset, actaully Open-Drain */