diff options
Diffstat (limited to 'include/linux/usb/composite.h')
-rw-r--r-- | include/linux/usb/composite.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index ccb4fcb454d6..dc35fa77b3d2 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -41,6 +41,10 @@ #include <linux/log2.h> #include <linux/configfs.h> +/* FUNCTION_SUSPEND: suspend options from usb 3.0 spec Table 9-7 */ +#define FUNC_SUSPEND_OPT_SUSP_MASK BIT(0) +#define FUNC_SUSPEND_OPT_RW_EN_MASK BIT(1) + /* * USB function drivers should return USB_GADGET_DELAYED_STATUS if they * wish to delay the data/status stages of the control transfer till they @@ -51,7 +55,7 @@ #define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */ /* big enough to hold our biggest descriptor */ -#define USB_COMP_EP0_BUFSIZ 1024 +#define USB_COMP_EP0_BUFSIZ 4096 /* OS feature descriptor length <= 4kB */ #define USB_COMP_EP0_OS_DESC_BUFSIZ 4096 @@ -157,7 +161,14 @@ struct usb_os_desc_table { * @get_status: Returns function status as a reply to * GetStatus() request when the recipient is Interface. * @func_suspend: callback to be called when - * SetFeature(FUNCTION_SUSPEND) is reseived + * SetFeature(FUNCTION_SUSPEND) is received + * @func_is_suspended: Tells whether the function is currently in + * Function Suspend state (used in Super Speed mode only). + * @func_wakeup_allowed: Tells whether Function Remote Wakeup has been allowed + * by the USB host (used in Super Speed mode only). + * @func_wakeup_pending: Marks that the function has issued a Function Wakeup + * while the USB bus was suspended and therefore a Function Wakeup + * notification needs to be sent once the USB bus is resumed. * * A single USB function uses one or more interfaces, and should in most * cases support operation at both full and high speeds. Each function is @@ -185,6 +196,7 @@ struct usb_os_desc_table { struct usb_function { const char *name; + int intf_id; struct usb_gadget_strings **strings; struct usb_descriptor_header **fs_descriptors; struct usb_descriptor_header **hs_descriptors; @@ -226,6 +238,9 @@ struct usb_function { int (*get_status)(struct usb_function *); int (*func_suspend)(struct usb_function *, u8 suspend_opt); + unsigned func_is_suspended:1; + unsigned func_wakeup_allowed:1; + unsigned func_wakeup_pending:1; /* private: */ /* internals */ struct list_head list; @@ -241,6 +256,9 @@ int usb_function_deactivate(struct usb_function *); int usb_function_activate(struct usb_function *); int usb_interface_id(struct usb_configuration *, struct usb_function *); +int usb_func_wakeup(struct usb_function *func); + +int usb_get_func_interface_id(struct usb_function *func); int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, struct usb_ep *_ep); @@ -321,6 +339,10 @@ struct usb_configuration { unsigned highspeed:1; unsigned fullspeed:1; struct usb_function *interface[MAX_CONFIG_INTERFACES]; + + /* number of in and out eps used in this configuration */ + int num_ineps_used; + int num_outeps_used; }; int usb_add_config(struct usb_composite_dev *, |