diff options
author | Edward Hill <ecgh@chromium.org> | 2020-09-24 15:49:27 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-25 05:12:15 +0000 |
commit | 8012d164fe7a2c4fc53fe0495bac137d5b32c5ae (patch) | |
tree | 628988b4ddcfc3bdea200d841c0dc434559982d1 /common/lid_angle.c | |
parent | 9cf30804f85c8029c25944b6c8db4d6e242e21f8 (diff) | |
download | chrome-ec-8012d164fe7a2c4fc53fe0495bac137d5b32c5ae.tar.gz |
lid_angle: Disable peripherals in S3 in tablet mode
Add a HOOK_CHIPSET_SUSPEND to call lid_angle_peripheral_enable(0)
when in tablet mode.
Usually lid_angle_update() calls lid_angle_peripheral_enable() in
both S0 and S3 but this stops if LID_ANGLE_UNRELIABLE, which can
allow peripherals to remain enabled in S3, which then causes eg
unwanted wake from keyboard in tablet mode.
BUG=b:167933375
BRANCH=zork
TEST=S0, tablet mode, S3, press keyboard, stays in S3
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: I6abc425993ad9eb10e97437708edd9edb45b6941
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2429211
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/lid_angle.c')
-rw-r--r-- | common/lid_angle.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/lid_angle.c b/common/lid_angle.c index 94ecce9549..295f5486ac 100644 --- a/common/lid_angle.c +++ b/common/lid_angle.c @@ -15,6 +15,7 @@ #include "math_util.h" #include "motion_lid.h" #include "motion_sense.h" +#include "tablet_mode.h" /* Console output macros */ #define CPUTS(outstr) cputs(CC_LIDANGLE, outstr) @@ -165,6 +166,18 @@ static void enable_peripherals(void) } DECLARE_HOOK(HOOK_CHIPSET_RESUME, enable_peripherals, HOOK_PRIO_DEFAULT); +#ifdef CONFIG_TABLET_MODE +static void suspend_peripherals(void) +{ + /* + * Make sure peripherals are disabled in S3 in tablet mode. + */ + if (tablet_get_mode()) + lid_angle_peripheral_enable(0); +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, suspend_peripherals, HOOK_PRIO_DEFAULT); +#endif /* CONFIG_TABLET_MODE */ + /* Board level callback was not linked in test build, implement it here. */ #ifdef TEST_BUILD void lid_angle_peripheral_enable(int enable) |