summaryrefslogtreecommitdiff
path: root/baseboard/kukui
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2021-03-17 18:29:23 +0800
committerCommit Bot <commit-bot@chromium.org>2021-03-23 04:09:16 +0000
commit759c9d46a03fe87735b2abda0f77abb27d6573d3 (patch)
tree52c334edd547f18f2c87cbef8f42cda8f94bb413 /baseboard/kukui
parenta65d9bdee3e6e357e4c0fa348f152f51ec0f36fc (diff)
downloadchrome-ec-759c9d46a03fe87735b2abda0f77abb27d6573d3.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>
Diffstat (limited to 'baseboard/kukui')
-rw-r--r--baseboard/kukui/baseboard.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/baseboard/kukui/baseboard.c b/baseboard/kukui/baseboard.c
index ed5a0974d2..9eef6c2ef4 100644
--- a/baseboard/kukui/baseboard.c
+++ b/baseboard/kukui/baseboard.c
@@ -6,8 +6,10 @@
#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 "timer.h"
@@ -154,3 +156,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