From ae9ac3459d2e76e1b424d6b0d5385bda2c4663ae Mon Sep 17 00:00:00 2001 From: Mathew King Date: Tue, 5 Mar 2019 13:49:33 -0700 Subject: arcada_ish: Enable accel interrupts and accel fifo BUG=b:123634700 TEST=Built and deployed to arcada device and tested fifo with "ectool --name cros_ish motionsense fifo_int_enable 1" BRANCH=none Change-Id: I9b8110b0114003b19e8fc1c2f42d8a6a0475dc6f Signed-off-by: Mathew King Reviewed-on: https://chromium-review.googlesource.com/1503800 Tested-by: Jett Rink Reviewed-by: Jett Rink --- board/arcada_ish/board.c | 8 ++++++++ board/arcada_ish/board.h | 11 +++++++++-- board/arcada_ish/gpio.inc | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c index ce9aaece6c..6ab110e03f 100644 --- a/board/arcada_ish/board.c +++ b/board/arcada_ish/board.c @@ -80,6 +80,14 @@ struct motion_sensor_t motion_sensors[] = { }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); +/* Initialize board. */ +static void board_init(void) +{ + /* Enable interrupt for LSM6DS3 sensor */ + gpio_enable_interrupt(GPIO_ACCEL_GYRO_INT_L); +} +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); + /* TODO(b/122364080): replace when implement real chipset/power task */ int chipset_in_state(int state_mask) { diff --git a/board/arcada_ish/board.h b/board/arcada_ish/board.h index 348a92c6d1..fbc8ad1c8a 100644 --- a/board/arcada_ish/board.h +++ b/board/arcada_ish/board.h @@ -32,8 +32,15 @@ #define CONFIG_I2C_MASTER #define CONFIG_ACCELGYRO_LSM6DSM /* For LSM6DS3 */ -/* TODO(b/123634700): This is temporary until FIFO is supported */ -#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL) + +#define CONFIG_ACCEL_INTERRUPTS +#define CONFIG_ACCEL_FIFO 256 +#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) + +#define CONFIG_ACCEL_LSM6DSM_INT_EVENT TASK_EVENT_CUSTOM(1 << 2) + +#define CONFIG_MKBP_EVENT +#define CONFIG_MKBP_USE_HECI /* Host command over HECI */ #define CONFIG_HOSTCMD_HECI diff --git a/board/arcada_ish/gpio.inc b/board/arcada_ish/gpio.inc index d4a819ef10..cca0d2f885 100644 --- a/board/arcada_ish/gpio.inc +++ b/board/arcada_ish/gpio.inc @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +GPIO_INT(ACCEL_GYRO_INT_L, PIN(0), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt) + GPIO(NB_MODE_L, PIN(4), GPIO_OUT_LOW) GPIO(LID_CL_NB_L, PIN(5), GPIO_INPUT) GPIO(LID_CL_TAB_L, PIN(6), GPIO_INPUT) -- cgit v1.2.1