summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJameson Thies <jthies@google.com>2022-04-26 00:31:30 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-04 22:27:27 +0000
commitcb74b8ed9fdc852bc5b4d79424a5b4434a939742 (patch)
treed321af60342f68aa0f8b2cb08b0e22e2e9c0027c /include
parent94b53640add6248bd7f6847a1c0096e07db04188 (diff)
downloadchrome-ec-cb74b8ed9fdc852bc5b4d79424a5b4434a939742.tar.gz
TCPMv2: Request partner's revision information in src/snk startup
Adding features from the USB PD 3.1 revision of the specification requires us to know the difference between USB PD Rev 3.0 and USB PD Rev 3.1 devices. But, the message header only has 2 bits for revision and only provides the major revision. To determine a devices minor revision, TCPMv2 will need to send a Get_Revision command and store the Revision response which has major/minor revision/version information. This CL adds support for sending Get_Revision, and receiving Revision. BUG=b:214087135 TEST=Checked that the PE state was correctly holding the Revision response from a USB PD Rev 3.1 partner, and also checked that the stored RMDO value was 0 for a USB PD Rev 3.0 partner. BRANCH=none Signed-off-by: Jameson Thies <jthies@google.com> Change-Id: I99f10c15750c3a1fee1d8bad89b0c4a0b0a6b2ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3607054 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 5b389e1bb4..8ec4e9eaf3 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -590,6 +590,18 @@ struct partner_active_modes {
#define PD_PRODUCT_PID(vdo) (((vdo) >> 16) & 0xffff)
/*
+ * PD Rev 3.1 Revision Message Data Object (RMDO)
+ * Only bits 16-31 have data. A uint_16t is used to hold RMDOs upper 16 bits.
+ */
+struct rmdo {
+ int reserved : 16;
+ int minor_ver : 4;
+ int major_ver : 4;
+ int minor_rev : 4;
+ int major_rev : 4;
+};
+
+/*
* Message id starts from 0 to 7. If last_msg_id is initialized to 0,
* it will lead to repetitive message id with first received packet,
* so initialize it with an invalid value 0xff.
@@ -1017,6 +1029,7 @@ enum pd_dpm_request {
DPM_REQUEST_FRS_DET_ENABLE = BIT(21),
DPM_REQUEST_FRS_DET_DISABLE = BIT(22),
DPM_REQUEST_DATA_RESET = BIT(23),
+ DPM_REQUEST_GET_REVISION = BIT(24),
};
/**
@@ -1152,7 +1165,11 @@ enum pd_ctrl_msg_type {
PD_CTRL_FR_SWAP = 19,
PD_CTRL_GET_PPS_STATUS = 20,
PD_CTRL_GET_COUNTRY_CODES = 21,
- /* 22-31 Reserved */
+ PD_CTRL_GET_SINK_CAP_EXT = 22,
+ /* Used for REV 3.1 */
+ PD_CTRL_GET_SOURCE_INFO = 23,
+ PD_CTRL_GET_REVISION = 24,
+ /* 25-31 Reserved */
};
/* Control message types which always mark the start of an AMS */
@@ -1225,7 +1242,14 @@ enum pd_ext_msg_type {
PD_EXT_PPS_STATUS = 12,
PD_EXT_COUNTRY_INFO = 13,
PD_EXT_COUNTRY_CODES = 14,
- /* 15-31 Reserved */
+ /* Used for REV 3.1 */
+ PD_EXT_SINK_CAP = 15,
+ PD_EXT_CONTROL = 16,
+ PD_EXT_EPR_SOURCE_CAP = 17,
+ PD_EXT_EPR_SINK_CAP = 18,
+ /* 19-29 Reserved */
+ PD_EXT_VENDOR_DEF = 30,
+ /* 31 Reserved */
};
/* Alert Data Object fields for REV 3.0 */
@@ -1245,13 +1269,19 @@ enum pd_data_msg_type {
PD_DATA_REQUEST = 2,
PD_DATA_BIST = 3,
PD_DATA_SINK_CAP = 4,
- /* 5-14 Reserved for REV 2.0 */
+ /* Used for REV 3.0 */
PD_DATA_BATTERY_STATUS = 5,
PD_DATA_ALERT = 6,
PD_DATA_GET_COUNTRY_INFO = 7,
- /* 8-14 Reserved for REV 3.0 */
PD_DATA_ENTER_USB = 8,
+ /* Used for REV 3.1 */
+ PD_DATA_EPR_REQUEST = 9,
+ PD_DATA_EPR_MODE = 10,
+ PD_DATA_SOURCE_INFO = 11,
+ PD_DATA_REVISION = 12,
+ /* 13-14 Reserved */
PD_DATA_VENDOR_DEF = 15,
+ /* 16-31 Reserved */
};