diff options
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r-- | common/usb_pd_protocol.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index d4f6f0c06b..cee2c5ca0f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -28,7 +28,6 @@ #include "usb_pd_tcpm.h" #include "usb_pd_tcpc.h" #include "usbc_ppc.h" -#include "tcpm.h" #include "version.h" #include "vboot.h" @@ -841,10 +840,10 @@ static inline void set_state(int port, enum pd_states next_state) /* Invalidate message IDs. */ invalidate_last_message_id(port); -#ifdef CONFIG_COMMON_RUNTIME + /* detect USB PD cc disconnect */ - hook_notify(HOOK_USB_PD_DISCONNECT); -#endif + if (IS_ENABLED(CONFIG_COMMON_RUNTIME)) + hook_notify(HOOK_USB_PD_DISCONNECT); } #ifdef CONFIG_LOW_POWER_IDLE @@ -3314,9 +3313,6 @@ void pd_task(void *u) break; /* Debounce complete */ - if (IS_ENABLED(CONFIG_COMMON_RUNTIME)) - hook_notify(HOOK_USB_PD_CONNECT); - #ifdef CONFIG_USBC_PPC /* * If the port is latched off, just continue to @@ -3400,6 +3396,10 @@ void pd_task(void *u) PD_FLAGS_CHECK_DR_ROLE; hard_reset_count = 0; timeout = 5*MSEC; + + if (IS_ENABLED(CONFIG_COMMON_RUNTIME)) + hook_notify(HOOK_USB_PD_CONNECT); + set_state(port, PD_STATE_SRC_STARTUP); } /* @@ -3965,8 +3965,6 @@ void pd_task(void *u) } /* We are attached */ - if (IS_ENABLED(CONFIG_COMMON_RUNTIME)) - hook_notify(HOOK_USB_PD_CONNECT); pd[port].polarity = get_snk_polarity(cc1, cc2); set_polarity(port, pd[port].polarity); /* reset message ID on connection */ @@ -4001,6 +3999,8 @@ void pd_task(void *u) &pd_usb_billboard_deferred_data, PD_T_AME); } + if (IS_ENABLED(CONFIG_COMMON_RUNTIME)) + hook_notify(HOOK_USB_PD_CONNECT); break; case PD_STATE_SNK_HARD_RESET_RECOVER: if (pd[port].last_state != pd[port].task_state) |