summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_pd_alt_mode_dfp.c49
-rw-r--r--common/usb_pd_policy.c37
-rw-r--r--common/usbc/usb_pe_drp_sm.c37
3 files changed, 49 insertions, 74 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 40a048a2bc..80f45ebb01 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -331,3 +331,52 @@ int dfp_discover_modes(int port, uint32_t *payload)
return 1;
}
+
+int pd_alt_mode(int port, uint16_t svid)
+{
+ struct svdm_amode_data *modep = pd_get_amode_data(port, svid);
+
+ return (modep) ? modep->opos : -1;
+}
+
+uint16_t pd_get_identity_vid(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return PD_IDH_VID(pe->identity[0]);
+}
+
+uint16_t pd_get_identity_pid(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return PD_PRODUCT_PID(pe->identity[2]);
+}
+
+uint8_t pd_get_product_type(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return PD_IDH_PTYPE(pe->identity[0]);
+}
+
+int pd_get_svid_count(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return pe->svid_cnt;
+}
+
+uint16_t pd_get_svid(int port, uint16_t svid_idx)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return pe->svids[svid_idx].svid;
+}
+
+uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return pe->svids[svid_idx].mode_vdo;
+}
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 5055b3d1a3..c97fb697a9 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -691,13 +691,6 @@ struct pd_policy *pd_get_am_policy(int port)
return &pe[port];
}
-int pd_alt_mode(int port, uint16_t svid)
-{
- struct svdm_amode_data *modep = pd_get_amode_data(port, svid);
-
- return (modep) ? modep->opos : -1;
-}
-
/* Note: Enter mode flag is not needed by TCPMv1 */
void pd_set_dfp_enter_mode_flag(int port, bool set)
{
@@ -757,36 +750,6 @@ static int enter_tbt_compat_mode(int port, uint32_t *payload)
return 2;
}
-uint16_t pd_get_identity_vid(int port)
-{
- return PD_IDH_VID(pe[port].identity[0]);
-}
-
-uint16_t pd_get_identity_pid(int port)
-{
- return PD_PRODUCT_PID(pe[port].identity[2]);
-}
-
-uint8_t pd_get_product_type(int port)
-{
- return PD_IDH_PTYPE(pe[port].identity[0]);
-}
-
-int pd_get_svid_count(int port)
-{
- return pe[port].svid_cnt;
-}
-
-uint16_t pd_get_svid(int port, uint16_t svid_idx)
-{
- return pe[port].svids[svid_idx].svid;
-}
-
-uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx)
-{
- return pe[port].svids[svid_idx].mode_vdo;
-}
-
#ifdef CONFIG_CMD_USB_PD_PE
static void dump_pe(int port)
{
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 12735eed71..3bed89f8ee 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -4601,13 +4601,6 @@ struct pd_policy *pd_get_am_policy(int port)
return &pe[port].am_policy;
}
-int pd_alt_mode(int port, uint16_t svid)
-{
- struct svdm_amode_data *modep = pd_get_amode_data(port, svid);
-
- return (modep) ? modep->opos : -1;
-}
-
void pd_set_dfp_enter_mode_flag(int port, bool set)
{
if (set)
@@ -4616,36 +4609,6 @@ void pd_set_dfp_enter_mode_flag(int port, bool set)
PE_CLR_FLAG(port, PE_FLAGS_MODAL_OPERATION);
}
-uint16_t pd_get_identity_vid(int port)
-{
- return PD_IDH_VID(pe[port].am_policy.identity[0]);
-}
-
-uint16_t pd_get_identity_pid(int port)
-{
- return PD_PRODUCT_PID(pe[port].am_policy.identity[2]);
-}
-
-uint8_t pd_get_product_type(int port)
-{
- return PD_IDH_PTYPE(pe[port].am_policy.identity[0]);
-}
-
-int pd_get_svid_count(int port)
-{
- return pe[port].am_policy.svid_cnt;
-}
-
-uint16_t pd_get_svid(int port, uint16_t svid_idx)
-{
- return pe[port].am_policy.svids[svid_idx].svid;
-}
-
-uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx)
-{
- return pe[port].am_policy.svids[svid_idx].mode_vdo;
-}
-
#ifdef CONFIG_CMD_USB_PD_PE
static void dump_pe(int port)
{