summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2014-09-13 15:10:04 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit3ddfe86d404f4e9faa7c7b885e4f3fe81144ccfc (patch)
treea35cb6ae374a65cd0eb6ee9f8d37dc4816ee2fb5 /drivers/usb/chipidea
parent44d25a680c7372b5c665adeaa967d1a58aa148cc (diff)
MLK-12247 usb: chipidea: udc: disconnect host if system enters suspend
It is better we disconnect (pulldown dp) host when the system enters suspend if the host did not suspend bus beforehand, it can avoid unnecessary udc suspend irq during usb enters suspend. This unexpected suspend irq occurs due to the udc still pulls up dp, but the host suspends bus due to it finds the device has disconnected. The device turns off high speed terminal will be considered a disconnection event from the host. It also fixes the bug ENGR00325724 describes. Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit 9d9ddd142cdbfb4bcbaae161a452596668441b1a)
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/udc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index da7f8ba66bed..bd8288be1696 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -2107,12 +2107,20 @@ static void udc_resume_from_power_lost(struct ci_hdrc *ci)
static void udc_suspend(struct ci_hdrc *ci)
{
udc_suspend_for_power_lost(ci);
+
+ if (ci->driver && ci->vbus_active &&
+ (ci->gadget.state != USB_STATE_SUSPENDED))
+ usb_gadget_disconnect(&ci->gadget);
}
static void udc_resume(struct ci_hdrc *ci, bool power_lost)
{
- if (power_lost)
+ if (power_lost) {
udc_resume_from_power_lost(ci);
+ } else {
+ if (ci->driver && ci->vbus_active)
+ usb_gadget_connect(&ci->gadget);
+ }
}
/**