diff options
author | Mayank Rana <mrana@codeaurora.org> | 2014-11-25 15:29:58 -0800 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:02:47 -0700 |
commit | 7c99b9d4d4517191e0ea4e5d7ee80e9671f40a87 (patch) | |
tree | 4e7e85d7586dfaf74fe2862b6bae38a7a14436a4 /drivers/usb/gadget/composite.c | |
parent | 691d89ad03d7ac5f8aded39b84ce0e831e07f044 (diff) |
dwc3: gadget: Replace polling mechnism to go into U0 state
Moving into U0 state is being confirmed by polling for 100ms after
performing remote wakeup from device. In some of cases where host is
taking more time to respond, remote wakeup is failing. Also USB
specification does not define any limit for the host response time.
Hence this change replaces polling mechnism by using LINK status
change event notification with core and increase host response time
from 100ms to 3 seconds. It also makes sure that composite_resume()
is being called after remote wakeup is completed succesfully.
It removes some of flag used to avoid race between bus suspend/resume
and fuction suspend/resume as those are serialize and not required
anymore.
CRs-Fixed: 712681
Change-Id: I71285daf117282c738e139e9a05ead6ef16dd202
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 283aa59ce9cd..dc672914fb03 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -388,8 +388,7 @@ int usb_get_func_interface_id(struct usb_function *func) return -ENODEV; } -static int usb_func_wakeup_int(struct usb_function *func, - bool use_pending_flag) +static int usb_func_wakeup_int(struct usb_function *func) { int ret; int interface_id; @@ -397,13 +396,14 @@ static int usb_func_wakeup_int(struct usb_function *func, struct usb_gadget *gadget; struct usb_composite_dev *cdev; - pr_debug("%s - %s function wakeup, use pending: %u\n", - __func__, func->name ? func->name : "", use_pending_flag); if (!func || !func->config || !func->config->cdev || !func->config->cdev->gadget) return -EINVAL; + pr_debug("%s - %s function wakeup\n", __func__, + func->name ? func->name : ""); + gadget = func->config->cdev->gadget; if ((gadget->speed != USB_SPEED_SUPER) || !func->func_wakeup_allowed) { DBG(func->config->cdev, @@ -416,13 +416,6 @@ static int usb_func_wakeup_int(struct usb_function *func, cdev = get_gadget_data(gadget); spin_lock_irqsave(&cdev->lock, flags); - - if (use_pending_flag && !func->func_wakeup_pending) { - pr_debug("Pending flag is cleared - Function wakeup is cancelled.\n"); - spin_unlock_irqrestore(&cdev->lock, flags); - return 0; - } - ret = usb_get_func_interface_id(func); if (ret < 0) { ERROR(func->config->cdev, @@ -435,14 +428,6 @@ static int usb_func_wakeup_int(struct usb_function *func, interface_id = ret; ret = usb_gadget_func_wakeup(gadget, interface_id); - - if (use_pending_flag) { - func->func_wakeup_pending = false; - } else { - if (ret == -EAGAIN) - func->func_wakeup_pending = true; - } - spin_unlock_irqrestore(&cdev->lock, flags); return ret; @@ -455,7 +440,7 @@ int usb_func_wakeup(struct usb_function *func) pr_debug("%s function wakeup\n", func->name ? func->name : ""); - ret = usb_func_wakeup_int(func, false); + ret = usb_func_wakeup_int(func); if (ret == -EAGAIN) { DBG(func->config->cdev, "Function wakeup for %s could not complete due to suspend state. Delayed until after bus resume.\n", @@ -2310,7 +2295,7 @@ void composite_resume(struct usb_gadget *gadget) if (cdev->config) { list_for_each_entry(f, &cdev->config->functions, list) { - ret = usb_func_wakeup_int(f, true); + ret = usb_func_wakeup_int(f); if (ret) { if (ret == -EAGAIN) { ERROR(f->config->cdev, |