This attribute file, named "usb_capability", will show the supported USB modes, which are USB 2.0, USB 3.2 and USB4. These modes are defined in the USB Type-C (R2.0) and USB Power Delivery (R3.0 V2.0) Specifications.
Showing the changes to include/linux/usb (1 of 4 files). Show all
Unified · Split
| @@ -87,6 +87,17 @@ enum typec_orientation { · 86 unmodified lines | ||
| 87 | 87 | TYPEC_ORIENTATION_REVERSE, |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | +enum usb_mode { | |
| 91 | + USB_MODE_NONE, | |
| 92 | + USB_MODE_USB2, | |
| 93 | + USB_MODE_USB3, | |
| 94 | + USB_MODE_USB4 | |
| 95 | +}; | |
| 96 | + | |
| 97 | +#define USB_CAPABILITY_USB2 BIT(0) | |
| 98 | +#define USB_CAPABILITY_USB3 BIT(1) | |
| 99 | +#define USB_CAPABILITY_USB4 BIT(2) | |
| 100 | + | |
| 90 | 101 | /* |
| 91 | 102 | * struct enter_usb_data - Enter_USB Message details |
| 92 | 103 | * @eudo: Enter_USB Data Object |
| @@ -240,6 +251,7 @@ struct typec_partner_desc { · 147 unmodified lines | ||
| 240 | 251 | * @port_type_set: Set port type |
| 241 | 252 | * @pd_get: Get available USB Power Delivery Capabilities. |
| 242 | 253 | * @pd_set: Set USB Power Delivery Capabilities. |
| 254 | + * @default_usb_mode_set: USB Mode to be used by default with Enter_USB Message | |
| 243 | 255 | */ |
| 244 | 256 | struct typec_operations { |
| 245 | 257 | int (*try_role)(struct typec_port *port, int role); |
| @@ -250,6 +262,7 @@ struct typec_operations { · 4 unmodified lines | ||
| 250 | 262 | enum typec_port_type type); |
| 251 | 263 | struct usb_power_delivery **(*pd_get)(struct typec_port *port); |
| 252 | 264 | int (*pd_set)(struct typec_port *port, struct usb_power_delivery *pd); |
| 265 | + int (*default_usb_mode_set)(struct typec_port *port, enum usb_mode mode); | |
| 253 | 266 | }; |
| 254 | 267 | |
| 255 | 268 | enum usb_pd_svdm_ver { |
| @@ -267,6 +280,7 @@ enum usb_pd_svdm_ver { · 11 unmodified lines | ||
| 267 | 280 | * @svdm_version: USB PD Structured VDM version if supported |
| 268 | 281 | * @prefer_role: Initial role preference (DRP ports). |
| 269 | 282 | * @accessory: Supported Accessory Modes |
| 283 | + * @usb_capability: Supported USB Modes | |
| 270 | 284 | * @fwnode: Optional fwnode of the port |
| 271 | 285 | * @driver_data: Private pointer for driver specific info |
| 272 | 286 | * @pd: Optional USB Power Delivery Support |
| @@ -283,6 +297,7 @@ struct typec_capability { · 10 unmodified lines | ||
| 283 | 297 | int prefer_role; |
| 284 | 298 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; |
| 285 | 299 | unsigned int orientation_aware:1; |
| 300 | + u8 usb_capability; | |
| 286 | 301 | |
| 287 | 302 | struct fwnode_handle *fwnode; |
| 288 | 303 | void *driver_data; |
| @@ -350,6 +365,8 @@ int typec_port_set_usb_power_delivery(struct typec_port *port, struct usb_power_ · 61 unmodified lines | ||
| 350 | 365 | int typec_partner_set_usb_power_delivery(struct typec_partner *partner, |
| 351 | 366 | struct usb_power_delivery *pd); |
| 352 | 367 | |
| 368 | +void typec_port_set_usb_mode(struct typec_port *port, enum usb_mode mode); | |
| 369 | + | |
| 353 | 370 | /** |
| 354 | 371 | * struct typec_connector - Representation of Type-C port for external drivers |
| 355 | 372 | * @attach: notification about device removal |