diff options
author | Furquan Shaikh <furquan@google.com> | 2018-11-27 19:44:19 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-12-26 03:20:33 +0000 |
commit | a449a4992294e1a8d764cc15d9d48037e5c73d7d (patch) | |
tree | d5b5a43a5acfe52ffa707d8b1e0c40d31c6d9a3c /include/ec_commands.h | |
parent | 38293c664adb17f0ffdc03d0a36b2860e1437693 (diff) | |
download | chrome-ec-a449a4992294e1a8d764cc15d9d48037e5c73d7d.tar.gz |
motion_lid: Allow host to configure tablet mode detection threshold
This change adds support for host to configure the tablet mode
threshold angle and hysteresis degree using a new motionsense command
MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. Additionally, the EC sets a new
feature bit to indicate support for this refined tablet mode
detection. This feature bit can be used by kernel to expose an
inclinometer device which can eventually help remove the redundant lid
angle calculation in Chrome.
BUG=b:120050761
BRANCH=octopus
TEST=make -j buildall. Additionally, verified that tablet mode lid
angle can be configured by host using ectool. Also, feature flag is
correctly set to indicate support for this feature.
Change-Id: I51bd160bbfae02d899bdf63096618c13eb5800e8
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1351518
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/1379416
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Tested-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Commit-Queue: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Diffstat (limited to 'include/ec_commands.h')
-rw-r--r-- | include/ec_commands.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index d0b272e8a8..76bf97f1c0 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -1330,6 +1330,12 @@ enum ec_feature_code { EC_FEATURE_CEC = 35, /* EC supports tight sensor timestamping. */ EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS = 36, + /* + * EC supports tablet mode detection aligned to Chrome and allows + * setting of threshold by host command using + * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. + */ + EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, }; #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) @@ -2359,6 +2365,9 @@ enum motionsense_command { */ MOTIONSENSE_CMD_SPOOF = 16, + /* Set lid angle for tablet mode detection. */ + MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE = 17, + /* Number of motionsense sub-commands. */ MOTIONSENSE_NUM_CMDS }; @@ -2629,6 +2638,24 @@ struct ec_params_motion_sense { /* Individual component values to spoof. */ int16_t components[3]; } spoof; + + /* Used for MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. */ + struct __ec_todo_unpacked { + /* + * Lid angle threshold for switching between tablet and + * clamshell mode. + */ + int16_t lid_ang; + + /* + * Hysteresis degree to prevent fluctuations between + * clamshell and tablet mode if lid angle keeps + * changing around the threshold. Lid motion driver will + * use lid_ang + hys_deg to trigger tablet mode and + * lid_ang - hys_deg to trigger clamshell mode. + */ + int16_t hys_deg; + } tablet_mode_threshold; }; } __ec_todo_packed; @@ -2724,6 +2751,19 @@ struct ec_response_motion_sense { */ uint16_t value; } lid_angle; + + /* Used for MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. */ + struct __ec_todo_unpacked { + /* + * Lid angle threshold for switching between tablet and + * clamshell mode. + */ + uint16_t lid_ang; + + /* Hysteresis degree. */ + uint16_t hys_deg; + } tablet_mode_threshold; + }; } __ec_todo_packed; |