From 4a8bef2e93e435d7f3fd9591139250718d5a4026 Mon Sep 17 00:00:00 2001 From: "jerry2.huang" Date: Wed, 7 Oct 2020 18:22:01 +0800 Subject: boten: enable stylus charging boten has garage stylus, this patch enables stylus charging when stylus present. BUG=b:155615390 BRANCH=none TEST=make buildall -j Signed-off-by: jerry2.huang Change-Id: I601bb9c746774f3a410f83f322706ef4fb225830 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2455786 Reviewed-by: Justin TerAvest --- board/boten/board.c | 9 +++++++++ board/boten/gpio.inc | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/board/boten/board.c b/board/boten/board.c index bf7fdb17bf..edfff35f4e 100644 --- a/board/boten/board.c +++ b/board/boten/board.c @@ -62,6 +62,13 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s) pd_handle_cc_overvoltage(0); } +static void pen_detect_interrupt(enum gpio_signal s) +{ + int pen_detect = !gpio_get_level(GPIO_PEN_DET_ODL); + + gpio_set_level(GPIO_EN_PP5000_PEN, pen_detect); +} + /* Must come after other header files and interrupt handler declarations */ #include "gpio_list.h" @@ -146,6 +153,8 @@ void board_init(void) /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); gpio_enable_interrupt(GPIO_HDMI_HPD_SUB_ODL); + /* Enable gpio interrupt for pen detect */ + gpio_enable_interrupt(GPIO_PEN_DET_ODL); gpio_set_level(GPIO_HDMI_EN_SUB_ODL, 0); diff --git a/board/boten/gpio.inc b/board/boten/gpio.inc index d355338bee..a159a38940 100644 --- a/board/boten/gpio.inc +++ b/board/boten/gpio.inc @@ -99,7 +99,7 @@ GPIO(EN_BL_OD, PIN(K, 4), GPIO_OUT_LOW) GPIO(EC_ENTERING_RW, PIN(G, 0), GPIO_OUT_LOW) GPIO(CCD_MODE_ODL, PIN(H, 5), GPIO_INPUT) GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT) -GPIO(PEN_DET_ODL, PIN(J, 1), GPIO_INPUT | GPIO_PULL_UP) +GPIO_INT(PEN_DET_ODL, PIN(J, 1), GPIO_INT_BOTH | GPIO_PULL_UP, pen_detect_interrupt) GPIO(EN_PP5000_PEN, PIN(B, 5), GPIO_OUT_LOW) GPIO(EN_KB_BL, PIN(J, 3), GPIO_OUT_LOW) /* Currently unused */ GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW) -- cgit v1.2.1