diff options
Diffstat (limited to 'include/linux/usb/composite.h')
-rw-r--r-- | include/linux/usb/composite.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index b78cba466d3d..a316fba73518 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -59,6 +59,10 @@ struct usb_configuration; | |||
59 | * @hs_descriptors: Table of high speed descriptors, using interface and | 59 | * @hs_descriptors: Table of high speed descriptors, using interface and |
60 | * string identifiers assigned during @bind(). If this pointer is null, | 60 | * string identifiers assigned during @bind(). If this pointer is null, |
61 | * the function will not be available at high speed. | 61 | * the function will not be available at high speed. |
62 | * @ss_descriptors: Table of super speed descriptors, using interface and | ||
63 | * string identifiers assigned during @bind(). If this | ||
64 | * pointer is null after initiation, the function will not | ||
65 | * be available at super speed. | ||
62 | * @config: assigned when @usb_add_function() is called; this is the | 66 | * @config: assigned when @usb_add_function() is called; this is the |
63 | * configuration with which this function is associated. | 67 | * configuration with which this function is associated. |
64 | * @bind: Before the gadget can register, all of its functions bind() to the | 68 | * @bind: Before the gadget can register, all of its functions bind() to the |
@@ -77,6 +81,10 @@ struct usb_configuration; | |||
77 | * @setup: Used for interface-specific control requests. | 81 | * @setup: Used for interface-specific control requests. |
78 | * @suspend: Notifies functions when the host stops sending USB traffic. | 82 | * @suspend: Notifies functions when the host stops sending USB traffic. |
79 | * @resume: Notifies functions when the host restarts USB traffic. | 83 | * @resume: Notifies functions when the host restarts USB traffic. |
84 | * @get_status: Returns function status as a reply to | ||
85 | * GetStatus() request when the recepient is Interface. | ||
86 | * @func_suspend: callback to be called when | ||
87 | * SetFeature(FUNCTION_SUSPEND) is reseived | ||
80 | * | 88 | * |
81 | * A single USB function uses one or more interfaces, and should in most | 89 | * A single USB function uses one or more interfaces, and should in most |
82 | * cases support operation at both full and high speeds. Each function is | 90 | * cases support operation at both full and high speeds. Each function is |
@@ -106,6 +114,7 @@ struct usb_function { | |||
106 | struct usb_gadget_strings **strings; | 114 | struct usb_gadget_strings **strings; |
107 | struct usb_descriptor_header **descriptors; | 115 | struct usb_descriptor_header **descriptors; |
108 | struct usb_descriptor_header **hs_descriptors; | 116 | struct usb_descriptor_header **hs_descriptors; |
117 | struct usb_descriptor_header **ss_descriptors; | ||
109 | 118 | ||
110 | struct usb_configuration *config; | 119 | struct usb_configuration *config; |
111 | 120 | ||
@@ -132,6 +141,10 @@ struct usb_function { | |||
132 | void (*suspend)(struct usb_function *); | 141 | void (*suspend)(struct usb_function *); |
133 | void (*resume)(struct usb_function *); | 142 | void (*resume)(struct usb_function *); |
134 | 143 | ||
144 | /* USB 3.0 additions */ | ||
145 | int (*get_status)(struct usb_function *); | ||
146 | int (*func_suspend)(struct usb_function *, | ||
147 | u8 suspend_opt); | ||
135 | /* private: */ | 148 | /* private: */ |
136 | /* internals */ | 149 | /* internals */ |
137 | struct list_head list; | 150 | struct list_head list; |
@@ -145,20 +158,8 @@ int usb_function_activate(struct usb_function *); | |||
145 | 158 | ||
146 | int usb_interface_id(struct usb_configuration *, struct usb_function *); | 159 | int usb_interface_id(struct usb_configuration *, struct usb_function *); |
147 | 160 | ||
148 | /** | 161 | int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, |
149 | * ep_choose - select descriptor endpoint at current device speed | 162 | struct usb_ep *_ep); |
150 | * @g: gadget, connected and running at some speed | ||
151 | * @hs: descriptor to use for high speed operation | ||
152 | * @fs: descriptor to use for full or low speed operation | ||
153 | */ | ||
154 | static inline struct usb_endpoint_descriptor * | ||
155 | ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs, | ||
156 | struct usb_endpoint_descriptor *fs) | ||
157 | { | ||
158 | if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | ||
159 | return hs; | ||
160 | return fs; | ||
161 | } | ||
162 | 163 | ||
163 | #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ | 164 | #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ |
164 | 165 | ||
@@ -231,6 +232,7 @@ struct usb_configuration { | |||
231 | struct list_head list; | 232 | struct list_head list; |
232 | struct list_head functions; | 233 | struct list_head functions; |
233 | u8 next_interface_id; | 234 | u8 next_interface_id; |
235 | unsigned superspeed:1; | ||
234 | unsigned highspeed:1; | 236 | unsigned highspeed:1; |
235 | unsigned fullspeed:1; | 237 | unsigned fullspeed:1; |
236 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; | 238 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; |
@@ -252,6 +254,7 @@ int usb_add_config(struct usb_composite_dev *, | |||
252 | * identifiers. | 254 | * identifiers. |
253 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 255 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
254 | * and language IDs provided in control requests | 256 | * and language IDs provided in control requests |
257 | * @max_speed: Highest speed the driver supports. | ||
255 | * @needs_serial: set to 1 if the gadget needs userspace to provide | 258 | * @needs_serial: set to 1 if the gadget needs userspace to provide |
256 | * a serial number. If one is not provided, warning will be printed. | 259 | * a serial number. If one is not provided, warning will be printed. |
257 | * @unbind: Reverses bind; called as a side effect of unregistering | 260 | * @unbind: Reverses bind; called as a side effect of unregistering |
@@ -279,6 +282,7 @@ struct usb_composite_driver { | |||
279 | const char *iManufacturer; | 282 | const char *iManufacturer; |
280 | const struct usb_device_descriptor *dev; | 283 | const struct usb_device_descriptor *dev; |
281 | struct usb_gadget_strings **strings; | 284 | struct usb_gadget_strings **strings; |
285 | enum usb_device_speed max_speed; | ||
282 | unsigned needs_serial:1; | 286 | unsigned needs_serial:1; |
283 | 287 | ||
284 | int (*unbind)(struct usb_composite_dev *); | 288 | int (*unbind)(struct usb_composite_dev *); |