summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parker <dparker@chromium.org>2014-04-05 13:56:54 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-07 22:52:19 +0000
commit7c0c346c004cd53dfa1978f362b365bc2e690908 (patch)
tree165cedd1274f089126c96dfdf2e3ed7d09bea3f9
parent3e4114921efb380074a575cf243f9fb173a9c283 (diff)
downloadchrome-ec-7c0c346c004cd53dfa1978f362b365bc2e690908.tar.gz
Clapper: Disable keyboard in suspend if lid is open beyond ~180 deg
Added ability to disable the keyboard to wake from suspend when the lid is outside a certain angle range. BUG=none BRANCH=None TEST=Tested on a clapper: In S3, verified that when the lid is open past ~180 deg, the keyboard does not wake the machine. Also verified that if you align hinge with gravity, the keyboard enabled/disabled status remains the same (since we can't actually trust the lid angle value). Change-Id: I349e0fbc8def41f0280e2fb40af24fab4d465e3c Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193409 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/clapper/board.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/board/clapper/board.h b/board/clapper/board.h
index 6382f15dcd..a3d9c693f8 100644
--- a/board/clapper/board.h
+++ b/board/clapper/board.h
@@ -30,6 +30,7 @@
#define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
+#define CONFIG_LID_ANGLE_KEY_SCAN
#define CONFIG_LOW_POWER_IDLE
#undef CONFIG_PECI
#define CONFIG_POWER_BUTTON
@@ -70,6 +71,18 @@
#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN
#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN
+/*
+ * Macros to be used in suspend to determine the state of key scanning
+ * based on measured lid angle. Note that the angle input is bound [-180, 180]
+ * where 0 degrees is lid closed/lid fully open. Also note that the key scan
+ * enable state will only change if recent readings are all within range,
+ * therefore it is recommended to leave a deadband where the lid angle doesn't
+ * fit into either range. Also note, if lid is closed, key scanning is
+ * automatically disabled.
+ */
+#define LID_IN_RANGE_TO_ACCEPT_KEYS(ang) ((ang) >= 15 || (ang) <= -173)
+#define LID_IN_RANGE_TO_IGNORE_KEYS(ang) ((ang) <= 12 && (ang) >= -170)
+
/* GPIO signal definitions. */
enum gpio_signal {
/* Inputs with interrupt handlers are first for efficiency */