diff options
author | Furquan Shaikh <furquan@google.com> | 2019-09-02 16:11:38 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-09-05 23:57:00 +0000 |
commit | 65fd16174ea61628a2cb1197a65721598d516488 (patch) | |
tree | 749da683c46a8f218eed21a2924c1b55375aa961 | |
parent | ad2887717164edd1a6b296117a239957f8d48c5e (diff) | |
download | chrome-ec-65fd16174ea61628a2cb1197a65721598d516488.tar.gz |
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 <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781803
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | board/helios/board.c | 22 | ||||
-rw-r--r-- | board/helios/gpio.inc | 2 |
2 files changed, 23 insertions, 1 deletions
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) |