diff options
author | Jes Klinke <jbk@google.com> | 2020-06-11 16:03:09 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-12 21:04:59 +0000 |
commit | abf6b6e1d502101ccae25b500811d87925feaa2c (patch) | |
tree | 74b5bb80df71d29ba2f49710842263016eb490a3 | |
parent | c8e36edc96360458dd29919e88a85a6749f1740b (diff) | |
download | chrome-ec-abf6b6e1d502101ccae25b500811d87925feaa2c.tar.gz |
asurada/lazor/voxel/yorp: Only disable keyscanning when not in S0.
Duplicate of: https://chromium-review.googlesource.com/1089823
for remaining boards not covered by
https://chromium-review.googlesource.com/2242352
BUG=b:158792057
TEST=make -j buildall
BRANCH=asurada,octopus
Change-Id: Ic3ae36629d75ff20e96910c107e67f933fa4cce5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242396
Commit-Queue: Jes Klinke <jbk@chromium.org>
Tested-by: Jes Klinke <jbk@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | board/asurada/board.c | 21 | ||||
-rw-r--r-- | board/lazor/board.c | 22 | ||||
-rw-r--r-- | board/voxel/sensors.c | 22 | ||||
-rw-r--r-- | board/yorp/board.c | 20 |
4 files changed, 51 insertions, 34 deletions
diff --git a/board/asurada/board.c b/board/asurada/board.c index d58ebb734d..a06dd6079a 100644 --- a/board/asurada/board.c +++ b/board/asurada/board.c @@ -437,14 +437,19 @@ __override uint8_t board_get_usb_pd_port_count(void) /* This callback disables keyboard when convertibles are fully open */ 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; - 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 diff --git a/board/lazor/board.c b/board/lazor/board.c index 3d9b057a73..1df3ab4b6b 100644 --- a/board/lazor/board.c +++ b/board/lazor/board.c @@ -511,14 +511,18 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); /* This callback disables keyboard when convertibles are fully open */ 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; - - 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 diff --git a/board/voxel/sensors.c b/board/voxel/sensors.c index 0a8b051699..9e34812131 100644 --- a/board/voxel/sensors.c +++ b/board/voxel/sensors.c @@ -228,14 +228,18 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_DEFAULT); #ifndef TEST_BUILD 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; - - 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 diff --git a/board/yorp/board.c b/board/yorp/board.c index 0afa7ec06d..d080b8d446 100644 --- a/board/yorp/board.c +++ b/board/yorp/board.c @@ -214,15 +214,19 @@ void board_hibernate_late(void) { /* This callback disables keyboard when convertibles are fully open */ 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; + int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); + 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); + } } |