diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-09-27 16:29:10 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-02 23:36:33 +0000 |
commit | 1f122296529751fc53900b9d91f9f7176d957bd3 (patch) | |
tree | 024a4675dfca39ac63285768dc141afcde6ca2a0 | |
parent | 091981f72448941b73457750902b5a0c5a138f76 (diff) | |
download | chrome-ec-1f122296529751fc53900b9d91f9f7176d957bd3.tar.gz |
Wake keyboard task when lid opens
If keyboard scanning is active when the lid closes, it will disable
scanning put the scan task to sleep. We need a corresponding task
wake when the lid opens, or scanning will be stuck off (until
something else happens, like poking the power button).
BUG=chrome-os-partner:23040
BRANCH=leon
TEST=Hold down a key. Use a magnet to trigger the lid switch. Scanning
should stop while the lid is "closed", and restart when the magnet is
moved to "open" the lid again.
Change-Id: I365e4b65ca778234e4aaa53090765a08f975f064
Original-Change-Id: I0a900f17f65b75cbdb45950cea7f50190d2bf9b1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/170993
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/171530
Reviewed-by: Dave Parker <dparker@chromium.org>
Commit-Queue: 志偉 黃 <David.Huang@quantatw.com>
Tested-by: 志偉 黃 <David.Huang@quantatw.com>
-rw-r--r-- | common/keyboard_scan.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 2b7e15b1b2..d11d40af21 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -8,6 +8,7 @@ #include "chipset.h" #include "common.h" #include "console.h" +#include "hooks.h" #include "host_command.h" #include "keyboard_config.h" #include "keyboard_protocol.h" @@ -578,6 +579,18 @@ void keyboard_scan_enable(int enable) } } +#ifdef CONFIG_LID_SWITCH + +static void keyboard_lid_change(void) +{ + /* If lid is open, wake the keyboard task */ + if (lid_is_open()) + task_wake(TASK_ID_KEYSCAN); +} +DECLARE_HOOK(HOOK_LID_CHANGE, keyboard_lid_change, HOOK_PRIO_DEFAULT); + +#endif + /*****************************************************************************/ /* Host commands */ |