diff options
author | Scott Chao <scott_chao@wistron.corp-partner.google.com> | 2021-07-28 17:19:47 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-29 01:36:20 +0000 |
commit | 67c4d42c36e9a4f96c7d7365e47d3bebc7036404 (patch) | |
tree | a127aa721c66eb6c67132039fb90f767ec5012d6 | |
parent | d9b3e3e119e10760001c6739d473648e5a772bbc (diff) | |
download | chrome-ec-67c4d42c36e9a4f96c7d7365e47d3bebc7036404.tar.gz |
gimble: fix motion sensors support
- Gimble need to add FIFO support for BMI160.
- Also add CONFIG_LID_ANGLE_UPDATE for disable keyboard when AP unable control the keyboard.
BUG=b:192423158
BRANCH=none
TEST=make -j BOARD=gimble
Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Change-Id: I3c8306764fd0a52a3bf08c0a95d9f8eecf849054
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3058160
Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r-- | board/gimble/board.h | 8 | ||||
-rw-r--r-- | board/gimble/sensors.c | 20 |
2 files changed, 28 insertions, 0 deletions
diff --git a/board/gimble/board.h b/board/gimble/board.h index 4f7e6d26cb..144be95449 100644 --- a/board/gimble/board.h +++ b/board/gimble/board.h @@ -40,9 +40,17 @@ /* Lid accel */ #define CONFIG_LID_ANGLE +#define CONFIG_LID_ANGLE_UPDATE #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL #define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +/* 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 256 +/* Depends on how fast the AP boots and typical ODRs */ +#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3) + /* Sensor console commands */ #define CONFIG_CMD_ACCELS #define CONFIG_CMD_ACCEL_INFO diff --git a/board/gimble/sensors.c b/board/gimble/sensors.c index 19acbd66fd..2931e68d31 100644 --- a/board/gimble/sensors.c +++ b/board/gimble/sensors.c @@ -10,6 +10,7 @@ #include "driver/accel_bma2x2_public.h" #include "driver/accelgyro_bmi_common.h" #include "hooks.h" +#include "keyboard_scan.h" #include "motion_sense.h" #include "temp_sensor.h" #include "thermal.h" @@ -221,3 +222,22 @@ struct ec_thermal_config thermal_params[] = { [TEMP_SENSOR_3_CHARGER] = thermal_inductor, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); + +#ifndef TEST_BUILD +void lid_angle_peripheral_enable(int enable) +{ + int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); + + if (enable) { + keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); + } else { + /* + * Ensure that the chipset is off before disabling the keyboard. + * When the chipset is on, the EC keeps the keyboard enabled and + * the AP decides whether to ignore input devices or not. + */ + if (!chipset_in_s0) + keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); + } +} +#endif |