diff options
-rw-r--r-- | board/volteer_ish/board.c | 24 | ||||
-rw-r--r-- | board/volteer_ish/board.h | 16 |
2 files changed, 39 insertions, 1 deletions
diff --git a/board/volteer_ish/board.c b/board/volteer_ish/board.c index f888ff60fe..7882708653 100644 --- a/board/volteer_ish/board.c +++ b/board/volteer_ish/board.c @@ -28,10 +28,32 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); +/* Sensor config */ +static struct mutex g_lid_mutex; + +/* sensor private data */ +static struct accelgyro_saved_data_t g_bma253_data; + /* Drivers */ +/* TODO(b/146144170): Implement rotation matrix once sensor moves to lid */ 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 = NULL, /* Update when matrix available */ + .min_frequency = BMA255_ACCEL_MIN_FREQ, + .max_frequency = BMA255_ACCEL_MAX_FREQ, + .default_range = 2, /* g, to support tablet mode */ + }, }; - const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); int chipset_in_state(int state_mask) diff --git a/board/volteer_ish/board.h b/board/volteer_ish/board.h index 3adfcb07c5..b290d70b19 100644 --- a/board/volteer_ish/board.h +++ b/board/volteer_ish/board.h @@ -31,12 +31,27 @@ #define CONFIG_I2C #define CONFIG_I2C_MASTER +/* BMA253 Lid accel */ +#define CONFIG_ACCEL_BMA255 + /* Host command over HECI */ #define CONFIG_HOSTCMD_HECI #define CONFIG_MKBP_EVENT #define CONFIG_MKBP_USE_HECI +#define CONFIG_ACCEL_INTERRUPTS + +/* 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 512 +/* 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)) + /* I2C ports */ #define I2C_PORT_SENSOR ISH_I2C1 #define CONFIG_CMD_I2C_XFER @@ -74,6 +89,7 @@ /* Motion sensors */ enum sensor_id { + LID_ACCEL, SENSOR_COUNT }; |