summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-10-17 09:07:29 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-19 14:56:07 -0700
commit9f10ffc653837d5c8ef1509a23daadecf16e98a5 (patch)
treec6a2f06e0c6f559fea9b8a828fb75abd633e267b /include
parentde007979d37e2ad1ba7354df55fb267d858d5028 (diff)
downloadchrome-ec-9f10ffc653837d5c8ef1509a23daadecf16e98a5.tar.gz
cleanup: pd: Make PDO find / extract functions non-static
Allow other modules to call pd_find_pdo_index() / pd_extract_pdo_power() in order to get information about current PDOs. BUG=chromium:775542 TEST=Manual on kevin, verify 20V negotiation with zinger still works. BRANCH=servo Change-Id: I1861a0226501bda13e7d576d0971d841da9d2b74 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/724682 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index c1a9d0b063..f6354eb546 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -886,16 +886,15 @@ enum pd_request_type {
/**
* Decide which PDO to choose from the source capabilities.
*
- * @param cnt the number of Power Data Objects.
- * @param src_caps Power Data Objects representing the source capabilities.
+ * @param port USB-C port number
* @param rdo requested Request Data Object.
* @param ma selected current limit (stored on success)
* @param mv selected supply voltage (stored on success)
* @param req_type request type
* @return <0 if invalid, else EC_SUCCESS
*/
-int pd_build_request(int cnt, uint32_t *src_caps, uint32_t *rdo,
- uint32_t *ma, uint32_t *mv, enum pd_request_type req_type);
+int pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv,
+ enum pd_request_type req_type);
/**
* Check if max voltage request is allowed (only used if
@@ -915,6 +914,26 @@ int pd_is_max_request_allowed(void);
void pd_process_source_cap(int port, int cnt, uint32_t *src_caps);
/**
+ * Find PDO index that offers the most amount of power and stays within
+ * max_mv voltage.
+ *
+ * @param port USB-C port number
+ * @param max_mv maximum voltage (or -1 if no limit)
+ * @param pdo raw pdo corresponding to index, or index 0 on error (output)
+ * @return index of PDO within source cap packet
+ */
+int pd_find_pdo_index(int port, int max_mv, uint32_t *pdo);
+
+/**
+ * Extract power information out of a Power Data Object (PDO)
+ *
+ * @param pdo raw pdo to extract
+ * @param ma current of the PDO (output)
+ * @param mv voltage of the PDO (output)
+ */
+void pd_extract_pdo_power(uint32_t pdo, uint32_t *ma, uint32_t *mv);
+
+/**
* Reduce the sink power consumption to a minimum value.
*
* @param port USB-C port number