diff options
author | Boris Mittelberg <bmbm@google.com> | 2021-09-23 17:03:36 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-29 23:39:44 +0000 |
commit | 78911f24fdfebf1fa2faf1fcfe2df1aeac897993 (patch) | |
tree | baca6ec86f057297cb095563573fbea78db2fbef | |
parent | 4fd5585399aebc04182daf17c57da1d3ff3c764b (diff) | |
download | chrome-ec-78911f24fdfebf1fa2faf1fcfe2df1aeac897993.tar.gz |
brya family: fix keyboard wake in tablet mode
Block keyscan in S0ix, when the device is in tablet mode
BUG=b:199114579
BRANCH=none
TEST=manual, as described in b:199114579
Signed-off-by: Boris Mittelberg <bmbm@google.com>
Change-Id: I17c5fc55e5e07ae180275aba492ef491b2d116cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3180270
Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r-- | baseboard/brya/baseboard.c | 28 | ||||
-rw-r--r-- | board/brya/board.h | 1 | ||||
-rw-r--r-- | board/felwinter/board.h | 1 | ||||
-rw-r--r-- | board/redrix/board.h | 1 | ||||
-rw-r--r-- | board/taeko/board.h | 1 |
5 files changed, 31 insertions, 1 deletions
diff --git a/baseboard/brya/baseboard.c b/baseboard/brya/baseboard.c index 976831812f..707533762b 100644 --- a/baseboard/brya/baseboard.c +++ b/baseboard/brya/baseboard.c @@ -3,10 +3,12 @@ * found in the LICENSE file. */ +#include "chipset.h" #include "common.h" #include "compile_time_macros.h" - #include "gpio_signal.h" +#include "keyboard_scan.h" +#include "tablet_mode.h" /* Wake up pins */ const enum gpio_signal hibernate_wake_pins[] = { @@ -15,3 +17,27 @@ const enum gpio_signal hibernate_wake_pins[] = { GPIO_LID_OPEN, }; const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); + +/* This callback disables keyboard when convertibles are fully open */ +__override void lid_angle_peripheral_enable(int enable) +{ + /* + * If the lid is in tablet position via other sensors, + * ignore the lid angle, which might be faulty then + * disable keyboard. + */ + if (tablet_get_mode()) + enable = 0; + + if (enable) { + keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); + } else { + /* + * When the chipset is on, the EC keeps the keyboard enabled and + * Ensure that the chipset is off before disabling the keyboard. + * the AP decides whether to ignore input devices or not. + */ + if (!chipset_in_state(CHIPSET_STATE_ON)) + keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); + } +} diff --git a/board/brya/board.h b/board/brya/board.h index a7e91a0507..f12f5eb2fb 100644 --- a/board/brya/board.h +++ b/board/brya/board.h @@ -63,6 +63,7 @@ /* 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 #define CONFIG_ACCEL_LIS2DWL diff --git a/board/felwinter/board.h b/board/felwinter/board.h index d9fb63c789..a9be822e5f 100644 --- a/board/felwinter/board.h +++ b/board/felwinter/board.h @@ -49,6 +49,7 @@ #define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) /* 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 #define CONFIG_ACCEL_LIS2DWL diff --git a/board/redrix/board.h b/board/redrix/board.h index 091d4e7318..5b47a9dcf2 100644 --- a/board/redrix/board.h +++ b/board/redrix/board.h @@ -25,6 +25,7 @@ #define CONFIG_ACCEL_LSM6DSM_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_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 diff --git a/board/taeko/board.h b/board/taeko/board.h index 7b7995f001..a7626558c5 100644 --- a/board/taeko/board.h +++ b/board/taeko/board.h @@ -55,6 +55,7 @@ /* 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 #define CONFIG_ACCEL_BMA4XX |