From 75c4ca92679fbfae01d4e9d7fd0798425f41c38e Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 16 Aug 2018 15:45:24 -0700 Subject: board: eve: Do not set accelerometer ODR beyond 200Hz When ODR is set above 200Hz, the EC can not keep up with the accelerometer, causing deadlock. ODR was set at 400Hz for double tap detection. However, that high frequency is only needed for LSM6DS0 where tap detection is done in software (samus). 200Hz is good enough when tap detection is done in hardware. BUG=b:112672627 BRANCH=eve TEST=Check eve is done dead locking at boot. Check double tap still works. Change-Id: Id41dc06eb357b1cdc78d22b89440f01c44a3c16c Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/1179182 Reviewed-by: Aseda Aboagye --- board/samus/board.c | 4 ++-- include/gesture.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/board/samus/board.c b/board/samus/board.c index c26f08137d..d95975bb18 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -337,11 +337,11 @@ struct motion_sensor_t motion_sensors[] = { }, /* Used for double tap */ [SENSOR_CONFIG_EC_S3] = { - .odr = TAP_ODR | ROUND_UP_FLAG, + .odr = TAP_ODR_LSM6DS0 | ROUND_UP_FLAG, .ec_rate = CONFIG_GESTURE_SAMPLING_INTERVAL_MS * MSEC, }, [SENSOR_CONFIG_EC_S5] = { - .odr = TAP_ODR | ROUND_UP_FLAG, + .odr = TAP_ODR_LSM6DS0 | ROUND_UP_FLAG, .ec_rate = CONFIG_GESTURE_SAMPLING_INTERVAL_MS * MSEC, }, }, diff --git a/include/gesture.h b/include/gesture.h index d480794758..85419c20fc 100644 --- a/include/gesture.h +++ b/include/gesture.h @@ -21,6 +21,7 @@ void gesture_calc(uint32_t *event); * Note: lsm6ds0 accel needs twice the expected data rate in order to guarantee * that we have a new data sample every reading. */ -#define TAP_ODR (2 * (1000000 / CONFIG_GESTURE_SAMPLING_INTERVAL_MS)) +#define TAP_ODR (1000000 / CONFIG_GESTURE_SAMPLING_INTERVAL_MS) +#define TAP_ODR_LSM6DS0 (2 * TAP_ODR) #endif /* __CROS_EC_GESTURE_H */ -- cgit v1.2.1