diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-08-20 08:59:58 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-03 02:20:47 -0700 |
commit | c355ba59732e25a4c8bff89e63e89f0faafa8afc (patch) | |
tree | 0d2db50ae8c6f00d473d5d2161b2ebf03a7bf248 /board | |
parent | be9683a42d06097161ae09919dcfedd218a3c576 (diff) | |
download | chrome-ec-c355ba59732e25a4c8bff89e63e89f0faafa8afc.tar.gz |
whiskers: Disable keyboard scanning and touchpad in tablet mode
When in tablet mode, disable keyboard scanning and touchpad.
Refactor touchpad_*.c power management to take both into account
(there is some duplicated code here, that we may want to merge
in the future).
This will also prevent magic keyboard from working, but we are
ok with this, at least for now.
BRANCH=none
BUG=b:73133611
TEST=In tablet mode, keyboard scanning and touchpad are both disabled.
Change-Id: I51b7c50b90cca9b9f574c5c611daa89fe8a480bb
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1180639
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/hammer/board.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/board/hammer/board.c b/board/hammer/board.c index b91d775437..06f231e25a 100644 --- a/board/hammer/board.c +++ b/board/hammer/board.c @@ -256,6 +256,23 @@ void board_touchpad_reset(void) #endif } +#if defined(BOARD_WHISKERS) && defined(SECTION_IS_RW) +static void board_tablet_mode_change(void) +{ + /* + * Turn off key scanning in tablet mode. + */ + if (tablet_get_mode()) + keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); + else + keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); +} +DECLARE_HOOK(HOOK_TABLET_MODE_CHANGE, board_tablet_mode_change, + HOOK_PRIO_DEFAULT); +/* Run after tablet_mode_init. */ +DECLARE_HOOK(HOOK_INIT, board_tablet_mode_change, HOOK_PRIO_DEFAULT+1); +#endif + /* * Get entropy based on Clock Recovery System, which is enabled on hammer to * synchronize USB SOF with internal oscillator. |