diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 17 | ||||
-rw-r--r-- | common/usb_pd_policy.c | 14 | ||||
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 19 |
3 files changed, 17 insertions, 33 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index e89cf09b57..809943e4f4 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -301,3 +301,20 @@ void dfp_consume_svids(int port, int cnt, uint32_t *payload) if (i && ((i % 12) == 0)) CPRINTF("ERR:SVID+12\n"); } + +void dfp_consume_modes(int port, int cnt, uint32_t *payload) +{ + struct pd_policy *pe = pd_get_am_policy(port); + int idx = pe->svid_idx; + + pe->svids[idx].mode_cnt = cnt - 1; + + if (pe->svids[idx].mode_cnt < 0) { + CPRINTF("ERR:NOMODE\n"); + } else { + memcpy(pe->svids[pe->svid_idx].mode_vdo, &payload[1], + sizeof(uint32_t) * pe->svids[idx].mode_cnt); + } + + pe->svid_idx++; +} diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index bdc78c4f27..73bad2c162 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -681,20 +681,6 @@ static int dfp_discover_modes(int port, uint32_t *payload) return 1; } -static void dfp_consume_modes(int port, int cnt, uint32_t *payload) -{ - int idx = pe[port].svid_idx; - pe[port].svids[idx].mode_cnt = cnt - 1; - if (pe[port].svids[idx].mode_cnt < 0) { - CPRINTF("ERR:NOMODE\n"); - } else { - memcpy(pe[port].svids[pe[port].svid_idx].mode_vdo, &payload[1], - sizeof(uint32_t) * pe[port].svids[idx].mode_cnt); - } - - pe[port].svid_idx++; -} - /* * This function returns * True - If the THunderbolt cable speed is TBT_SS_TBT_GEN3 or diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 90a2990f5c..19b483585a 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -491,7 +491,6 @@ static unsigned int max_request_mv = PD_MAX_VOLTAGE_MV; */ #ifdef CONFIG_USB_PD_ALT_MODE_DFP static int dfp_discover_modes(int port, uint32_t *payload); -static void dfp_consume_modes(int port, int cnt, uint32_t *payload); #endif test_export_static enum usb_pe_state get_state_pe(const int port); @@ -4617,24 +4616,6 @@ static int dfp_discover_modes(int port, uint32_t *payload) return 1; } -static void dfp_consume_modes(int port, int cnt, uint32_t *payload) -{ - int idx = pe[port].am_policy.svid_idx; - - pe[port].am_policy.svids[idx].mode_cnt = cnt - 1; - - if (pe[port].am_policy.svids[idx].mode_cnt < 0) { - CPRINTF("ERR:NOMODE\n"); - } else { - memcpy( - pe[port].am_policy.svids[pe[port].am_policy.svid_idx].mode_vdo, - &payload[1], - sizeof(uint32_t) * pe[port].am_policy.svids[idx].mode_cnt); - } - - pe[port].am_policy.svid_idx++; -} - struct pd_policy *pd_get_am_policy(int port) { return &pe[port].am_policy; |