From 2c3033bf911c22e5ba4a09b3b01329d41ab0d082 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Wed, 6 Jun 2018 17:48:23 -0700 Subject: nautilus: Only disable keyscanning when not in S0. Devices should not disable keyboard scanning when the chipset is in S0. Thy should keep the keyboard enabled and continue to forward the keys to the AP such that the AP can make the decision whether to ignore them or not. BUG=b:79670788 BRANCH=poppy TEST=Flash nautilus; Connect external display, reduce brightness on internal display to make external display the primary display; Enter tablet mode, verify that keyboard presses still show up in the UI. Change-Id: I452299726c6e8b388eb1061c23bed013228c2a2c Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/1089823 Tested-by: Aseda Aboagye Reviewed-by: Alexandru M Stan Commit-Queue: Aseda Aboagye --- board/nautilus/board.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/board/nautilus/board.c b/board/nautilus/board.c index b47774330b..834496cb99 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -700,12 +700,19 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); #ifndef TEST_BUILD void lid_angle_peripheral_enable(int enable) { - /* If the lid is in 360 position, ignore the lid angle, - * which might be faulty. Disable keyboard. - */ - if (tablet_get_mode() || chipset_in_state(CHIPSET_STATE_ANY_OFF)) - enable = 0; - keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); + 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 -- cgit v1.2.1