usb: gadget: f_mass_storage: Perform async runtime resume upon set_alt

commit 82f2935616 ("usb: gadget: f_mass_storage: Allow USB LPM
upon ep disable") just increments power usage count by 1 for dwc3 device
in thread handler. Since child count for dwc3 parent remains 0, there is
possibility of dwc3 parent going into suspend even if dwc3 power usage
count is set to 1. This causes unclocked register access as mdwc gets
runtime suspended and mass storage thread handler disables the endpoint.
Fix this issue by calling usb_gadget_autopm_get_async() in set_alt which
increments dwc3 power usage count and carry out resume asynchronously.

Change-Id: Iccce928590d8e67e234f0aa371f78eb1e6a326b7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This commit is contained in:
Mayank Rana 2017-03-15 16:12:35 -07:00
parent 928cd38621
commit 265b668a10

View file

@ -2336,9 +2336,6 @@ reset:
bh->outreq->complete = bulk_out_complete;
}
/* prevents usb LPM until thread runs to completion */
usb_gadget_autopm_get_noresume(common->gadget);
common->running = 1;
for (i = 0; i < ARRAY_SIZE(common->luns); ++i)
if (common->luns[i])
@ -2354,6 +2351,10 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
{
struct fsg_dev *fsg = fsg_from_func(f);
fsg->common->new_fsg = fsg;
/* prevents usb LPM until thread runs to completion */
usb_gadget_autopm_get_async(fsg->common->gadget);
raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
return USB_GADGET_DELAYED_STATUS;
}