Commit 4e5b83d8e80254b1ad0831e4ce1bcb64fbfd830c

Authored by Alan Stern
Committed by Greg Kroah-Hartman
1 parent 76730c9fb3

USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)

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>

Showing 3 changed files with 17 additions and 0 deletions Side-by-side Diff

drivers/usb/core/driver.c
... ... @@ -1784,6 +1784,18 @@
1784 1784 dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n");
1785 1785 return -EOPNOTSUPP;
1786 1786 }
  1787 +
  1788 + /*
  1789 + * If the device is a direct child of the root hub and the HCD
  1790 + * doesn't handle wakeup requests, don't allow autosuspend when
  1791 + * wakeup is needed.
  1792 + */
  1793 + if (w && udev->parent == udev->bus->root_hub &&
  1794 + bus_to_hcd(udev->bus)->cant_recv_wakeups) {
  1795 + dev_dbg(&udev->dev, "HCD doesn't handle wakeup requests\n");
  1796 + return -EOPNOTSUPP;
  1797 + }
  1798 +
1787 1799 udev->do_remote_wakeup = w;
1788 1800 return 0;
1789 1801 }
drivers/usb/host/isp1760-hcd.c
... ... @@ -2247,6 +2247,9 @@
2247 2247 hcd->rsrc_start = res_start;
2248 2248 hcd->rsrc_len = res_len;
2249 2249  
  2250 + /* This driver doesn't support wakeup requests */
  2251 + hcd->cant_recv_wakeups = 1;
  2252 +
2250 2253 ret = usb_add_hcd(hcd, irq, irqflags);
2251 2254 if (ret)
2252 2255 goto err_unmap;
include/linux/usb/hcd.h
... ... @@ -146,6 +146,8 @@
146 146 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
147 147 unsigned can_do_streams:1; /* HC supports streams */
148 148 unsigned tpl_support:1; /* OTG & EH TPL support */
  149 + unsigned cant_recv_wakeups:1;
  150 + /* wakeup requests from downstream aren't received */
149 151  
150 152 unsigned int irq; /* irq allocated */
151 153 void __iomem *regs; /* device memory/io */