diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-03-14 09:27:31 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-27 18:44:14 +0000 |
commit | 242f1957714153075e2eb9d5541923d28f05ec7c (patch) | |
tree | 72e26d49e5e8c063a8f8df864d10f98bc741016c /include | |
parent | 6d745d8fd3016c6dc1b17ad1cd9b21ce65671a5a (diff) | |
download | chrome-ec-242f1957714153075e2eb9d5541923d28f05ec7c.tar.gz |
rambi: glimmer: Disable key scanning in suspend when lid is open
Added ability to disable the keyboard to wake from suspend when the lid
is outside a certain angle range. This has been added to glimmer by
defining CONFIG_LID_ANGLE_KEY_SCAN in its board.h.
Also modified the lid angle calculation to include a reliability
flag which can be used to tell when the hinge aligns too closely
with gravity and the lid angle value is unreliable.
BUG=none
BRANCH=rambi
TEST=Tested on a glimmer:
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: I45b2c7c3c4bbcae61d3a0f8b5baa461ab8dabfb0
Original-Change-Id: If1a1592d259902d38941936961854b81b3a75b95
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190061
Reviewed-on: https://chromium-review.googlesource.com/191612
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 11 | ||||
-rw-r--r-- | include/console.h | 1 | ||||
-rw-r--r-- | include/keyboard_scan.h | 5 | ||||
-rw-r--r-- | include/lid_angle.h | 20 | ||||
-rw-r--r-- | include/motion_sense.h | 3 |
5 files changed, 40 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index 300126a6cf..68402985ec 100644 --- a/include/config.h +++ b/include/config.h @@ -559,6 +559,17 @@ #undef CONFIG_LED_DRIVER_LP5562 /* LP5562, on I2C interface */ /* + * Allows using the lid angle measurement to determine if key scanning should + * be enabled or disabled when chipset is suspended. + * + * Any board that defines this must also define two macros: + * LID_IN_RANGE_TO_ACCEPT_KEYS(angle), LID_IN_RANGE_TO_IGNORE_KEYS(angle). + * These macros should return true if the given angle argument is in range + * to accept or ignore key presses. + */ +#undef CONFIG_LID_ANGLE_KEY_SCAN + +/* * Compile lid switch support. * * This is enabled by default because all boards other than reference boards diff --git a/include/console.h b/include/console.h index 8106e54f56..a6cce1fa8c 100644 --- a/include/console.h +++ b/include/console.h @@ -39,6 +39,7 @@ enum console_channel { CC_I2C, CC_KEYBOARD, CC_KEYSCAN, + CC_LIDANGLE, CC_LIGHTBAR, CC_LPC, CC_MOTION_SENSE, diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h index bc956cc685..8359cbd174 100644 --- a/include/keyboard_scan.h +++ b/include/keyboard_scan.h @@ -84,6 +84,11 @@ void keyboard_scan_enable(int enable); static inline void keyboard_scan_enable(int enable) { } #endif +/** + * Returns if keyboard matrix scanning is enabled/disabled. + */ +int keyboard_scan_is_enabled(void); + #ifdef CONFIG_KEYBOARD_SUPPRESS_NOISE /** * Indicate to audio codec that a key has been pressed. diff --git a/include/lid_angle.h b/include/lid_angle.h new file mode 100644 index 0000000000..bd60b90907 --- /dev/null +++ b/include/lid_angle.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Lid angle module for Chrome EC */ + +#ifndef __CROS_EC_LID_ANGLE_H +#define __CROS_EC_LID_ANGLE_H + +/** + * Update the lid angle module with the most recent lid angle calculation. Then + * use the lid angle history to enable/disable keyboard scanning when chipset + * is suspended. + * + * @lid_ang Lid angle. + */ +void lidangle_keyscan_update(float lid_ang); + +#endif /* __CROS_EC_LID_ANGLE_H */ diff --git a/include/motion_sense.h b/include/motion_sense.h index 08aefbcc0b..d0c2774254 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -11,6 +11,9 @@ #include "gpio.h" #include "math_util.h" +/* Anything outside of lid angle range [-180, 180] should work. */ +#define LID_ANGLE_UNRELIABLE 500.0F + /** * This structure defines all of the data needed to specify the orientation * of the base and lid accelerometers in order to calculate the lid angle. |