History

usb: pd: Add definition for DFP and UFP1 VDOs

The latest version of the USB Power Delivery Specification R3.0 added UFP and DFP product types for the Discover Identity message. Both types can be used for example for checking the USB capability of the partner, which means the USB modes (USB 2.0, USB 3.0 and USB4) that the partner device supports.

Heikki Krogerus committed 6 years ago

Commit d48ece01 parent 78239051 file · +32 −0Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/usb/pd_vdo.h+32−0
@@ -139,6 +139,38 @@ · 138 unmodified lines
139139 #define VDO_PRODUCT(pid, bcd) (((pid) & 0xffff) << 16 | ((bcd) & 0xffff))
140140 #define PD_PRODUCT_PID(vdo) (((vdo) >> 16) & 0xffff)
141141
142+/*
143+ * UFP VDO1
144+ * --------
145+ * <31:29> :: UFP VDO version
146+ * <28> :: Reserved
147+ * <27:24> :: Device capability
148+ * <23:6> :: Reserved
149+ * <5:3> :: Alternate modes
150+ * <2:0> :: USB highest speed
151+ */
152+#define PD_VDO1_UFP_DEVCAP(vdo) (((vdo) & GENMASK(27, 24)) >> 24)
153+
154+#define DEV_USB2_CAPABLE BIT(0)
155+#define DEV_USB2_BILLBOARD BIT(1)
156+#define DEV_USB3_CAPABLE BIT(2)
157+#define DEV_USB4_CAPABLE BIT(3)
158+
159+/*
160+ * DFP VDO
161+ * --------
162+ * <31:29> :: DFP VDO version
163+ * <28:27> :: Reserved
164+ * <26:24> :: Host capability
165+ * <23:5> :: Reserved
166+ * <4:0> :: Port number
167+ */
168+#define PD_VDO_DFP_HOSTCAP(vdo) (((vdo) & GENMASK(26, 24)) >> 24)
169+
170+#define HOST_USB2_CAPABLE BIT(0)
171+#define HOST_USB3_CAPABLE BIT(1)
172+#define HOST_USB4_CAPABLE BIT(2)
173+
142174 /*
143175 * Cable VDO
144176 * ---------

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t