USB: composite: Add usb_composite_force_reset utility to force enumeration
Use this rather than calling usb_gadget_disconnect and usb_gadget_connect
directly to avoid sending USB disconnect events to userspace when resetting
the bus.
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4cc4680..37352fc 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -47,6 +47,7 @@
*/
#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
+struct usb_composite_dev;
struct usb_configuration;
/**
@@ -151,6 +152,7 @@
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
@@ -372,6 +374,8 @@
spinlock_t lock;
struct switch_dev sdev;
+ /* used by usb_composite_force_reset to avoid signalling switch changes */
+ bool mute_switch;
struct work_struct switch_work;
};