summaryrefslogtreecommitdiff
path: root/board/yorp
diff options
context:
space:
mode:
authorJagadish Krishnamoorthy <jagadish.krishnamoorthy@intel.com>2018-05-25 11:39:11 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-30 01:02:35 -0700
commit628c9a924cfde28b2c77707bd71e04cafdf7dc9c (patch)
tree2c9a042266d1d6325972dd67e98608ce5ea00e32 /board/yorp
parent3c4a912e67ad0f0635c77ef4a30f07397fb06be7 (diff)
downloadchrome-ec-628c9a924cfde28b2c77707bd71e04cafdf7dc9c.tar.gz
yorp: enable interrupt for base accel sensor
Configure the accel sensor gpio to interrupt. Enable CONFIG_ACCEL_INTERRUPTS and CONFIG_ACCEL_FIFO to activate FIFO mode. BUG=b:74932344 BRANCH=NONE TEST=On Yorp board, "accelinfo on 1000" should output BASE ACCEL values. Change-Id: Icecbbe604b32b6bd691558d2898896f6d1443f19 Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1073645 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/yorp')
-rw-r--r--board/yorp/board.c8
-rw-r--r--board/yorp/board.h12
-rw-r--r--board/yorp/gpio.inc3
3 files changed, 19 insertions, 4 deletions
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 1a282c8b4c..7e4111116e 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -294,6 +294,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 Base Accel interrupt */
+ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
#ifndef TEST_BUILD
/* This callback disables keyboard when convertibles are fully open */
void lid_angle_peripheral_enable(int enable)
diff --git a/board/yorp/board.h b/board/yorp/board.h
index aef8b4a111..4ef2cd8aa0 100644
--- a/board/yorp/board.h
+++ b/board/yorp/board.h
@@ -30,8 +30,7 @@
#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK ((1 << LID_ACCEL) | \
- (1 << BASE_ACCEL) | (1 << BASE_GYRO))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -45,7 +44,16 @@
#define CONFIG_TEMP_SENSOR
#define CONFIG_THERMISTOR_NCP15WB
+#define CONFIG_ACCEL_INTERRUPTS
+/* FIFO size is in power of 2. */
+#define CONFIG_ACCEL_FIFO 1024
+/* Depends on how fast the AP boots and typical ODRs */
+#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
+#define CONFIG_MKBP_EVENT
+#define CONFIG_MKBP_USE_HOST_EVENT
+
+#define CONFIG_ACCEL_LSM6DSM_INT_EVENT TASK_EVENT_CUSTOM(4)
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/yorp/gpio.inc b/board/yorp/gpio.inc
index cc4a387bd9..9f3e3dd35f 100644
--- a/board/yorp/gpio.inc
+++ b/board/yorp/gpio.inc
@@ -39,8 +39,7 @@ GPIO_INT(ALL_SYS_PGOOD, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt) /* PM
/* Other interrupts */
GPIO_INT(WP_L, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */
-/* TODO(b/74932344): Make it as an interrupt after driver supports this */
-GPIO(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INPUT | GPIO_SEL_1P8V)
+GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt)
GPIO(LID_ACCEL_INT_L, PIN(5, 0), GPIO_INPUT | GPIO_SEL_1P8V)
/* Define PCH_SLP_S0_L after all interrupts if CONFIG_POWER_S0IX not defined. */