summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce <Bruce.Wan@quantatw.com>2016-12-09 15:52:38 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-09 14:37:21 -0800
commitb19c81b0b622df55583e920c9d9bc041e90dbcf3 (patch)
tree920ffc8924c32d2153186708825c9a1856eccf1f
parentf74c136a17e252c0c993ddeab2c2b71ca45f65ad (diff)
downloadchrome-ec-b19c81b0b622df55583e920c9d9bc041e90dbcf3.tar.gz
pyro/snappy: ensure tablet mode state is correct at startup
Follow reef setting. BUG=none BRANCH=none TEST=make buildall Change-Id: I953f5380820c1ff94be7d4dbf70ff744dfbf8f10 Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/418597 Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com> Tested-by: Keith Tzeng <keith.tzeng@quantatw.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--board/pyro/board.c13
-rw-r--r--board/snappy/board.c13
2 files changed, 24 insertions, 2 deletions
diff --git a/board/pyro/board.c b/board/pyro/board.c
index dc239746eb..38f3d37042 100644
--- a/board/pyro/board.c
+++ b/board/pyro/board.c
@@ -490,9 +490,20 @@ 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 +649,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.
diff --git a/board/snappy/board.c b/board/snappy/board.c
index 820572d8c4..63d1ff1ada 100644
--- a/board/snappy/board.c
+++ b/board/snappy/board.c
@@ -489,9 +489,20 @@ 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 */
@@ -637,7 +648,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.