diff options
Diffstat (limited to 'driver/tcpm/it8xxx2.c')
-rw-r--r-- | driver/tcpm/it8xxx2.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/driver/tcpm/it8xxx2.c b/driver/tcpm/it8xxx2.c index f8102827de..7bed654132 100644 --- a/driver/tcpm/it8xxx2.c +++ b/driver/tcpm/it8xxx2.c @@ -886,6 +886,16 @@ static void it8xxx2_tcpm_hook_connect(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* + * If it isn't ITE active port, then return. + * + * NOTE: If we don't use all the ITE pd ports on a board, then we + * need to start from port0 to use the ITE pd port. If we + * start from port1, then port1 HOOK function never works. + */ + if (port > (CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT - 1)) + return; + #ifdef CONFIG_USB_PD_TCPMV2 /* * There are five cases that hook_connect() be called by TCPMv2: @@ -924,6 +934,16 @@ static void it8xxx2_tcpm_hook_disconnect(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* + * If it isn't ITE active port, then return. + * + * NOTE: If we don't use all the ITE pd ports on a board, then we + * need to start from port0 to use the ITE pd port. If we + * start from port1, then port1 HOOK function never works. + */ + if (port > (CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT - 1)) + return; + if (IS_ENABLED(IT83XX_INTC_PLUG_IN_OUT_SUPPORT)) /* * Switch to detect plug in and enable detect plug in interrupt, |