From ba1f417b824cae748474a3a210d75f109f8a8473 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sun, 25 Nov 2018 17:48:19 -0800 Subject: motion_lid: Set tablet mode at 180 degree This change aligns tablet mode detection in EC to match the behavior of Chrome. When lid angle goes beyond 200 degree, tablet mode is set to 1. On the other hand, tablet mode is set to 0 when lid angle goes below 160 degree. BUG=b:120050761 BRANCH=None TEST=make -j buildall. Verified that EC reports tablet mode close to 180 degrees. Change-Id: If20a8e7545683b2a01f401f7db8d7973e70deb14 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/1350472 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh Reviewed-by: Aaron Durbin Reviewed-by: Jett Rink --- common/motion_lid.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/common/motion_lid.c b/common/motion_lid.c index 8d150e3b65..d737046c53 100644 --- a/common/motion_lid.c +++ b/common/motion_lid.c @@ -135,18 +135,18 @@ __attribute__((weak)) int board_is_lid_angle_tablet_mode(void) * - when lid is closed while the hinge is perpendicular to the floor, we will * stay in tablet mode. * - * Tablet mode is defined as the base being behind the lid. We use 2 threshold - * to calculate tablet mode: + * Tablet mode is defined as the lid angle being greater than 180 degree. We use + * 2 threshold to calculate tablet mode: * tablet_mode: - * 1 | +-----<----+---------- - * | \/ /\ - * | | | - * 0 |------------------------>----+ - * +------------------+----------+----------+ lid angle - * 0 240 300 360 + * 1 | +-----<----+---------- + * | \/ /\ + * | | | + * 0 |------------------>----+ + * +------------+----------+----------+ lid angle + * 0 160 200 360 */ -#define TABLET_ZONE_LID_ANGLE FLOAT_TO_FP(300) -#define LAPTOP_ZONE_LID_ANGLE FLOAT_TO_FP(240) +#define TABLET_ZONE_LID_ANGLE FLOAT_TO_FP(200) +#define LAPTOP_ZONE_LID_ANGLE FLOAT_TO_FP(160) /* * We will change our tablet mode status when we are "convinced" that it has -- cgit v1.2.1