summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-11-12 12:51:03 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-15 05:59:55 +0000
commit9de2ef515fd8c534e6ff4dddee0c2b9f5ec012f2 (patch)
tree81f9a166863221f0af2b879ddc602af362fad6de /include/usb_pd.h
parentfeecd2ac585cc4680099707b39995f3d487abc18 (diff)
downloadchrome-ec-9de2ef515fd8c534e6ff4dddee0c2b9f5ec012f2.tar.gz
pd: allow policy layer to ask for PR/DR_swap on new contract
Allow policy layer to request a PR or DR swap upon formation of a power contract. Zinger always asks for a data swap so it can be a UFP, and Samus asks for a data swap only if it is a UFP to become a DFP. BUG=chrome-os-partner:33754, chrome-os-partner:31195 BRANCH=samus TEST=load onto samus and zinger and make sure they swap roles upon connect with no collisions Change-Id: I275c9669549c26f25c58f80845daad8edab11313 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229327 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h52
1 files changed, 39 insertions, 13 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 8bc4f6dd16..22d753e7d8 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -689,9 +689,9 @@ void pd_request_source_voltage(int port, int mv);
/**
* Set the PD input current limit.
*
- * @port USB-C port number
- * @max_ma Maximum current limit
- * @supply_voltage Voltage at which current limit is applied
+ * @param port USB-C port number
+ * @param max_ma Maximum current limit
+ * @param supply_voltage Voltage at which current limit is applied
*/
void pd_set_input_current_limit(int port, uint32_t max_ma,
uint32_t supply_voltage);
@@ -699,9 +699,9 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
/**
* Set the type-C input current limit.
*
- * @port USB-C port number
- * @max_ma Maximum current limit
- * @supply_voltage Voltage at which current limit is applied
+ * @param port USB-C port number
+ * @param max_ma Maximum current limit
+ * @param supply_voltage Voltage at which current limit is applied
*/
void typec_set_input_current_limit(int port, uint32_t max_ma,
uint32_t supply_voltage);
@@ -716,25 +716,37 @@ int pd_board_checks(void);
/**
* Check if power swap is allowed.
*
- * @port USB-C port number
+ * @param port USB-C port number
* @return True if power swap is allowed, False otherwise
*/
-int pd_power_swap(int port);
+int pd_check_power_swap(int port);
/**
* Check if data swap is allowed.
*
- * @port USB-C port number
- * @data_role current data role
+ * @param port USB-C port number
+ * @param data_role current data role
* @return True if data swap is allowed, False otherwise
*/
-int pd_data_swap(int port, int data_role);
+int pd_check_data_swap(int port, int data_role);
+
+/**
+ * A new power contract has been established
+ *
+ * @param port USB-C port number
+ * @param pr_role Our power role
+ * @param dr_role Our data role
+ * @param partner_pr_swap Partner supports PR_SWAP
+ * @param partner_dr_swap Partner supports DR_SWAP
+ */
+void pd_new_contract(int port, int pr_role, int dr_role,
+ int partner_pr_swap, int partner_dr_swap);
/**
* Execute data swap.
*
- * @port USB-C port number
- * @data_role new data role
+ * @param port USB-C port number
+ * @param data_role new data role
*/
void pd_execute_data_swap(int port, int data_role);
@@ -1047,6 +1059,20 @@ int pd_get_partner_dualrole_capable(int port);
int pd_get_partner_data_swap_capable(int port);
/**
+ * Request power swap command to be issued
+ *
+ * @param port USB-C port number
+ */
+void pd_request_power_swap(int port);
+
+/**
+ * Request data swap command to be issued
+ *
+ * @param port USB-C port number
+ */
+void pd_request_data_swap(int port);
+
+/**
* Set the PD communication enabled flag. When communication is disabled,
* the port can still detect connection and source power but will not
* send or respond to any PD communication.