diff options
-rw-r--r-- | common/usb_pd_protocol.c | 24 | ||||
-rw-r--r-- | include/usb_pd.h | 4 |
2 files changed, 10 insertions, 18 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 31c56c87db..d85e8ea83c 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -846,7 +846,7 @@ static void pd_set_data_role(int port, int role) static void pd_dr_swap(int port) { pd_set_data_role(port, !pd[port].data_role); - pd[port].flags |= PD_FLAGS_DATA_SWAPPED; + pd[port].flags |= PD_FLAGS_CHECK_IDENTITY; } static void handle_ctrl_request(int port, uint16_t head, @@ -1828,11 +1828,7 @@ void pd_task(void) case PD_STATE_SRC_STARTUP: /* Wait for power source to enable */ if (pd[port].last_state != pd[port].task_state) { - /* - * fake set data role swapped flag so we send - * discover identity when we enter SRC_READY - */ - pd[port].flags |= PD_FLAGS_DATA_SWAPPED; + pd[port].flags |= PD_FLAGS_CHECK_IDENTITY; /* reset various counters */ caps_count = 0; pd[port].msg_id = 0; @@ -1990,12 +1986,12 @@ void pd_task(void) /* Send discovery SVDMs last */ if (pd[port].data_role == PD_ROLE_DFP && - (pd[port].flags & PD_FLAGS_DATA_SWAPPED)) { + (pd[port].flags & PD_FLAGS_CHECK_IDENTITY)) { #ifndef CONFIG_USB_PD_SIMPLE_DFP pd_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0); #endif - pd[port].flags &= ~PD_FLAGS_DATA_SWAPPED; + pd[port].flags &= ~PD_FLAGS_CHECK_IDENTITY; break; } @@ -2246,13 +2242,9 @@ void pd_task(void) /* DFP is attached */ if (new_cc_state == PD_CC_DFP_ATTACHED) { - /* - * fake set data role swapped flag so we send - * discover identity when we enter SRC_READY - */ pd[port].flags |= PD_FLAGS_CHECK_PR_ROLE | PD_FLAGS_CHECK_DR_ROLE | - PD_FLAGS_DATA_SWAPPED; + PD_FLAGS_CHECK_IDENTITY; set_state(port, PD_STATE_SNK_DISCOVERY); timeout = 10*MSEC; hook_call_deferred( @@ -2278,7 +2270,7 @@ void pd_task(void) break; case PD_STATE_SNK_HARD_RESET_RECOVER: if (pd[port].last_state != pd[port].task_state) - pd[port].flags |= PD_FLAGS_DATA_SWAPPED; + pd[port].flags |= PD_FLAGS_CHECK_IDENTITY; #ifdef CONFIG_USB_PD_VBUS_DETECT_NONE /* * Can't measure vbus state so this is the maximum @@ -2460,10 +2452,10 @@ void pd_task(void) /* If DFP, send discovery SVDMs */ if (pd[port].data_role == PD_ROLE_DFP && - (pd[port].flags & PD_FLAGS_DATA_SWAPPED)) { + (pd[port].flags & PD_FLAGS_CHECK_IDENTITY)) { pd_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0); - pd[port].flags &= ~PD_FLAGS_DATA_SWAPPED; + pd[port].flags &= ~PD_FLAGS_CHECK_IDENTITY; break; } diff --git a/include/usb_pd.h b/include/usb_pd.h index 3ba918738f..bfdc55f6e6 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -694,7 +694,7 @@ enum pd_states { #define PD_FLAGS_PING_ENABLED (1 << 0) /* SRC_READY pings enabled */ #define PD_FLAGS_PARTNER_DR_POWER (1 << 1) /* port partner is dualrole power */ #define PD_FLAGS_PARTNER_DR_DATA (1 << 2) /* port partner is dualrole data */ -#define PD_FLAGS_DATA_SWAPPED (1 << 3) /* data swap complete */ +#define PD_FLAGS_CHECK_IDENTITY (1 << 3) /* discover identity in READY */ #define PD_FLAGS_SNK_CAP_RECVD (1 << 4) /* sink capabilities received */ #define PD_FLAGS_TCPC_DRP_TOGGLE (1 << 5) /* TCPC-controlled DRP toggling */ #define PD_FLAGS_EXPLICIT_CONTRACT (1 << 6) /* explicit pwr contract in place */ @@ -710,7 +710,7 @@ enum pd_states { /* Flags to clear on a disconnect */ #define PD_FLAGS_RESET_ON_DISCONNECT_MASK (PD_FLAGS_PARTNER_DR_POWER | \ PD_FLAGS_PARTNER_DR_DATA | \ - PD_FLAGS_DATA_SWAPPED | \ + PD_FLAGS_CHECK_IDENTITY | \ PD_FLAGS_SNK_CAP_RECVD | \ PD_FLAGS_TCPC_DRP_TOGGLE | \ PD_FLAGS_EXPLICIT_CONTRACT | \ |