diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-07-11 11:45:05 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-29 18:33:14 +0000 |
commit | d4a07be7e2638d79ab13c8ad60f68070e36d7310 (patch) | |
tree | 8e980de7d47d55dd544b47690fa1d3c59e085968 /common | |
parent | 2d50d3d5cb5c4c891e5281e9c48a87ff4361ada5 (diff) | |
download | chrome-ec-d4a07be7e2638d79ab13c8ad60f68070e36d7310.tar.gz |
PoC: tablet-mode: Disable tablet mode in recovery boot
In recovery boot, keyboard could be unintentionally disabled due to
unstable accels, which are not calibrated.
This patch disables tablet mode in recovery boot.
We get the same effect if motion sensors or a motion sense task are
disabled in RO.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=chromium:984086,b/137251616
BRANCH=none
TEST=buildall
Change-Id: Idcf53ad119edbd8ff9362523ec7a72f438ae4401
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1696914
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/keyboard_scan.c | 11 | ||||
-rw-r--r-- | common/tablet_mode.c | 9 |
2 files changed, 18 insertions, 2 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 787fb8f937..954ff1319a 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -19,6 +19,7 @@ #include "lid_switch.h" #include "switch.h" #include "system.h" +#include "tablet_mode.h" #include "task.h" #include "timer.h" #include "usb_api.h" @@ -690,6 +691,16 @@ void keyboard_scan_init(void) #ifdef CONFIG_HOSTCMD_EVENTS if (boot_key_value & BOOT_KEY_ESC) { host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY); + /* + * In recovery mode, we should force clamshell mode in order to + * prevent the keyboard from being disabled unintentionally due + * to unstable accel readings. + * + * You get the same effect if motion sensors or a motion sense + * task are disabled in RO. + */ + if (IS_ENABLED(CONFIG_TABLET_MODE)) + tablet_disable(); if (boot_key_value & BOOT_KEY_LEFT_SHIFT) host_set_single_event( EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT); diff --git a/common/tablet_mode.c b/common/tablet_mode.c index 652756b665..efd2252b97 100644 --- a/common/tablet_mode.c +++ b/common/tablet_mode.c @@ -59,6 +59,12 @@ void tablet_set_mode(int mode) #endif } +void tablet_disable(void) +{ + tablet_mode = 0; + disabled = 1; +} + /* This ifdef can be removed once we clean up past projects which do own init */ #ifdef CONFIG_HALL_SENSOR #ifndef HALL_SENSOR_GPIO_L @@ -120,7 +126,6 @@ void hall_sensor_disable(void) gpio_disable_interrupt(HALL_SENSOR_GPIO_L); /* Cancel any pending debounce calls */ hook_call_deferred(&hall_sensor_interrupt_debounce_data, -1); - tablet_set_mode(0); - disabled = 1; + tablet_disable(); } #endif |