diff options
-rw-r--r-- | board/morphius/board.c | 40 | ||||
-rw-r--r-- | board/morphius/board.h | 3 | ||||
-rw-r--r-- | board/morphius/gpio.inc | 4 |
3 files changed, 36 insertions, 11 deletions
diff --git a/board/morphius/board.c b/board/morphius/board.c index 9d3f87f423..3c9810f9d3 100644 --- a/board/morphius/board.c +++ b/board/morphius/board.c @@ -43,6 +43,10 @@ #include "usb_charge.h" #include "usbc_ppc.h" +static void hdmi_hpd_interrupt_v2(enum ioex_signal signal); +static void hdmi_hpd_interrupt_v3(enum gpio_signal signal); +static void board_gmr_tablet_switch_isr(enum gpio_signal signal); + #include "gpio_list.h" static bool support_aoz_ppc; @@ -319,6 +323,9 @@ static void board_remap_gpio(void) rv |= ioex_set_flags(IOEX_USB_C1_PPC_ILIM_3A_EN, GPIO_OUT_LOW); if (rv) ccprintf("IOEX Board>=3 Remap FAILED\n"); + + if (ec_config_has_hdmi_retimer_pi3hdx1204()) + gpio_enable_interrupt(GPIO_DP1_HPD_EC_IN); } else { gpio_ec_ps2_reset = GPIO_EC_PS2_RESET_V0; ccprintf("GPIO_EC_PS2_RESET_V0\n"); @@ -567,6 +574,18 @@ void ps2_pwr_en_interrupt(enum gpio_signal signal) hook_call_deferred(&trackpoint_reset_deferred_data, MSEC); } +static int check_hdmi_hpd_status(void) +{ + int hpd = 0; + + if (board_ver < 3) + ioex_get_level(IOEX_HDMI_CONN_HPD_3V3_DB, &hpd); + else + hpd = gpio_get_level(GPIO_DP1_HPD_EC_IN); + + return hpd; +} + /***************************************************************************** * Board suspend / resume */ @@ -584,7 +603,7 @@ static void board_chipset_resume(void) } pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, - 1); + check_hdmi_hpd_status()); } } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -687,22 +706,31 @@ void mst_hpd_interrupt(enum ioex_signal signal) static void hdmi_hpd_handler(void) { - int hpd = 0; - /* Pass HPD through from DB OPT1 HDMI connector to AP's DP1. */ - ioex_get_level(IOEX_HDMI_CONN_HPD_3V3_DB, &hpd); + int hpd = check_hdmi_hpd_status(); + gpio_set_level(GPIO_EC_DP1_HPD, hpd); ccprints("HDMI HPD %d", hpd); + 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 ioex_signal signal) +static void hdmi_hpd_interrupt_v2(enum ioex_signal signal) +{ + /* Debounce for 2 msec. */ + hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC)); +} + +static void hdmi_hpd_interrupt_v3(enum gpio_signal signal) { /* Debounce for 2 msec. */ hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC)); } -void board_gmr_tablet_switch_isr(enum gpio_signal signal) +static void board_gmr_tablet_switch_isr(enum gpio_signal signal) { /* Board version more than 3, DUT support GMR sensor */ if (board_ver >= 3) diff --git a/board/morphius/board.h b/board/morphius/board.h index e9a870c5a7..8c65ef5f5e 100644 --- a/board/morphius/board.h +++ b/board/morphius/board.h @@ -209,9 +209,6 @@ 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 ioex_signal signal); -void board_gmr_tablet_switch_isr(enum gpio_signal signal); - #ifdef CONFIG_KEYBOARD_FACTORY_TEST extern const int keyboard_factory_scan_pins[][2]; extern const int keyboard_factory_scan_pins_used; diff --git a/board/morphius/gpio.inc b/board/morphius/gpio.inc index 4cc12a423f..5ec5875a3a 100644 --- a/board/morphius/gpio.inc +++ b/board/morphius/gpio.inc @@ -27,6 +27,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(EN_PWR_TOUCHPAD_PS2, PIN(C, 2), GPIO_INT_RISING, ps2_pwr_en_interrupt) +GPIO_INT(DP1_HPD_EC_IN, PIN(7, 5), GPIO_INT_BOTH, hdmi_hpd_interrupt_v3) /* 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) @@ -51,7 +52,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_PS2_RESET_V0, PIN(3, 2), GPIO_OUT_LOW) /* Trackpoint reset pin V0*/ GPIO(EC_PS2_RESET_V1, PIN(4, 5), GPIO_OUT_LOW) /* Trackpoint reset pin V1 */ GPIO(EC_H1_PACKET_MODE, PIN(8, 6), GPIO_OUT_LOW) /* H1 Packet Mode */ @@ -104,7 +104,7 @@ IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(USBC_PORT_C1, 0, 4), GPIO_OUT_LOW) /* C1 F IOEX(USB_C1_PPC_ILIM_3A_EN, EXPIN(USBC_PORT_C1, 1, 0), GPIO_OUT_LOW) /* C1 3A Current Limit Enable */ #else #define IOEX_USB_C1_PPC_ILIM_3A_EN IOEX_HDMI_CONN_HPD_3V3_DB -IOEX_INT(HDMI_CONN_HPD_3V3_DB, EXPIN(USBC_PORT_C1, 1, 0), GPIO_INT_BOTH, hdmi_hpd_interrupt) +IOEX_INT(HDMI_CONN_HPD_3V3_DB, EXPIN(USBC_PORT_C1, 1, 0), GPIO_INT_BOTH, hdmi_hpd_interrupt_v2) #endif IOEX(USB_C1_MUX_RST_DB, EXPIN(USBC_PORT_C1, 1, 1), GPIO_OUT_LOW) /* C1 Mux Reset */ |