summaryrefslogtreecommitdiff
path: root/board/eve
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2017-01-22 17:38:12 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-01-23 02:03:28 -0800
commit4dba3792ef2023dcd8e8e3766a34d4fde2aca082 (patch)
treedb6024b7d5eb936f820b89a2d411ab6d479857ab /board/eve
parent66828807afb81d6687fac6319a2d8340e82cef3d (diff)
downloadchrome-ec-4dba3792ef2023dcd8e8e3766a34d4fde2aca082.tar.gz
eve: Enable tablet mode
Enable basic tablet mode options using the tablet mode input. Do not enable the lid angle mode yet as the sensors appear to need some calibration before this is reliable. For now TP is still disabled by EC in tablet mode, this also needs re-evaluated and should in theory be done at the driver level instead of by the EC. BUG=chrome-os-partner:62223 BRANCH=none TEST=ensure keyboard and trackpad stop at 360 position and restored when opened Change-Id: I4e1d16dc74ae7e53e731644538d9ef85ac0b12b6 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/431139 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'board/eve')
-rw-r--r--board/eve/board.c17
-rw-r--r--board/eve/board.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/board/eve/board.c b/board/eve/board.c
index 3e0470c7ed..b076822102 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -42,6 +42,7 @@
#include "spi.h"
#include "switch.h"
#include "system.h"
+#include "tablet_mode.h"
#include "task.h"
#include "temp_sensor.h"
#include "timer.h"
@@ -78,9 +79,10 @@ static void tcpc_alert_event(enum gpio_signal signal)
static void enable_input_devices(void);
DECLARE_DEFERRED(enable_input_devices);
+#define LID_DEBOUNCE_US (30 * MSEC)
void tablet_mode_interrupt(enum gpio_signal signal)
{
- hook_call_deferred(&enable_input_devices_data, 0);
+ hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
}
#include "gpio_list.h"
@@ -310,9 +312,17 @@ static void board_pmic_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_pmic_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)
{
+ /* Enabure tablet mode is initialized */
+ board_set_tablet_mode();
+
/* Enable tablet mode interrupt for input device enable */
gpio_enable_interrupt(GPIO_TABLET_MODE_L);
@@ -540,8 +550,11 @@ static void enable_input_devices(void)
int kb_enable = 1;
int tp_enable = 1;
+ /* Turn on tablet mode for motion sense */
+ board_set_tablet_mode();
+
/* Disable both TP and KB in tablet mode */
- if (!gpio_get_level(GPIO_TABLET_MODE_L))
+ if (tablet_get_mode())
kb_enable = tp_enable = 0;
/* Disable TP if chipset is off */
else if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
diff --git a/board/eve/board.h b/board/eve/board.h
index af047e6348..78819a9970 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -61,6 +61,7 @@
#define CONFIG_KEYBOARD_BOARD_CONFIG
#define CONFIG_KEYBOARD_COL2_INVERTED
#define CONFIG_KEYBOARD_PROTOCOL_8042
+#define CONFIG_TABLET_MODE
/* Battery */
#define CONFIG_BATTERY_CUT_OFF