From 65fd16174ea61628a2cb1197a65721598d516488 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Mon, 2 Sep 2019 16:11:38 -0700 Subject: helios: Use a custom lid interrupt handler This change ignores lid open signal when tablet mode is returned as true. This is a workaround with board version #1 where lid open can be incorrectly triggered in 360-degree mode. BUG=b:139964210 BRANCH=None TEST=make -j BOARD=helios Change-Id: I707dcd2a8efd75668ee29bffa54622aa698e7d57 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781803 Reviewed-by: Tim Wawrzynczak Tested-by: Furquan Shaikh Commit-Queue: Furquan Shaikh --- board/helios/board.c | 22 ++++++++++++++++++++++ board/helios/gpio.inc | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/board/helios/board.c b/board/helios/board.c index db0a664e2c..4fdff0cf84 100644 --- a/board/helios/board.c +++ b/board/helios/board.c @@ -32,6 +32,7 @@ #include "spi.h" #include "switch.h" #include "system.h" +#include "tablet_mode.h" #include "task.h" #include "temp_sensor.h" #include "thermal.h" @@ -95,6 +96,27 @@ static void bc12_interrupt(enum gpio_signal signal) } } +static void board_lid_interrupt(enum gpio_signal signal) +{ + static int board_id = -1; + + if (board_id == -1) { + uint32_t val; + + if (cbi_get_board_version(&val) == EC_SUCCESS) + board_id = val; + } + + /* + * This is a workaround with board version #1 where lid open can be + * incorrectly triggered in 360-degree mode. + */ + if ((board_id == 1) && tablet_get_mode()) + return; + + lid_interrupt(signal); +} + #include "gpio_list.h" /* Must come after other header files. */ /******************************************************************************/ diff --git a/board/helios/gpio.inc b/board/helios/gpio.inc index 746e2b5e4e..9397d3dcfa 100644 --- a/board/helios/gpio.inc +++ b/board/helios/gpio.inc @@ -9,7 +9,7 @@ * Note: Those with interrupt handlers must be declared first. */ /* Wake Source interrupts */ -GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, lid_interrupt) +GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, board_lid_interrupt) GPIO_INT(WP_L, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */ GPIO_INT(POWER_BUTTON_L, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt) /* MECH_PWR_BTN_ODL */ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt) -- cgit v1.2.1