diff options
-rw-r--r-- | board/woomax/board.c | 24 | ||||
-rw-r--r-- | board/woomax/board.h | 1 | ||||
-rw-r--r-- | board/woomax/gpio.inc | 2 |
3 files changed, 25 insertions, 2 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c index f439bddda1..2a88f43bf4 100644 --- a/board/woomax/board.c +++ b/board/woomax/board.c @@ -213,6 +213,7 @@ static void board_chipset_resume(void) { int rv; int retry; + int hpd = gpio_get_level(GPIO_DP1_HPD_EC_IN); ioex_set_level(IOEX_USB_A0_RETIMER_EN, 1); ioex_set_level(IOEX_HDMI_DATA_EN_DB, 1); @@ -237,7 +238,7 @@ static void board_chipset_resume(void) msleep(PI3HDX1204_POWER_ON_DELAY_MS); pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, - 1); + hpd); } } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -341,6 +342,10 @@ static void setup_fw_config(void) /* Enable Gyro interrupts */ gpio_enable_interrupt(GPIO_6AXIS_INT_L); + /* Enable DP1_HPD_EC_IN interrupt */ + if (ec_config_has_hdmi_retimer_pi3hdx1204()) + gpio_enable_interrupt(GPIO_DP1_HPD_EC_IN); + setup_mux(); } /* Use HOOK_PRIO_INIT_I2C + 2 to be after ioex_init(). */ @@ -508,3 +513,20 @@ static void keyboard_init(void) } DECLARE_HOOK(HOOK_INIT, keyboard_init, HOOK_PRIO_INIT_I2C + 1); +static void hdmi_hpd_handler(void) +{ + int hpd = gpio_get_level(GPIO_DP1_HPD_EC_IN); + + pi3hdx1204_enable(I2C_PORT_TCPC1, + PI3HDX1204_I2C_ADDR_FLAGS, + chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) + && hpd); +} +DECLARE_DEFERRED(hdmi_hpd_handler); + +void hdmi_hpd_interrupt(enum gpio_signal signal) +{ + /* Debounce 2 msec */ + hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC)); +} + diff --git a/board/woomax/board.h b/board/woomax/board.h index 0acfa7f3a7..1c28c4c90d 100644 --- a/board/woomax/board.h +++ b/board/woomax/board.h @@ -199,6 +199,7 @@ extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer; extern const struct usb_mux usbc1_ps8802; extern const struct usb_mux usbc1_ps8818; extern struct usb_mux usbc1_amd_fp5_usb_mux; +void hdmi_hpd_interrupt(enum gpio_signal signal); #endif /* !__ASSEMBLER__ */ diff --git a/board/woomax/gpio.inc b/board/woomax/gpio.inc index 571b150e1d..6654b88570 100644 --- a/board/woomax/gpio.inc +++ b/board/woomax/gpio.inc @@ -26,6 +26,7 @@ GPIO_INT(VOLDN_BTN_ODL, PIN(A, 6), GPIO_INT_BOTH | GPIO_PULL_UP, button_interru GPIO_INT(VOLUP_BTN_ODL, PIN(9, 5), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) GPIO_INT(6AXIS_INT_L, PIN(A, 0), GPIO_INT_FALLING | GPIO_PULL_UP, bmi160_interrupt) GPIO_INT(TABLET_MODE_L, PIN(4, 4), GPIO_INT_BOTH, gmr_tablet_switch_isr) +GPIO_INT(DP1_HPD_EC_IN, PIN(7, 5), GPIO_INT_BOTH, hdmi_hpd_interrupt) /* GPIO_INT_BOTH is required for PSL wake from hibernate, but we don't need an interrupt handler. */ GPIO(EC_RST_ODL, PIN(0, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH) @@ -50,7 +51,6 @@ GPIO(USB_C0_HPD, PIN(F, 5), GPIO_OUT_LOW) /* C0 DP Hotplug Detect */ GPIO(USB_C0_IN_HPD, PIN(7, 3), GPIO_OUT_LOW) /* C0 IN Hotplug Detect */ GPIO(EC_DP1_HPD, PIN(F, 4), GPIO_OUT_LOW) /* C1 DP Hotplug Detect */ GPIO(DP2_HPD, PIN(C, 1), GPIO_OUT_LOW) /* C1 DP Hotplug Detect */ -GPIO(DP1_HPD_EC_IN, PIN(7, 5), GPIO_INPUT) /* C1 IN Hotplug Detect */ GPIO(EC_H1_PACKET_MODE, PIN(8, 6), GPIO_OUT_LOW) /* H1 Packet Mode */ GPIO(EN_PWR_TOUCHPAD_PS2, PIN(C, 2), GPIO_INPUT) /* Touchpad Power */ |