FROMGIT: usb: gadget: configfs: Add a specific configFS reset callback
In order for configFS based USB gadgets to set the proper charge current for bus reset scenarios, expose a separate reset callback to set the current to 100mA based on the USB battery charging specification. Reviewed-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Wesley Cheng <wcheng@codeaurora.org> Link: https://lore.kernel.org/r/1609283011-21997-4-git-send-email-wcheng@codeaurora.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 4d7aae9f7a18f27ade0fc1d275f272f23529d6ba https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I57b8d8c5e6726c0922e91c2f2c83cb85aef0436c
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
e2a855bb2c
commit
2db4f2a2a8
@@ -1647,6 +1647,28 @@ static void configfs_composite_disconnect(struct usb_gadget *gadget)
|
||||
|
||||
#endif // CONFIG_USB_CONFIGFS_UEVENT
|
||||
|
||||
static void configfs_composite_reset(struct usb_gadget *gadget)
|
||||
{
|
||||
struct usb_composite_dev *cdev;
|
||||
struct gadget_info *gi;
|
||||
unsigned long flags;
|
||||
|
||||
cdev = get_gadget_data(gadget);
|
||||
if (!cdev)
|
||||
return;
|
||||
|
||||
gi = container_of(cdev, struct gadget_info, cdev);
|
||||
spin_lock_irqsave(&gi->spinlock, flags);
|
||||
cdev = get_gadget_data(gadget);
|
||||
if (!cdev || gi->unbind) {
|
||||
spin_unlock_irqrestore(&gi->spinlock, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
composite_reset(gadget);
|
||||
spin_unlock_irqrestore(&gi->spinlock, flags);
|
||||
}
|
||||
|
||||
static void configfs_composite_suspend(struct usb_gadget *gadget)
|
||||
{
|
||||
struct usb_composite_dev *cdev;
|
||||
@@ -1701,7 +1723,7 @@ static const struct usb_gadget_driver configfs_driver_template = {
|
||||
.disconnect = android_disconnect,
|
||||
#else
|
||||
.setup = configfs_composite_setup,
|
||||
.reset = configfs_composite_disconnect,
|
||||
.reset = configfs_composite_reset,
|
||||
.disconnect = configfs_composite_disconnect,
|
||||
#endif
|
||||
.suspend = configfs_composite_suspend,
|
||||
|
Reference in New Issue
Block a user