From 7db12fdc3ec824e28554b96edb5e08fcdeb658cf Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Wed, 22 Mar 2017 11:31:56 -0700 Subject: [PATCH] eve: Fix corner case for trackpad wake If we go to sleep with a lid close event, the trackpad is immediately waking the system. Since we don't want to accidentally wake if the trackpad got input while the lid is closed anyway this change will disable trackpad wake when the lid is closed. BUG=b:35587072 BRANCH=none TEST=manual testing on Eve P1b: 1) enter suspend by closing lid and ensure it stays in suspend 2) enter suspend by idle, and then close the lid, and ensure it stays suspended Change-Id: Ied73dde61e99231f057504ca56c473432aa30e4b Signed-off-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/457865 Reviewed-by: Aaron Durbin Reviewed-by: Todd Broch --- board/eve/board.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/board/eve/board.c b/board/eve/board.c index 7b83c05659..7493ea249b 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -616,7 +616,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT); /* Called on AP S0 -> S3 transition */ static void board_chipset_suspend(void) { - if (!tablet_get_mode()) + if (!tablet_get_mode() && lid_is_open()) trackpad_wake_enable(1); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -628,6 +628,14 @@ static void board_chipset_resume(void) } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); +/* Called on lid change */ +static void board_lid_change(void) +{ + if (!lid_is_open()) + trackpad_wake_enable(0); +} +DECLARE_HOOK(HOOK_LID_CHANGE, board_lid_change, HOOK_PRIO_DEFAULT); + void board_hibernate_late(void) { int i;