Skip to content

Commit 4147200

Browse files
AlanSterngregkh
authored andcommitted
USB: add do_wakeup parameter for PCI HCD suspend
This patch (as1385) adds a "do_wakeup" parameter to the pci_suspend method used by PCI-based host controller drivers. ehci-hcd in particular needs to know whether or not to enable wakeup when suspending a controller. Although that information is currently available through device_may_wakeup(), when support is added for runtime suspend this will no longer be true. Signed-off-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 057c58b commit 4147200

File tree

9 files changed

+17
-15
lines changed

9 files changed

+17
-15
lines changed

drivers/usb/core/hcd-pci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ static int hcd_pci_suspend(struct device *dev)
386386
return retval;
387387

388388
if (hcd->driver->pci_suspend) {
389-
retval = hcd->driver->pci_suspend(hcd);
389+
bool do_wakeup = device_may_wakeup(dev);
390+
391+
retval = hcd->driver->pci_suspend(hcd, do_wakeup);
390392
suspend_report_result(hcd->driver->pci_suspend, retval);
391393
if (retval)
392394
return retval;

drivers/usb/host/ehci-au1xxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
228228
* the root hub is either suspended or stopped.
229229
*/
230230
spin_lock_irqsave(&ehci->lock, flags);
231-
ehci_prepare_ports_for_controller_suspend(ehci);
231+
ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev));
232232
ehci_writel(ehci, 0, &ehci->regs->intr_enable);
233233
(void)ehci_readl(ehci, &ehci->regs->intr_enable);
234234

drivers/usb/host/ehci-fsl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ static int ehci_fsl_drv_suspend(struct device *dev)
313313
struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
314314
void __iomem *non_ehci = hcd->regs;
315315

316-
ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd));
316+
ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
317+
device_may_wakeup(dev));
317318
if (!fsl_deep_sleep())
318319
return 0;
319320

drivers/usb/host/ehci-hub.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
107107
}
108108

109109
static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
110-
bool suspending)
110+
bool suspending, bool do_wakeup)
111111
{
112112
int port;
113113
u32 temp;
@@ -117,8 +117,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
117117
* when the controller is suspended or resumed. In all other
118118
* cases they don't need to be changed.
119119
*/
120-
if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup ||
121-
device_may_wakeup(ehci_to_hcd(ehci)->self.controller))
120+
if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
122121
return;
123122

124123
/* clear phy low-power mode before changing wakeup flags */

drivers/usb/host/ehci-pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
277277
* Also they depend on separate root hub suspend/resume.
278278
*/
279279

280-
static int ehci_pci_suspend(struct usb_hcd *hcd)
280+
static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
281281
{
282282
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
283283
unsigned long flags;
@@ -291,7 +291,7 @@ static int ehci_pci_suspend(struct usb_hcd *hcd)
291291
* the root hub is either suspended or stopped.
292292
*/
293293
spin_lock_irqsave (&ehci->lock, flags);
294-
ehci_prepare_ports_for_controller_suspend(ehci);
294+
ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup);
295295
ehci_writel(ehci, 0, &ehci->regs->intr_enable);
296296
(void)ehci_readl(ehci, &ehci->regs->intr_enable);
297297

drivers/usb/host/ehci.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,11 @@ struct ehci_fstn {
540540

541541
/* Prepare the PORTSC wakeup flags during controller suspend/resume */
542542

543-
#define ehci_prepare_ports_for_controller_suspend(ehci) \
544-
ehci_adjust_port_wakeup_flags(ehci, true);
543+
#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup) \
544+
ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup);
545545

546-
#define ehci_prepare_ports_for_controller_resume(ehci) \
547-
ehci_adjust_port_wakeup_flags(ehci, false);
546+
#define ehci_prepare_ports_for_controller_resume(ehci) \
547+
ehci_adjust_port_wakeup_flags(ehci, false, false);
548548

549549
/*-------------------------------------------------------------------------*/
550550

drivers/usb/host/ohci-pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd)
392392

393393
#ifdef CONFIG_PM
394394

395-
static int ohci_pci_suspend(struct usb_hcd *hcd)
395+
static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
396396
{
397397
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
398398
unsigned long flags;

drivers/usb/host/uhci-hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
788788
return rc;
789789
}
790790

791-
static int uhci_pci_suspend(struct usb_hcd *hcd)
791+
static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
792792
{
793793
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
794794
int rc = 0;

include/linux/usb/hcd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct hc_driver {
211211
* a whole, not just the root hub; they're for PCI bus glue.
212212
*/
213213
/* called after suspending the hub, before entering D3 etc */
214-
int (*pci_suspend)(struct usb_hcd *hcd);
214+
int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
215215

216216
/* called after entering D0 (etc), before resuming the hub */
217217
int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);

0 commit comments

Comments
 (0)