mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
reef: ensure tablet mode state is correct at startup
The tablet mode value is set to 1 on each program start (RO power on
reset or any sysjump) in common tablet mode infrastructure. This
results in the tablet mode not ever reflecting current reality at the
beginning of each program. In addition to not being able to order
hook callbacks within a single hook it's the luck of the draw if
the tablet mode is set correctly if it was is being set within a
hook callback. With a lid accelerometer that doesn't work it
results in the input peripherals never being enabled.
To fix all this ensure the tablet mode state reflects the current
hardware input such that there's no ordering issues in addition to
making it reflect reality.
BUG=chrome-os-partner:60481
BRANCH=reef
TEST=With a machine whose accelerometer is unattached. Keyboard
and trackpad continue to work through suspend-resume, EC reboot,
etc.
Change-Id: I3456a7b578c9752344424721858756a33992a37d
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/416348
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
@@ -492,9 +492,18 @@ static void chipset_pre_init(void)
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, chipset_pre_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
static void board_set_tablet_mode(void)
|
||||
{
|
||||
tablet_set_mode(!gpio_get_level(GPIO_TABLET_MODE_L));
|
||||
}
|
||||
|
||||
/* Initialize board. */
|
||||
static void board_init(void)
|
||||
{
|
||||
/* Ensure tablet mode is initialized according to the hardware state
|
||||
* so that the cached state reflects reality. */
|
||||
board_set_tablet_mode();
|
||||
|
||||
gpio_enable_interrupt(GPIO_TABLET_MODE_L);
|
||||
|
||||
/* Enable charger interrupts */
|
||||
@@ -638,7 +647,7 @@ int board_is_vbus_too_low(enum chg_ramp_vbus_state ramp_state)
|
||||
static void enable_input_devices(void)
|
||||
{
|
||||
/* We need to turn on tablet mode for motion sense */
|
||||
tablet_set_mode(!gpio_get_level(GPIO_TABLET_MODE_L));
|
||||
board_set_tablet_mode();
|
||||
|
||||
/* Then, we disable peripherals only when the lid reaches 360 position.
|
||||
* (It's probably already disabled by motion_sense_task.)
|
||||
|
||||
Reference in New Issue
Block a user