summaryrefslogtreecommitdiff
path: root/board/waddledoo/board.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-01-14 15:47:26 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-21 23:55:43 +0000
commit2ee7178ac6b54c70d5ddad78c48eb7df7fcd3861 (patch)
treefe37af56b1553056f90fd8dbe220ae36584af253 /board/waddledoo/board.c
parentad996f4235597d7a3b64dbfc5c050cc4055a5194 (diff)
downloadchrome-ec-2ee7178ac6b54c70d5ddad78c48eb7df7fcd3861.tar.gz
waddledoo: Add keyboard support
This commit adds keyboard support to waddledoo using the default keyboard config. BUG=b:147453459 BRANCH=None TEST=Flash waddledoo, connect keyboard, `ksstate on` verify that each key is registered. Change-Id: I0a10eeb3080170c731f90317d4a0b3c0fbfb9243 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2001940 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/waddledoo/board.c')
-rw-r--r--board/waddledoo/board.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c
index a9303be923..6734eec156 100644
--- a/board/waddledoo/board.c
+++ b/board/waddledoo/board.c
@@ -23,6 +23,7 @@
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
+#include "keyboard_scan.h"
#include "lid_switch.h"
#include "motion_sense.h"
#include "power.h"
@@ -360,6 +361,8 @@ uint16_t tcpc_get_alert_status(void)
/* This callback disables keyboard when convertibles are fully open */
void lid_angle_peripheral_enable(int enable)
{
+ int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON);
+
/*
* If the lid is in tablet position via other sensors,
* ignore the lid angle, which might be faulty then
@@ -367,10 +370,17 @@ void lid_angle_peripheral_enable(int enable)
*/
if (tablet_get_mode())
enable = 0;
- /*
- * TODO(b/147453459): Waddledoo: add keyboard support
- * disable keyboard here when AP is off
- *
- */
+
+ 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