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 | TYPEC_ORIENTATION_REVERSE, | 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 | * struct enter_usb_data - Enter_USB Message details | 102 | * struct enter_usb_data - Enter_USB Message details |
| 92 | * @eudo: Enter_USB Data Object | 103 | * @eudo: Enter_USB Data Object |
| @@ -240,6 +251,7 @@ struct typec_partner_desc { · 147 unmodified lines | |||
| 240 | * @port_type_set: Set port type | 251 | * @port_type_set: Set port type |
| 241 | * @pd_get: Get available USB Power Delivery Capabilities. | 252 | * @pd_get: Get available USB Power Delivery Capabilities. |
| 242 | * @pd_set: Set USB Power Delivery Capabilities. | 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 | struct typec_operations { | 256 | struct typec_operations { |
| 245 | int (*try_role)(struct typec_port *port, int role); | 257 | int (*try_role)(struct typec_port *port, int role); |
| @@ -250,6 +262,7 @@ struct typec_operations { · 4 unmodified lines | |||
| 250 | enum typec_port_type type); | 262 | enum typec_port_type type); |
| 251 | struct usb_power_delivery **(*pd_get)(struct typec_port *port); | 263 | struct usb_power_delivery **(*pd_get)(struct typec_port *port); |
| 252 | int (*pd_set)(struct typec_port *port, struct usb_power_delivery *pd); | 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 | enum usb_pd_svdm_ver { | 268 | enum usb_pd_svdm_ver { |
| @@ -267,6 +280,7 @@ enum usb_pd_svdm_ver { · 11 unmodified lines | |||
| 267 | * @svdm_version: USB PD Structured VDM version if supported | 280 | * @svdm_version: USB PD Structured VDM version if supported |
| 268 | * @prefer_role: Initial role preference (DRP ports). | 281 | * @prefer_role: Initial role preference (DRP ports). |
| 269 | * @accessory: Supported Accessory Modes | 282 | * @accessory: Supported Accessory Modes |
| 283 | * @usb_capability: Supported USB Modes | ||
| 270 | * @fwnode: Optional fwnode of the port | 284 | * @fwnode: Optional fwnode of the port |
| 271 | * @driver_data: Private pointer for driver specific info | 285 | * @driver_data: Private pointer for driver specific info |
| 272 | * @pd: Optional USB Power Delivery Support | 286 | * @pd: Optional USB Power Delivery Support |
| @@ -283,6 +297,7 @@ struct typec_capability { · 10 unmodified lines | |||
| 283 | int prefer_role; | 297 | int prefer_role; |
| 284 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; | 298 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; |
| 285 | unsigned int orientation_aware:1; | 299 | unsigned int orientation_aware:1; |
| 300 | u8 usb_capability; | ||
| 286 | 301 | ||
| 287 | struct fwnode_handle *fwnode; | 302 | struct fwnode_handle *fwnode; |
| 288 | void *driver_data; | 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 | int typec_partner_set_usb_power_delivery(struct typec_partner *partner, | 365 | int typec_partner_set_usb_power_delivery(struct typec_partner *partner, |
| 351 | struct usb_power_delivery *pd); | 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 | * struct typec_connector - Representation of Type-C port for external drivers | 371 | * struct typec_connector - Representation of Type-C port for external drivers |
| 355 | * @attach: notification about device removal | 372 | * @attach: notification about device removal |