diff options
author | Ting Shen <phoenixshen@google.com> | 2021-03-17 18:29:23 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-08 06:16:14 +0000 |
commit | 934240abc1f76ba809b94b3ccda957a4179e251b (patch) | |
tree | 3ab8b7804f500dcfed58ecedf779239dee4cdd2c | |
parent | d2736a71fb342419ed7e548affe252e93e95196c (diff) | |
download | chrome-ec-934240abc1f76ba809b94b3ccda957a4179e251b.tar.gz |
jacuzzi: enable keyboard scanning in S0/tablet
Most Jacuzzi devices copied the incorrect lid_angle_peripheral_enable
code from Reef. Fix this by sharing Willow's good implementation
to all followers.
BUG=b:181852624
TEST=1) make buildall
2) manually test on fennel
BRANCH=kukui
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: Ie2dd79d5d0dcebe564664c357db73c5956d1b14b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2765633
Tested-by: Ting Shen <phoenixshen@chromium.org>
Auto-Submit: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Commit-Queue: Eric Yilun Lin <yllin@chromium.org>
(cherry picked from commit 759c9d46a03fe87735b2abda0f77abb27d6573d3)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2783509
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
(cherry picked from commit 382c10a0dc83b98a293c75f1a0a5e6ec0b300e39)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3211316
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Shou-Chieh Hsu <shouchieh@chromium.org>
Tested-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Commit-Queue: Shou-Chieh Hsu <shouchieh@chromium.org>
-rw-r--r-- | baseboard/kukui/baseboard.c | 25 | ||||
-rw-r--r-- | board/burnet/board.c | 13 | ||||
-rw-r--r-- | board/cerise/board.c | 13 | ||||
-rw-r--r-- | board/damu/board.c | 13 | ||||
-rw-r--r-- | board/fennel/board.c | 13 | ||||
-rw-r--r-- | board/stern/board.c | 13 | ||||
-rw-r--r-- | board/willow/board.c | 21 |
7 files changed, 25 insertions, 86 deletions
diff --git a/baseboard/kukui/baseboard.c b/baseboard/kukui/baseboard.c index d53c930217..dee147535b 100644 --- a/baseboard/kukui/baseboard.c +++ b/baseboard/kukui/baseboard.c @@ -5,8 +5,11 @@ #include "adc.h" #include "adc_chip.h" +#include "charger.h" +#include "chipset.h" #include "gpio.h" #include "hooks.h" +#include "keyboard_scan.h" #include "registers.h" #include "spi_chip.h" #include "timer.h" @@ -124,3 +127,25 @@ int board_allow_i2c_passthru(int port) { return (port == I2C_PORT_VIRTUAL_BATTERY); } + +/* Enable or disable input devices, based on chipset state and tablet mode */ +#if !defined(TEST_BUILD) && defined(VARIANT_KUKUI_JACUZZI) +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 diff --git a/board/burnet/board.c b/board/burnet/board.c index bf9afa354d..a9555ce95d 100644 --- a/board/burnet/board.c +++ b/board/burnet/board.c @@ -470,16 +470,3 @@ int battery_set_vendor_param(uint32_t param, uint32_t value) { return EC_ERROR_UNIMPLEMENTED; } - -/* Enable or disable input devices, based on chipset state and tablet mode */ -#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); -} -#endif diff --git a/board/cerise/board.c b/board/cerise/board.c index a4fcc7490f..4d449496c1 100644 --- a/board/cerise/board.c +++ b/board/cerise/board.c @@ -453,16 +453,3 @@ int board_get_charger_i2c(void) /* TODO(b:138415463): confirm the bus allocation for future builds */ return board_get_version() == 1 ? 2 : 1; } - -/* Enable or disable input devices, based on chipset state and tablet mode */ -#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); -} -#endif diff --git a/board/damu/board.c b/board/damu/board.c index 2f28a6ca3c..4721f857ca 100644 --- a/board/damu/board.c +++ b/board/damu/board.c @@ -434,16 +434,3 @@ int board_get_charger_i2c(void) /* TODO(b:138415463): confirm the bus allocation for future builds */ return board_get_version() == 1 ? 2 : 1; } - -/* Enable or disable input devices, based on chipset state and tablet mode */ -#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); -} -#endif diff --git a/board/fennel/board.c b/board/fennel/board.c index fb03665c55..a3cd06416e 100644 --- a/board/fennel/board.c +++ b/board/fennel/board.c @@ -556,16 +556,3 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY, host_command_pwm_get_duty, EC_VER_MASK(0)); #endif - -/* Enable or disable input devices, based on chipset state and tablet mode */ -#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); -} -#endif diff --git a/board/stern/board.c b/board/stern/board.c index 49580dc656..d32cb34ba3 100644 --- a/board/stern/board.c +++ b/board/stern/board.c @@ -434,16 +434,3 @@ int board_get_charger_i2c(void) /* TODO(b:138415463): confirm the bus allocation for future builds */ return board_get_version() == 1 ? 2 : 1; } - -/* Enable or disable input devices, based on chipset state and tablet mode */ -#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); -} -#endif diff --git a/board/willow/board.c b/board/willow/board.c index b4ec62dfc4..1c4470bfe4 100644 --- a/board/willow/board.c +++ b/board/willow/board.c @@ -427,24 +427,3 @@ int board_get_battery_i2c(void) { return board_get_version() >= 1 ? 2 : 1; } - -#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 |