diff --git a/subsys/usb/usb_c/usbc_pe_common.c b/subsys/usb/usb_c/usbc_pe_common.c index 9cff53d995b..7cbacbeafdf 100644 --- a/subsys/usb/usb_c/usbc_pe_common.c +++ b/subsys/usb/usb_c/usbc_pe_common.c @@ -1371,6 +1371,12 @@ static const struct smf_state pe_states[PE_STATE_COUNT] = { pe_src_ready_exit, NULL, NULL), + [PE_SRC_DISABLED] = SMF_CREATE_STATE( + pe_src_disabled_entry, + NULL, + NULL, + NULL, + NULL), [PE_SRC_TRANSITION_TO_DEFAULT] = SMF_CREATE_STATE( pe_src_transition_to_default_entry, pe_src_transition_to_default_run, diff --git a/subsys/usb/usb_c/usbc_pe_common_internal.h b/subsys/usb/usb_c/usbc_pe_common_internal.h index 46a1f3adf42..9b18d59d80d 100644 --- a/subsys/usb/usb_c/usbc_pe_common_internal.h +++ b/subsys/usb/usb_c/usbc_pe_common_internal.h @@ -83,6 +83,8 @@ enum usbc_pe_state { PE_SRC_TRANSITION_SUPPLY, /** PE_SRC_Ready */ PE_SRC_READY, + /** PE_SRC_Disabled */ + PE_SRC_DISABLED, /** PE_SRC_Hard_Reset */ PE_SRC_HARD_RESET, /** PE_SRC_Hard_Reset_Received */ diff --git a/subsys/usb/usb_c/usbc_pe_src_states.c b/subsys/usb/usb_c/usbc_pe_src_states.c index 8e09d8c3525..5e0b1a03c66 100644 --- a/subsys/usb/usb_c/usbc_pe_src_states.c +++ b/subsys/usb/usb_c/usbc_pe_src_states.c @@ -154,9 +154,12 @@ void pe_src_discovery_run(void *obj) * 1) The SourceCapabilityTimer times out * 2) And CapsCounter ≤ nCapsCount */ - if (usbc_timer_expired(&pe->pd_t_typec_send_source_cap) - && pe->caps_counter <= PD_N_CAPS_COUNT) { - pe_set_state(dev, PE_SRC_SEND_CAPABILITIES); + if (usbc_timer_expired(&pe->pd_t_typec_send_source_cap)) { + if (pe->caps_counter <= PD_N_CAPS_COUNT) { + pe_set_state(dev, PE_SRC_SEND_CAPABILITIES); + } else { + pe_set_state(dev, PE_SRC_DISABLED); + } } } @@ -483,6 +486,19 @@ void pe_src_ready_exit(void *obj) } } +/** + * @brief 8.3.3.2.7 PE_SRC_Disabled State + */ +void pe_src_disabled_entry(void *obj) +{ + LOG_INF("PE_SRC_Disabled"); + + /* + * Unresponsive to USB Power Delivery messaging, but not to Hard Reset + * Signaling. See pe_got_hard_reset + */ +} + /** * @brief 8.3.3.2.11 PE_SRC_Transition_to_default State */ diff --git a/subsys/usb/usb_c/usbc_pe_src_states_internal.h b/subsys/usb/usb_c/usbc_pe_src_states_internal.h index 74403b6d651..0cef77fa535 100644 --- a/subsys/usb/usb_c/usbc_pe_src_states_internal.h +++ b/subsys/usb/usb_c/usbc_pe_src_states_internal.h @@ -57,6 +57,11 @@ void pe_src_ready_entry(void *obj); void pe_src_ready_run(void *obj); void pe_src_ready_exit(void *obj); +/** + * @brief PE_SRC_Disabled State + */ +void pe_src_disabled_entry(void *obj); + /** * @brief PE_SRC_Transition_To_Default State */