summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_pd_alt_mode_dfp.c96
-rw-r--r--common/usb_pd_console_cmd.c11
-rw-r--r--common/usb_pd_host_cmd.c7
-rw-r--r--common/usb_pd_policy.c21
-rw-r--r--common/usbc/usb_pe_drp_sm.c12
-rw-r--r--include/usb_pd.h108
6 files changed, 172 insertions, 83 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 28a5ed66f8..d0d337e0ab 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -52,7 +52,8 @@ __overridable const struct svdm_response svdm_rsp = {
static int pd_get_mode_idx(int port, uint16_t svid)
{
int i;
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ /* TODO(b/150611251): Support SOP' */
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
for (i = 0; i < PD_AMODE_COUNT; i++) {
if (disc->amodes[i].fx &&
@@ -67,7 +68,8 @@ static int pd_allocate_mode(int port, uint16_t svid)
int i, j;
struct svdm_amode_data *modep;
int mode_idx = pd_get_mode_idx(port, svid);
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ /* TODO(b/150611251): Support SOP' and SOP'' */
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
if (mode_idx != -1)
return mode_idx;
@@ -81,7 +83,7 @@ static int pd_allocate_mode(int port, uint16_t svid)
/* Allocate ... if SVID == 0 enter default supported policy */
for (i = 0; i < supported_modes_cnt; i++) {
for (j = 0; j < disc->svid_cnt; j++) {
- struct svdm_svid_data *svidp = &disc->svids[j];
+ struct svid_mode_data *svidp = &disc->svids[j];
if ((svidp->svid != supported_modes[i].svid) ||
(svid && (svidp->svid != svid)))
@@ -193,7 +195,8 @@ int pd_dfp_dp_get_pin_mode(int port, uint32_t status)
struct svdm_amode_data *pd_get_amode_data(int port, uint16_t svid)
{
int idx = pd_get_mode_idx(port, svid);
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ /* TODO(b/150611251): Support SOP' */
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
return (idx == -1) ? NULL : &disc->amodes[idx];
}
@@ -205,7 +208,8 @@ struct svdm_amode_data *pd_get_amode_data(int port, uint16_t svid)
uint32_t pd_dfp_enter_mode(int port, uint16_t svid, int opos)
{
int mode_idx = pd_allocate_mode(port, svid);
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ /* TODO(b/150611251): Support SOP' */
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
struct svdm_amode_data *modep;
uint32_t mode_caps;
@@ -236,7 +240,8 @@ uint32_t pd_dfp_enter_mode(int port, uint16_t svid, int opos)
int pd_dfp_exit_mode(int port, uint16_t svid, int opos)
{
struct svdm_amode_data *modep;
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ /* TODO(b/150611251): Support SOP' */
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
int idx;
/*
@@ -289,12 +294,11 @@ void dfp_consume_attention(int port, uint32_t *payload)
void dfp_consume_identity(int port, int cnt, uint32_t *payload)
{
int ptype = PD_IDH_PTYPE(payload[VDO_I(IDH)]);
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
size_t identity_size = MIN(sizeof(union disc_ident_ack),
(cnt - 1) * sizeof(uint32_t));
/* Note: only store VDOs, not the VDM header */
- memcpy(disc->identity[TCPC_TX_SOP].response.raw_value,
- payload + 1, identity_size);
+ memcpy(disc->identity.raw_value, payload + 1, identity_size);
switch (ptype) {
case IDH_PTYPE_AMA:
@@ -317,13 +321,14 @@ void dfp_consume_identity(int port, int cnt, uint32_t *payload)
pd_set_identity_discovery(port, TCPC_TX_SOP, PD_DISC_COMPLETE);
}
-void dfp_consume_svids(int port, int cnt, uint32_t *payload)
+void dfp_consume_svids(int port, enum tcpm_transmit_type type, int cnt,
+ uint32_t *payload)
{
int i;
uint32_t *ptr = payload + 1;
int vdo = 1;
uint16_t svid0, svid1;
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
for (i = disc->svid_cnt; i < disc->svid_cnt + 12; i += 2) {
if (i >= SVID_DISCOVERY_MAX) {
@@ -354,11 +359,14 @@ void dfp_consume_svids(int port, int cnt, uint32_t *payload)
/* TODO(tbroch) need to re-issue discover svids if > 12 */
if (i && ((i % 12) == 0))
CPRINTF("ERR:SVID+12\n");
+
+ pd_set_svids_discovery(port, type, PD_DISC_COMPLETE);
}
-void dfp_consume_modes(int port, int cnt, uint32_t *payload)
+void dfp_consume_modes(int port, enum tcpm_transmit_type type, int cnt,
+ uint32_t *payload)
{
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
int idx = disc->svid_idx;
disc->svids[idx].mode_cnt = cnt - 1;
@@ -366,16 +374,20 @@ void dfp_consume_modes(int port, int cnt, uint32_t *payload)
if (disc->svids[idx].mode_cnt < 0) {
CPRINTF("ERR:NOMODE\n");
} else {
- memcpy(disc->svids[disc->svid_idx].mode_vdo, &payload[1],
+ memcpy(disc->svids[idx].mode_vdo, &payload[1],
sizeof(uint32_t) * disc->svids[idx].mode_cnt);
}
disc->svid_idx++;
}
+/*
+ * TODO(b/152417597): Move this function to usb_pd_policy.c after TCPMv2 stops
+ * using it.
+ */
int dfp_discover_modes(int port, uint32_t *payload)
{
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
uint16_t svid = disc->svids[disc->svid_idx].svid;
if (disc->svid_idx >= disc->svid_cnt)
@@ -396,17 +408,26 @@ int pd_alt_mode(int port, uint16_t svid)
void pd_set_identity_discovery(int port, enum tcpm_transmit_type type,
enum pd_discovery_state disc)
{
- struct pd_discovery *pd = pd_get_am_discovery(port);
+ struct pd_discovery *pd = pd_get_am_discovery(port, type);
- pd->identity[type].discovery = disc;
+ pd->identity_discovery = disc;
}
+void pd_set_svids_discovery(int port, enum tcpm_transmit_type type,
+ enum pd_discovery_state disc)
+{
+ struct pd_discovery *pd = pd_get_am_discovery(port, type);
+
+ pd->svids_discovery = disc;
+}
+
+
enum pd_discovery_state pd_get_identity_discovery(int port,
enum tcpm_transmit_type type)
{
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
- return disc->identity[type].discovery;
+ return disc->identity_discovery;
}
const union disc_ident_ack *pd_get_identity_response(int port,
@@ -415,7 +436,7 @@ const union disc_ident_ack *pd_get_identity_response(int port,
if (type >= DISCOVERY_TYPE_COUNT)
return NULL;
- return &pd_get_am_discovery(port)->identity[type].response;
+ return &pd_get_am_discovery(port, type)->identity;
}
uint16_t pd_get_identity_vid(int port)
@@ -442,23 +463,32 @@ uint8_t pd_get_product_type(int port)
return resp->idh.product_type;
}
-int pd_get_svid_count(int port)
+enum pd_discovery_state pd_get_svids_discovery(int port,
+ enum tcpm_transmit_type type)
+{
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
+
+ return disc->svids_discovery;
+}
+
+int pd_get_svid_count(int port, enum tcpm_transmit_type type)
{
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svid_cnt;
}
-uint16_t pd_get_svid(int port, uint16_t svid_idx)
+uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_transmit_type type)
{
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svids[svid_idx].svid;
}
-uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx)
+uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx,
+ enum tcpm_transmit_type type)
{
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svids[svid_idx].mode_vdo;
}
@@ -520,7 +550,8 @@ void dfp_consume_cable_response(int port, int cnt, uint32_t *payload,
uint16_t head)
{
struct pd_cable *cable = pd_get_cable_attributes(port);
- struct pd_discovery *disc = pd_get_am_discovery(port);
+ struct pd_discovery *disc =
+ pd_get_am_discovery(port, TCPC_TX_SOP_PRIME);
size_t identity_size = MIN(sizeof(union disc_ident_ack),
(cnt - 1) * sizeof(uint32_t));
@@ -528,8 +559,7 @@ void dfp_consume_cable_response(int port, int cnt, uint32_t *payload,
return;
/* Note: only store VDOs, not the VDM header */
- memcpy(disc->identity[TCPC_TX_SOP_PRIME].response.raw_value,
- payload + 1, identity_size);
+ memcpy(disc->identity.raw_value, payload + 1, identity_size);
pd_set_identity_discovery(port, TCPC_TX_SOP_PRIME, PD_DISC_COMPLETE);
@@ -619,7 +649,8 @@ bool is_modal(int port, int cnt, const uint32_t *payload)
bool is_intel_svid(int port, int prev_svid_cnt)
{
int i;
- struct pd_discovery *pe = pd_get_am_discovery(port);
+ /* TODO(b/148528713): Use TCPMv2's separate storage for SOP'. */
+ struct pd_discovery *disc = pd_get_am_discovery(port, TCPC_TX_SOP);
/*
* Ref: USB Type-C cable and connector specification, Table F-9
@@ -630,8 +661,9 @@ bool is_intel_svid(int port, int prev_svid_cnt)
* SVIDs in any order.
*/
if (IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE)) {
- for (i = prev_svid_cnt; i < pe->svid_cnt; i++) {
- if (pe->svids[i].svid == USB_VID_INTEL)
+ for (i = prev_svid_cnt;
+ i < pd_get_svid_count(port, TCPC_TX_SOP); i++) {
+ if (disc->svids[i].svid == USB_VID_INTEL)
return true;
}
}
diff --git a/common/usb_pd_console_cmd.c b/common/usb_pd_console_cmd.c
index cbef79a1f1..22039eddc3 100644
--- a/common/usb_pd_console_cmd.c
+++ b/common/usb_pd_console_cmd.c
@@ -16,9 +16,11 @@ static void dump_pe(int port)
int i, j, idh_ptype;
struct svdm_amode_data *modep;
uint32_t mode_caps;
- struct pd_discovery *disc = pd_get_am_discovery(port);
const union disc_ident_ack *resp;
enum tcpm_transmit_type type;
+ /* TODO(b/152417597): Output SOP' discovery results */
+ const struct pd_discovery *disc =
+ pd_get_am_discovery(port, TCPC_TX_SOP);
static const char * const idh_ptype_names[] = {
"UNDEF", "Hub", "Periph", "PCable", "ACable", "AMA",
@@ -49,16 +51,17 @@ static void dump_pe(int port)
ccprintf("\n");
}
- if (disc->svid_cnt < 1) {
+ if (pd_get_svid_count(port, TCPC_TX_SOP) < 1) {
ccprintf("No SVIDS discovered yet.\n");
return;
}
- for (i = 0; i < disc->svid_cnt; i++) {
+ /* TODO(b/152418267): Display discovered SVIDs and modes for SOP' */
+ for (i = 0; i < pd_get_svid_count(port, TCPC_TX_SOP); i++) {
ccprintf("SVID[%d]: %04x MODES:", i, disc->svids[i].svid);
for (j = 0; j < disc->svids[j].mode_cnt; j++)
ccprintf(" [%d] %08x", j + 1,
- disc->svids[i].mode_vdo[j]);
+ disc->svids[i].mode_vdo[j]);
ccprintf("\n");
modep = pd_get_amode_data(port, disc->svids[i].svid);
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index ac4ccc2642..128b467502 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -178,15 +178,16 @@ static enum ec_status hc_remote_pd_get_amode(struct host_cmd_handler_args *args)
return EC_RES_INVALID_PARAM;
/* no more to send */
- if (p->svid_idx >= pd_get_svid_count(p->port)) {
+ /* TODO(b/148528713): Use TCPMv2's separate storage for SOP'. */
+ if (p->svid_idx >= pd_get_svid_count(p->port, TCPC_TX_SOP)) {
r->svid = 0;
args->response_size = sizeof(r->svid);
return EC_RES_SUCCESS;
}
- r->svid = pd_get_svid(p->port, p->svid_idx);
+ r->svid = pd_get_svid(p->port, p->svid_idx, TCPC_TX_SOP);
r->opos = 0;
- memcpy(r->vdo, pd_get_mode_vdo(p->port, p->svid_idx),
+ memcpy(r->vdo, pd_get_mode_vdo(p->port, p->svid_idx, TCPC_TX_SOP),
sizeof(uint32_t) * PDO_MODES);
modep = pd_get_amode_data(p->port, r->svid);
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 4721fcc07d..d85f347351 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -499,8 +499,12 @@ static int dfp_discover_svids(uint32_t *payload)
return 1;
}
-struct pd_discovery *pd_get_am_discovery(int port)
+struct pd_discovery *pd_get_am_discovery(int port, enum tcpm_transmit_type type)
{
+ /*
+ * TCPMv2 separates discovered data by partner (SOP vs. SOP'); TCPMv1
+ * depends on both types being in the same structure.
+ */
return &discovery[port];
}
@@ -548,7 +552,12 @@ static int process_am_discover_svids(int port, int cnt, uint32_t *payload)
{
int prev_svid_cnt = discovery[port].svid_cnt;
- dfp_consume_svids(port, cnt, payload);
+ /*
+ * The pd_discovery structure stores SOP and SOP' discovery results
+ * separately, but TCPMv1 depends on one-dimensional storage of SVIDs
+ * and modes. Therefore, always use TCPC_TX_SOP in TCPMv1.
+ */
+ dfp_consume_svids(port, TCPC_TX_SOP, cnt, payload);
/*
* Ref: USB Type-C Cable and Connector Specification,
@@ -846,7 +855,13 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
rsize = process_am_discover_svids(port, cnt, payload);
break;
case CMD_DISCOVER_MODES:
- dfp_consume_modes(port, cnt, payload);
+ /*
+ * The pd_discovery structure stores SOP and SOP'
+ * discovery results separately, but TCPMv1 depends on
+ * one-dimensional storage of SVIDs and modes.
+ * Therefore, always use TCPC_TX_SOP in TCPMv1.
+ */
+ dfp_consume_modes(port, TCPC_TX_SOP, cnt, payload);
if (is_tbt_compat_enabled(port) &&
is_tbt_compat_mode(port, cnt, payload)) {
rsize = process_tbt_compat_discover_modes(
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 6e3e76764c..64dc785fc1 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -432,7 +432,7 @@ static struct policy_engine {
int32_t ama_vdo;
int32_t vpd_vdo;
/* Alternate mode discovery results */
- struct pd_discovery discovery;
+ struct pd_discovery discovery[DISCOVERY_TYPE_COUNT];
/* Partner type to send */
enum tcpm_transmit_type tx_type;
@@ -4639,10 +4639,10 @@ static void pe_vdm_acked_entry(int port)
#endif
break;
case CMD_DISCOVER_SVID:
- dfp_consume_svids(port, cnt, payload);
+ dfp_consume_svids(port, TCPC_TX_SOP, cnt, payload);
break;
case CMD_DISCOVER_MODES:
- dfp_consume_modes(port, cnt, payload);
+ dfp_consume_modes(port, TCPC_TX_SOP, cnt, payload);
break;
case CMD_ENTER_MODE:
break;
@@ -5285,13 +5285,13 @@ uint8_t pd_get_src_cap_cnt(int port)
void pd_dfp_discovery_init(int port)
{
- memset(&pe[port].discovery, 0, sizeof(struct pd_discovery));
+ memset(&pe[port].discovery, 0, sizeof(pe[port].discovery));
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-struct pd_discovery *pd_get_am_discovery(int port)
+struct pd_discovery *pd_get_am_discovery(int port, enum tcpm_transmit_type type)
{
- return &pe[port].discovery;
+ return &pe[port].discovery[type];
}
struct pd_cable *pd_get_cable_attributes(int port)
diff --git a/include/usb_pd.h b/include/usb_pd.h
index f324db8d81..a5d6bbf34c 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -265,9 +265,25 @@ struct svdm_response {
struct amode_fx *amode;
};
-struct svdm_svid_data {
+/*
+ * State of discovery
+ *
+ * Note: Discovery needed must be 0 to meet expectations that it be the default
+ * value after resetting connection information via memset.
+ */
+enum pd_discovery_state {
+ PD_DISC_NEEDED = 0, /* Cable or partner still needs to be probed */
+ PD_DISC_COMPLETE, /* Successfully probed, valid to read VDO */
+ PD_DISC_FAIL, /* Cable did not respond, or Discover* NAK */
+};
+
+/* Mode discovery state for a particular SVID with a particular transmit type */
+struct svid_mode_data {
+ /* The SVID for which modes are discovered */
uint16_t svid;
+ /* The number of modes discovered for this SVID */
int mode_cnt;
+ /* The discovered mode VDOs */
uint32_t mode_vdo[PDO_MODES];
};
@@ -309,7 +325,7 @@ struct svdm_amode_data {
/* VDM object position */
int opos;
/* mode capabilities specific to SVID amode. */
- struct svdm_svid_data *data;
+ struct svid_mode_data *data;
};
enum hpd_event {
@@ -323,18 +339,6 @@ enum hpd_event {
#define DP_FLAGS_DP_ON BIT(0) /* Display port mode is on */
#define DP_FLAGS_HPD_HI_PENDING BIT(1) /* Pending HPD_HI */
-/*
- * State of discovery
- *
- * Note: Discovery needed must be 0 to meet expectations that it be the default
- * value after resetting connection information via memset.
- */
-enum pd_discovery_state {
- PD_DISC_NEEDED = 0, /* Cable or partner still needs to be probed */
- PD_DISC_COMPLETE, /* Successfully probed, valid to read VDO */
- PD_DISC_FAIL, /* Cable did not respond, or Discover* NAK */
-};
-
/* Discover Identity ACK contents after headers */
union disc_ident_ack {
struct {
@@ -371,20 +375,24 @@ enum pd_alternate_modes {
#define DISCOVERY_TYPE_COUNT (TCPC_TX_SOP + 1)
#endif
-/* Structure for storing discovery results */
+/* Discovery results for a port partner (SOP) or cable plug (SOP') */
struct pd_discovery {
- /* index of svid currently being operated on */
- int svid_idx;
- /* count of svids discovered */
- int svid_cnt;
- /* Identity data for all supported SOP* communications */
- struct identity_data identity[DISCOVERY_TYPE_COUNT];
- /* supported svids & corresponding vdo mode data */
- struct svdm_svid_data svids[SVID_DISCOVERY_MAX];
+ /* Identity data */
+ union disc_ident_ack identity;
+ /* Supported SVIDs and corresponding mode VDOs */
+ struct svid_mode_data svids[SVID_DISCOVERY_MAX];
/* active modes */
struct svdm_amode_data amodes[PD_AMODE_COUNT];
+ /* index of SVID currently being operated on */
+ int svid_idx;
+ /* Count of SVIDs discovered */
+ int svid_cnt;
/* Next index to insert DFP alternate mode into amodes */
int amode_idx;
+ /* Identity discovery state */
+ enum pd_discovery_state identity_discovery;
+ /* SVID discovery state */
+ enum pd_discovery_state svids_discovery;
};
/*
@@ -1620,19 +1628,23 @@ void dfp_consume_identity(int port, int cnt, uint32_t *payload);
* Consume the SVIDs
*
* @param port USB-C port number
+ * @param type Transmit type (SOP, SOP') for received SVIDs
* @param cnt number of data objects in payload
* @param payload payload data.
*/
-void dfp_consume_svids(int port, int cnt, uint32_t *payload);
+void dfp_consume_svids(int port, enum tcpm_transmit_type type, int cnt,
+ uint32_t *payload);
/**
* Consume the alternate modes
*
* @param port USB-C port number
+ * @param type Transmit type (SOP, SOP') for received modes
* @param cnt number of data objects in payload
* @param payload payload data.
*/
-void dfp_consume_modes(int port, int cnt, uint32_t *payload);
+void dfp_consume_modes(int port, enum tcpm_transmit_type type, int cnt,
+ uint32_t *payload);
/**
* Return the discover alternate mode payload data
@@ -1652,7 +1664,7 @@ void pd_dfp_discovery_init(int port);
/**
- * Set discovery state for this type and port
+ * Set identity discovery state for this type and port
*
* @param port USB-C port number
* @param type SOP* type to set
@@ -1662,16 +1674,36 @@ void pd_set_identity_discovery(int port, enum tcpm_transmit_type type,
enum pd_discovery_state disc);
/**
- * Get discovery state for this type and port
+ * Get identity discovery state for this type and port
*
* @param port USB-C port number
- * @param type SOP* type to set
- * @return Discovery state to set (failed or complete)
+ * @param type SOP* type to retrieve
+ * @return Current discovery state (failed or complete)
*/
enum pd_discovery_state pd_get_identity_discovery(int port,
enum tcpm_transmit_type type);
/**
+ * Set SVID discovery state for this type and port.
+ *
+ * @param port USB-C port number
+ * @param type SOP* type to set
+ * @param disc Discovery state to set (failed or complete)
+ */
+void pd_set_svids_discovery(int port, enum tcpm_transmit_type type,
+ enum pd_discovery_state disc);
+
+/**
+ * Get SVID discovery state for this type and port
+ *
+ * @param port USB-C port number
+ * @param type SOP* type to retrieve
+ * @return Current discovery state (failed or complete)
+ */
+enum pd_discovery_state pd_get_svids_discovery(int port,
+ enum tcpm_transmit_type type);
+
+/**
* Return a pointer to the discover identity response structure for this SOP*
* type
*
@@ -1710,9 +1742,10 @@ uint8_t pd_get_product_type(int port);
* Return the SVID count of port partner connected to a specified port
*
* @param port USB-C port number
+ * @param type SOP* type to retrieve
* @return SVID count
*/
-int pd_get_svid_count(int port);
+int pd_get_svid_count(int port, enum tcpm_transmit_type type);
/**
* Return the SVID of given SVID index of port partner connected
@@ -1720,9 +1753,10 @@ int pd_get_svid_count(int port);
*
* @param port USB-C port number
* @param svid_idx SVID Index
+ * @param type SOP* type to retrieve
* @return SVID
*/
-uint16_t pd_get_svid(int port, uint16_t svid_idx);
+uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_transmit_type type);
/**
* Return the pointer to modes of VDO of port partner connected
@@ -1730,9 +1764,11 @@ uint16_t pd_get_svid(int port, uint16_t svid_idx);
*
* @param port USB-C port number
* @param svid_idx SVID Index
+ * @param type SOP* type to retrieve
* @return Pointer to modes of VDO
*/
-uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx);
+uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx,
+ enum tcpm_transmit_type type);
/**
* Return the alternate mode entry and exit data
@@ -1779,10 +1815,12 @@ bool is_transmit_msg_sop_prime(int port);
* Returns the pointer to PD alternate mode discovery results
* Note: Caller function can mutate the data in this structure.
*
- * @param port USB-C port number
- * @return pointer to PD alternate mode discovery results
+ * @param port USB-C port number
+ * @param type Transmit type (SOP, SOP') for discovered information
+ * @return pointer to PD alternate mode discovery results
*/
-struct pd_discovery *pd_get_am_discovery(int port);
+struct pd_discovery *pd_get_am_discovery(int port,
+ enum tcpm_transmit_type type);
/*
* Return the pointer to PD cable attributes