usb: typec: Add attribute file showing the supported USB modes of the port
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. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20241016131834.898599-2-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0990e5c642
commit
8060bcb109
@@ -87,6 +87,17 @@ enum typec_orientation {
|
||||
TYPEC_ORIENTATION_REVERSE,
|
||||
};
|
||||
|
||||
enum usb_mode {
|
||||
USB_MODE_NONE,
|
||||
USB_MODE_USB2,
|
||||
USB_MODE_USB3,
|
||||
USB_MODE_USB4
|
||||
};
|
||||
|
||||
#define USB_CAPABILITY_USB2 BIT(0)
|
||||
#define USB_CAPABILITY_USB3 BIT(1)
|
||||
#define USB_CAPABILITY_USB4 BIT(2)
|
||||
|
||||
/*
|
||||
* struct enter_usb_data - Enter_USB Message details
|
||||
* @eudo: Enter_USB Data Object
|
||||
@@ -240,6 +251,7 @@ struct typec_partner_desc {
|
||||
* @port_type_set: Set port type
|
||||
* @pd_get: Get available USB Power Delivery Capabilities.
|
||||
* @pd_set: Set USB Power Delivery Capabilities.
|
||||
* @default_usb_mode_set: USB Mode to be used by default with Enter_USB Message
|
||||
*/
|
||||
struct typec_operations {
|
||||
int (*try_role)(struct typec_port *port, int role);
|
||||
@@ -250,6 +262,7 @@ struct typec_operations {
|
||||
enum typec_port_type type);
|
||||
struct usb_power_delivery **(*pd_get)(struct typec_port *port);
|
||||
int (*pd_set)(struct typec_port *port, struct usb_power_delivery *pd);
|
||||
int (*default_usb_mode_set)(struct typec_port *port, enum usb_mode mode);
|
||||
};
|
||||
|
||||
enum usb_pd_svdm_ver {
|
||||
@@ -267,6 +280,7 @@ enum usb_pd_svdm_ver {
|
||||
* @svdm_version: USB PD Structured VDM version if supported
|
||||
* @prefer_role: Initial role preference (DRP ports).
|
||||
* @accessory: Supported Accessory Modes
|
||||
* @usb_capability: Supported USB Modes
|
||||
* @fwnode: Optional fwnode of the port
|
||||
* @driver_data: Private pointer for driver specific info
|
||||
* @pd: Optional USB Power Delivery Support
|
||||
@@ -283,6 +297,7 @@ struct typec_capability {
|
||||
int prefer_role;
|
||||
enum typec_accessory accessory[TYPEC_MAX_ACCESSORY];
|
||||
unsigned int orientation_aware:1;
|
||||
u8 usb_capability;
|
||||
|
||||
struct fwnode_handle *fwnode;
|
||||
void *driver_data;
|
||||
@@ -350,6 +365,8 @@ int typec_port_set_usb_power_delivery(struct typec_port *port, struct usb_power_
|
||||
int typec_partner_set_usb_power_delivery(struct typec_partner *partner,
|
||||
struct usb_power_delivery *pd);
|
||||
|
||||
void typec_port_set_usb_mode(struct typec_port *port, enum usb_mode mode);
|
||||
|
||||
/**
|
||||
* struct typec_connector - Representation of Type-C port for external drivers
|
||||
* @attach: notification about device removal
|
||||
|
||||
Reference in New Issue
Block a user