From 6fe3172ac05a2b51422f1eaf99237e375184613f Mon Sep 17 00:00:00 2001 From: ChromeOS Developer Date: Thu, 30 Jan 2014 15:27:58 -0800 Subject: Config option for using power button with lid closed BUG=chrome-os-partner:24912 BRANCH=baytrail TEST=Manual. Enable CONFIG_POWER_BUTTON_IGNORE_LID on a device, boot it, and go into dock mode with external monitor attached. Fake-close the lid with a magnet or servo. Verify the power button still sends press/release events to the host with evtest. Change-Id: Idb05375eee0743a8a2c459070854c03fe3afe894 Signed-off-by: Dave Parker Reviewed-on: https://chromium-review.googlesource.com/184493 Reviewed-by: Randall Spangler --- common/power_button.c | 8 +++++++- include/config.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/power_button.c b/common/power_button.c index bbbe205ba6..ae20083c52 100644 --- a/common/power_button.c +++ b/common/power_button.c @@ -35,9 +35,15 @@ static int raw_power_button_pressed(void) if (simulate_power_pressed) return 1; - /* Ignore power button if lid is closed */ +#ifndef CONFIG_POWER_BUTTON_IGNORE_LID + /* + * Always indicate power button released if the lid is closed. + * This prevents waking the system if the device is squashed enough to + * press the power button through the closed lid. + */ if (!lid_is_open()) return 0; +#endif return gpio_get_level(GPIO_POWER_BUTTON_L) ? 0 : 1; } diff --git a/include/config.h b/include/config.h index 46b6faef17..c84186620f 100644 --- a/include/config.h +++ b/include/config.h @@ -574,6 +574,9 @@ /* Compile common code to support power button debouncing */ #undef CONFIG_POWER_BUTTON +/* Allow the power button to send events while the lid is closed */ +#undef CONFIG_POWER_BUTTON_IGNORE_LID + /* Support sending the power button signal to x86 chipsets */ #undef CONFIG_POWER_BUTTON_X86 -- cgit v1.2.1