summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-03-29 22:07:22 -0600
committerCommit Bot <commit-bot@chromium.org>2020-04-16 08:32:20 +0000
commit0a0a2d43567935b8638f2149f3df93647bbdacc2 (patch)
treed3cc3b59797c9ca177faccfb23ee4f3ddbf91113 /include/usb_pd.h
parent6328b97450d66240066ddddeb55fd8f6185b36ef (diff)
downloadchrome-ec-0a0a2d43567935b8638f2149f3df93647bbdacc2.tar.gz
PD: Use new structure for storing SOP identity responses
Use the newly created identity_data structure to store the SOP discover identity response. For older boards which are almost out of static space, only allocate space for the SOP response. BRANCH=None BUG=b:152417977 TEST=on kindred with TCPMv2, confirm discovery can complete and correct data is given from the pe console command Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If63d9770bdfcc268734f7b45ce08a0a7abb396e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130476 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 6a58d35f5a..5b2647052d 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -364,14 +364,21 @@ enum pd_alternate_modes {
PD_AMODE_COUNT,
};
+/* Discover all SOP* communications when enabled */
+#ifdef CONFIG_USB_PD_DECODE_SOP
+#define DISCOVERY_TYPE_COUNT (TCPC_TX_SOP_PRIME_PRIME + 1)
+#else
+#define DISCOVERY_TYPE_COUNT (TCPC_TX_SOP + 1)
+#endif
+
/* Structure for storing discovery results */
struct pd_discovery {
/* index of svid currently being operated on */
int svid_idx;
/* count of svids discovered */
int svid_cnt;
- /* SVDM identity info (Id, Cert Stat, 0-4 Typec specific) */
- uint32_t identity[PDO_MAX_OBJECTS - 1];
+ /* 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];
/* active modes */
@@ -1663,6 +1670,38 @@ int dfp_discover_modes(int port, uint32_t *payload);
*/
void pd_dfp_discovery_init(int port);
+
+/**
+ * Set 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_identity_discovery(int port, enum tcpm_transmit_type type,
+ enum pd_discovery_state disc);
+
+/**
+ * Get 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)
+ */
+enum pd_discovery_state pd_get_identity_discovery(int port,
+ enum tcpm_transmit_type type);
+
+/**
+ * Return a pointer to the discover identity response structure for this SOP*
+ * type
+ *
+ * @param port USB-C port number
+ * @param type SOP* type to retrieve
+ * @return pointer to response structure, which the caller may not alter
+ */
+const union disc_ident_ack *pd_get_identity_response(int port,
+ enum tcpm_transmit_type type);
+
/**
* Return the VID of the USB PD accessory connected to a specified port
*