]> git.hungrycats.org Git - linux/commitdiff
USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 29 Jan 2015 20:05:04 +0000 (15:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:53:00 +0000 (14:53 -0800)
commit 074f9dd55f9cab1b82690ed7e44bcf38b9616ce0 upstream.

Currently the USB stack assumes that all host controller drivers are
capable of receiving wakeup requests from downstream devices.
However, this isn't true for the isp1760-hcd driver, which means that
it isn't safe to do a runtime suspend of any device attached to a
root-hub port if the device requires wakeup.

This patch adds a "cant_recv_wakeups" flag to the usb_hcd structure
and sets the flag in isp1760-hcd.  The core is modified to prevent a
direct child of the root hub from being put into runtime suspend with
wakeup enabled if the flag is set.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c
drivers/usb/host/isp1760-hcd.c
include/linux/usb/hcd.h

index 900264a5baab564283ab21c50b5ca542e1a0a8ce..d7a6d8bc510b6f7fed18f168dc61ff1d4ff8d1b3 100644 (file)
@@ -1784,6 +1784,18 @@ static int autosuspend_check(struct usb_device *udev)
                dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n");
                return -EOPNOTSUPP;
        }
+
+       /*
+        * If the device is a direct child of the root hub and the HCD
+        * doesn't handle wakeup requests, don't allow autosuspend when
+        * wakeup is needed.
+        */
+       if (w && udev->parent == udev->bus->root_hub &&
+                       bus_to_hcd(udev->bus)->cant_recv_wakeups) {
+               dev_dbg(&udev->dev, "HCD doesn't handle wakeup requests\n");
+               return -EOPNOTSUPP;
+       }
+
        udev->do_remote_wakeup = w;
        return 0;
 }
index e752c3098f3803823ea2efa26ad27e7c81b42e7f..d2a856528471f27a4d1fb1b13362a87a5c887f5f 100644 (file)
@@ -2247,6 +2247,9 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len,
        hcd->rsrc_start = res_start;
        hcd->rsrc_len = res_len;
 
+       /* This driver doesn't support wakeup requests */
+       hcd->cant_recv_wakeups = 1;
+
        ret = usb_add_hcd(hcd, irq, irqflags);
        if (ret)
                goto err_unmap;
index 9e8d161bf2dbc1cb4df3883683c184c15ff3335b..2f48e1756cbd75feb5a909cc94a9180662e741fc 100644 (file)
@@ -146,6 +146,8 @@ struct usb_hcd {
        unsigned                amd_resume_bug:1; /* AMD remote wakeup quirk */
        unsigned                can_do_streams:1; /* HC supports streams */
        unsigned                tpl_support:1; /* OTG & EH TPL support */
+       unsigned                cant_recv_wakeups:1;
+                       /* wakeup requests from downstream aren't received */
 
        unsigned int            irq;            /* irq allocated */
        void __iomem            *regs;          /* device memory/io */