summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-10-17 09:33:31 -0600
committerCommit Bot <commit-bot@chromium.org>2019-10-24 18:01:17 +0000
commite248f208ab8a55667bfe60ce48a188fc1a4620cc (patch)
tree2b3955afb2a53432c09467998e930407a47f02c1 /include
parent39f7d5d0e5c3ae72b9837a676fac401dfe51e745 (diff)
downloadchrome-ec-e248f208ab8a55667bfe60ce48a188fc1a4620cc.tar.gz
cleanup: clean up reference to power role vs cable plug
The PD header specifies the power role for SOP packets and cable plug for SOP' and SOP" packets. Refactor code to make this more obvious. BRANCH=none BUG=none TEST=builds and new stack runs on hatch Change-Id: I6cdb1561082d2142214ac65703ff42586b16d70b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865986 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd.h29
-rw-r--r--include/usb_tc_sm.h9
2 files changed, 29 insertions, 9 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 67bdb0e6cf..df2d790cab 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1237,21 +1237,32 @@ enum pd_rev_type {
PD_REV30
};
-/* Power role */
+/*
+ * Power role. See 6.2.1.1.4 Port Power Role. Only applies to SOP packets.
+ * Replaced by pd_cable_plug for SOP' and SOP" packets.
+ */
enum pd_power_role {
- PD_ROLE_SINK,
- PD_ROLE_SOURCE
+ PD_ROLE_SINK = 0,
+ PD_ROLE_SOURCE = 1
};
-/* Data role */
+/*
+ * Data role. See 6.2.1.1.6 Port Data Role. Only applies to SOP.
+ * Replaced by reserved field for SOP' and SOP" packets.
+ */
enum pd_data_role {
- PD_ROLE_UFP,
- PD_ROLE_DFP,
+ PD_ROLE_UFP = 0,
+ PD_ROLE_DFP = 1
};
-/* Cable plug */
-#define PD_PLUG_DFP_UFP 0
-#define PD_PLUG_CABLE_VPD 1
+/*
+ * Cable plug. See 6.2.1.1.7 Cable Plug. Only applies to SOP' and SOP".
+ * Replaced by pd_power_role for SOP packets.
+ */
+enum pd_cable_plug {
+ PD_PLUG_FROM_DFP_UFP = 0,
+ PD_PLUG_FROM_CABLE = 1
+};
/* Vconn role */
#define PD_ROLE_VCONN_OFF 0
diff --git a/include/usb_tc_sm.h b/include/usb_tc_sm.h
index 2b9912bc7b..f6971b07e3 100644
--- a/include/usb_tc_sm.h
+++ b/include/usb_tc_sm.h
@@ -64,6 +64,15 @@ enum pd_data_role tc_get_data_role(int port);
enum pd_power_role tc_get_power_role(int port);
/**
+ * Get cable plug setting. This should be constant per build. This replaces
+ * the power role bit in PD header for SOP' and SOP" packets.
+ *
+ * @param port USB-C port number
+ * @return PD cable plug setting
+ */
+enum pd_cable_plug tc_get_cable_plug(int port);
+
+/**
* Get current polarity
*
* @param port USB-C port number