diff options
-rw-r--r-- | board/drawcia/board.c | 9 | ||||
-rw-r--r-- | board/drawcia/gpio.inc | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/board/drawcia/board.c b/board/drawcia/board.c index b1d13db9f5..acadc04257 100644 --- a/board/drawcia/board.c +++ b/board/drawcia/board.c @@ -138,6 +138,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" @@ -400,6 +407,8 @@ void board_init(void) GPIO_INPUT | GPIO_PULL_DOWN); } + gpio_enable_interrupt(GPIO_PEN_DET_ODL); + /* Charger on the MB will be outputting PROCHOT_ODL and OD CHG_DET */ sm5803_configure_gpio0(CHARGER_PRIMARY, GPIO0_MODE_PROCHOT, 1); sm5803_configure_chg_det_od(CHARGER_PRIMARY, 1); diff --git a/board/drawcia/gpio.inc b/board/drawcia/gpio.inc index 4c709c72c3..92c8bf7058 100644 --- a/board/drawcia/gpio.inc +++ b/board/drawcia/gpio.inc @@ -41,6 +41,7 @@ GPIO_INT(VOLUP_BTN_ODL_HDMI_HPD, PIN(I, 7), GPIO_INT_BOTH, button_sub_hdmi_hpd_i GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 0), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt) GPIO_INT(CAM_EC_VSYNC, PIN(C, 7), GPIO_INT_RISING, sync_interrupt) GPIO_INT(EC_WP_OD, PIN(A, 6), GPIO_INT_BOTH, switch_interrupt) +GPIO_INT(PEN_DET_ODL, PIN(J, 1), GPIO_INT_BOTH | GPIO_PULL_UP, pen_detect_interrupt) /* Power sequence GPIOs */ GPIO(EC_AP_RTCRST, PIN(K, 2), GPIO_OUT_LOW) @@ -100,9 +101,9 @@ GPIO(EN_BL_OD, PIN(K, 4), GPIO_ODR_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(EN_KB_BL, PIN(J, 3), GPIO_OUT_LOW) /* Currently unused */ GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW) +GPIO(EN_PP5000_PEN, PIN(B, 5), GPIO_OUT_LOW) /* NC pins, enable internal pull-down to avoid floating state. */ GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_DOWN) |