summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-05-30 11:45:29 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-10 03:40:24 +0000
commite7b2d5bcea9404bfb3b66660e30078aee2a609b7 (patch)
tree9134f9e20283c272b3f2ec08ee52c682a1a9f8d1
parenta7c4132d2581ec7fa0155d414c2c3e0b9729b34c (diff)
downloadchrome-ec-e7b2d5bcea9404bfb3b66660e30078aee2a609b7.tar.gz
ryu: sensor hub: Add FIFO and interrupt support
Enable code to use BMI150 FIFO and interrupt support on Smaug BUG=chrome-os-partner:39900 BRANCH=smaug TEST=Check fifo is working, interrupts are enabled. Change-Id: Ifc07da793d3ece4806895db4aff5d880c0f3d9b0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274228 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/ryu/board.c3
-rw-r--r--board/ryu/board.h11
-rw-r--r--board/ryu/ec.tasklist2
-rw-r--r--board/ryu/gpio.inc2
4 files changed, 16 insertions, 2 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c
index 11ece706c7..7fd2178cdc 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -217,6 +217,9 @@ static void board_init(void)
/* Enable interrupts on VBUS transitions. */
gpio_enable_interrupt(GPIO_CHGR_ACOK);
+
+ /* Enable interrupts from BMI160 sensor. */
+ gpio_enable_interrupt(GPIO_ACC_IRQ1);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/ryu/board.h b/board/ryu/board.h
index 5ce4066fdf..544a57889a 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -144,9 +144,20 @@
/* Sensor support */
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_MAG_BMI160_BMM150
+#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
+/* Size of FIFO queue is determined by Android Hifi sensor requirements:
+ * Wake up sensors: Accel @50Hz + Barometer @5Hz + uncal mag @ 10Hz
+ * 60s minimum, 3min recommened.
+ * FIFO size is in power of 2.
+ */
+#define CONFIG_ACCEL_FIFO 2048
+
+/* Depends on how fast the AP boots and typical ODRs */
+#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
+
/* Maximum number of deferrable functions */
#undef DEFERRABLE_MAX_COUNT
#define DEFERRABLE_MAX_COUNT 16
diff --git a/board/ryu/ec.tasklist b/board/ryu/ec.tasklist
index 6b672c7b17..5b707ab329 100644
--- a/board/ryu/ec.tasklist
+++ b/board/ryu/ec.tasklist
@@ -22,7 +22,7 @@
SMALLER_TASK_STACK_SIZE) \
TASK_NOTEST(LIGHTBAR, lightbar_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) \
+ TASK_NOTEST(MOTIONSENSE, motion_sense_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
diff --git a/board/ryu/gpio.inc b/board/ryu/gpio.inc
index 145543800d..009bfd98a2 100644
--- a/board/ryu/gpio.inc
+++ b/board/ryu/gpio.inc
@@ -13,6 +13,7 @@ GPIO_INT(LID_OPEN, PIN(E, 1), GPIO_INT_BOTH | GPIO_PULL_UP, lid_
GPIO_INT(CHARGE_DONE, PIN(E, 6), GPIO_INT_BOTH, inductive_charging_interrupt)
GPIO_INT(AP_IN_SUSPEND, PIN(F, 9), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(AP_HOLD, PIN(E, 3), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(ACC_IRQ1, PIN(D, 12), GPIO_INT_FALLING, bmi160_interrupt)
/* Interrupt lines not used yet */
GPIO(BC_TEMP_ALERT_L, PIN(C, 5), GPIO_INT_FALLING)
@@ -21,7 +22,6 @@ GPIO(LIGHTBAR_EN_L, PIN(E, 8), GPIO_INT_FALLING | GPIO_PULL_UP)
GPIO(BASE_PRES_L, PIN(E, 10), GPIO_INT_BOTH | GPIO_PULL_UP)
GPIO(CHGR_INT_L, PIN(B, 2), GPIO_INT_FALLING)
GPIO(CAM_SYNC_INT_L, PIN(C, 7), GPIO_INT_FALLING)
-GPIO(ACC_IRQ, PIN(D, 12), GPIO_INPUT)
GPIO(COMPASS_DRDY, PIN(A, 8), GPIO_INPUT)
/* Buttons */