From 061a0fe23702761984e8ee93fb25f7481ae012d2 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 9 Mar 2017 13:02:06 -0800 Subject: [PATCH] poppy: Enable tablet mode BUG=b:35775100 BRANCH=None TEST=Verified that tablet mode switch events can be seen in evtest. Event: time 1489093184.754803, -------------- SYN_REPORT ------------ Event: time 1489093196.842930, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0 Event: time 1489093196.842930, -------------- SYN_REPORT ------------ Event: time 1489093198.839809, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1 Event: time 1489093198.839809, -------------- SYN_REPORT ------------ Change-Id: Id47e817ba12294cc07281df3e04a9d68dec40ee7 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/451582 Reviewed-by: Aaron Durbin --- board/poppy/board.c | 5 +++++ board/poppy/board.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/board/poppy/board.c b/board/poppy/board.c index 6c4bde140f..9776cbcf6b 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -40,6 +40,7 @@ #include "spi.h" #include "switch.h" #include "system.h" +#include "tablet_mode.h" #include "task.h" #include "temp_sensor.h" #include "timer.h" @@ -148,6 +149,9 @@ enum base_status { * status. Actions taken include: * 1. Change in power to base * 2. Indicate mode change to host. + * 3. Indicate tablet mode to host. Current assumption is that if base is + * disconnected then the system is in tablet mode, else if the base is + * connected, then the system is not in tablet mode. */ static void base_detect_change(enum base_status connected) { @@ -155,6 +159,7 @@ static void base_detect_change(enum base_status connected) "not " : ""); gpio_set_level(GPIO_PP3300_DX_BASE, connected); host_set_single_event(EC_HOST_EVENT_MODE_CHANGE); + tablet_set_mode(!connected); } static void base_detect_deferred(void) diff --git a/board/poppy/board.h b/board/poppy/board.h index a0f6c7f6da..ebd2e9b58b 100644 --- a/board/poppy/board.h +++ b/board/poppy/board.h @@ -110,6 +110,9 @@ /* Depends on how fast the AP boots and typical ODRs */ #define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) +#define CONFIG_TABLET_MODE +#define CONFIG_TABLET_MODE_SWITCH + /* USB */ #define CONFIG_USB_CHARGER #define CONFIG_USB_PD_ALT_MODE