summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-04-08 10:28:29 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-11 04:00:44 +0000
commiteaa645e0cc092fbaaa1a81ed5308831e71ebf86c (patch)
treeebf92cd466682ee38fc2d0f5caa801d6e8a3d431 /include
parent335ad0c397f61d81d7fb5db8e3fb24e9bc089a2d (diff)
downloadchrome-ec-eaa645e0cc092fbaaa1a81ed5308831e71ebf86c.tar.gz
accel: Add host cmd for setting lid angle threshold for disabling keyboard wake
Added a sub-command to the motionsense host command (0x2b) for getting/setting the lid angle at which the keyboard is disabled as a wake source in S3. The value can be anywhere from 0 to 360 degrees, default set to 180. Note, this only takes affect for boards that have CONFIG_LID_ANGLE_KEY_SCAN defined. Modified ectool motionsense command to use new host sub-command. Also modified the lid angle measurement in the EC to be in the range [0, 360], instead of [-180, 180], and changed casting of lid angle as an int to round to nearest. BUG=none BRANCH=rambi TEST=Tested on a glimmer: Using default keyboard disable lid angle of 180, made sure that when lid angle is past 180, key presses do not wake system, and when lid angle is less than 180, key presses do wake up system. Used ectool motionsense kb_wake to set the keyboard disable lid angle to 0. Made sure that keyboard never wakes up the system. Set keyboard disable lid angle to 360 and made sure that the keyboard always wakes up the system. Change-Id: I437164c6e38c29169ef6e20e86c9cf2a1c78f86e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193663 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194172
Diffstat (limited to 'include')
-rw-r--r--include/config.h5
-rw-r--r--include/ec_commands.h21
-rw-r--r--include/lid_angle.h8
-rw-r--r--include/motion_sense.h5
4 files changed, 28 insertions, 11 deletions
diff --git a/include/config.h b/include/config.h
index e89be9ca53..5a18ea4dee 100644
--- a/include/config.h
+++ b/include/config.h
@@ -576,11 +576,6 @@
/*
* 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
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 439e871d77..eac00da6b3 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1200,6 +1200,15 @@ enum motionsense_command {
*/
MOTIONSENSE_CMD_SENSOR_RANGE = 4,
+ /*
+ * Setter/getter command for the keyboard wake angle. When the lid
+ * angle is greater than this value, keyboard wake is disabled in S3,
+ * and when the lid angle goes less than this value, keyboard wake is
+ * enabled. Note, the lid angle measurement is an approximate,
+ * un-calibrated value, hence the wake angle isn't exact.
+ */
+ MOTIONSENSE_CMD_KB_WAKE_ANGLE = 5,
+
/* Number of motionsense sub-commands. */
MOTIONSENSE_NUM_CMDS
};
@@ -1254,11 +1263,14 @@ struct ec_params_motion_sense {
/* no args */
} dump;
- /* Used for MOTIONSENSE_CMD_EC_RATE. */
+ /*
+ * Used for MOTIONSENSE_CMD_EC_RATE and
+ * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
+ */
struct {
/* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
int16_t data;
- } ec_rate;
+ } ec_rate, kb_wake_angle;
/* Used for MOTIONSENSE_CMD_INFO. */
struct {
@@ -1313,12 +1325,13 @@ struct ec_response_motion_sense {
/*
* Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR,
- * and MOTIONSENSE_CMD_SENSOR_RANGE.
+ * MOTIONSENSE_CMD_SENSOR_RANGE, and
+ * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
*/
struct {
/* Current value of the parameter queried. */
int32_t ret;
- } ec_rate, sensor_odr, sensor_range;
+ } ec_rate, sensor_odr, sensor_range, kb_wake_angle;
};
} __packed;
diff --git a/include/lid_angle.h b/include/lid_angle.h
index bd60b90907..cd13265c93 100644
--- a/include/lid_angle.h
+++ b/include/lid_angle.h
@@ -17,4 +17,12 @@
*/
void lidangle_keyscan_update(float lid_ang);
+/**
+ * Getter and setter methods for the keyboard wake angle. In S3, when the
+ * lid angle is greater than this value, the keyboard is disabled, and when
+ * the lid angle is smaller than this value, the keyboard is enabled.
+ */
+int lid_angle_get_kb_wake_angle(void);
+void lid_angle_set_kb_wake_angle(int ang);
+
#endif /* __CROS_EC_LID_ANGLE_H */
diff --git a/include/motion_sense.h b/include/motion_sense.h
index d0c2774254..3a3b9b5121 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -53,9 +53,10 @@ struct accel_orientation acc_orient;
/**
- * Get last calculated lid angle.
+ * Get last calculated lid angle. Note, the lid angle calculated by the EC
+ * is un-calibrated and is an approximate angle.
*
- * @return lid angle in degrees in range [-180, 180].
+ * @return lid angle in degrees in range [0, 360].
*/
int motion_get_lid_angle(void);