diff options
Diffstat (limited to 'include/linux/usb/composite.h')
-rw-r--r-- | include/linux/usb/composite.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 3d29a7dcac2..a4a49c0ee74 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -36,8 +36,10 @@ #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> +#include <linux/switch.h> +struct usb_composite_dev; struct usb_configuration; /** @@ -101,6 +103,9 @@ struct usb_function { struct usb_configuration *config; + /* disabled is zero if the function is enabled */ + int disabled; + /* REVISIT: bind() functions can be marked __init, which * makes trouble for section mismatch analysis. See if * we can't restructure things to avoid mismatching. @@ -128,6 +133,7 @@ struct usb_function { /* internals */ struct list_head list; DECLARE_BITMAP(endpoints, 32); + struct device *dev; }; int usb_add_function(struct usb_configuration *, struct usb_function *); @@ -137,6 +143,9 @@ int usb_function_activate(struct usb_function *); int usb_interface_id(struct usb_configuration *, struct usb_function *); +void usb_function_set_enabled(struct usb_function *, int); +void usb_composite_force_reset(struct usb_composite_dev *); + /** * ep_choose - select descriptor endpoint at current device speed * @g: gadget, connected and running at some speed @@ -273,6 +282,9 @@ struct usb_composite_driver { struct usb_gadget_strings **strings; unsigned needs_serial:1; + struct class *class; + atomic_t function_count; + int (*unbind)(struct usb_composite_dev *); void (*disconnect)(struct usb_composite_dev *); @@ -280,6 +292,8 @@ struct usb_composite_driver { /* global suspend hooks */ void (*suspend)(struct usb_composite_dev *); void (*resume)(struct usb_composite_dev *); + + void (*enable_function)(struct usb_function *f, int enable); }; extern int usb_composite_probe(struct usb_composite_driver *driver, @@ -344,6 +358,15 @@ struct usb_composite_dev { /* protects at least deactivation count */ spinlock_t lock; + + /* switch indicating connected/disconnected state */ + struct switch_dev sw_connected; + /* switch indicating current configuration */ + struct switch_dev sw_config; + /* current connected state for sw_connected */ + bool connected; + + struct work_struct switch_work; }; extern int usb_string_id(struct usb_composite_dev *c); |