aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-06-25 14:02:14 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 17:35:37 -0400
commit4147200d25c423e627ab4487530b3d9f2ef829c8 (patch)
tree7261fbfd97782482d18333f1b0e9de0e2e4bf968 /drivers
parent057c58bfb1dc9bbb75b8ba3b6c6336cfca63b9d0 (diff)
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 <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/hcd-pci.c4
-rw-r--r--drivers/usb/host/ehci-au1xxx.c2
-rw-r--r--drivers/usb/host/ehci-fsl.c3
-rw-r--r--drivers/usb/host/ehci-hub.c5
-rw-r--r--drivers/usb/host/ehci-pci.c4
-rw-r--r--drivers/usb/host/ehci.h8
-rw-r--r--drivers/usb/host/ohci-pci.c2
-rw-r--r--drivers/usb/host/uhci-hcd.c2
8 files changed, 16 insertions, 14 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index f0156de8db67..e387e394f876 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -386,7 +386,9 @@ static int hcd_pci_suspend(struct device *dev)
386 return retval; 386 return retval;
387 387
388 if (hcd->driver->pci_suspend) { 388 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);
390 suspend_report_result(hcd->driver->pci_suspend, retval); 392 suspend_report_result(hcd->driver->pci_suspend, retval);
391 if (retval) 393 if (retval)
392 return retval; 394 return retval;
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index faa61748db70..2baf8a849086 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -228,7 +228,7 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
228 * the root hub is either suspended or stopped. 228 * the root hub is either suspended or stopped.
229 */ 229 */
230 spin_lock_irqsave(&ehci->lock, flags); 230 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));
232 ehci_writel(ehci, 0, &ehci->regs->intr_enable); 232 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
233 (void)ehci_readl(ehci, &ehci->regs->intr_enable); 233 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
234 234
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 5cd967d28938..a416421abfa2 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -313,7 +313,8 @@ static int ehci_fsl_drv_suspend(struct device *dev)
313 struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); 313 struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
314 void __iomem *non_ehci = hcd->regs; 314 void __iomem *non_ehci = hcd->regs;
315 315
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));
317 if (!fsl_deep_sleep()) 318 if (!fsl_deep_sleep())
318 return 0; 319 return 0;
319 320
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 0931f5a7dec4..1292a5b2197a 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -107,7 +107,7 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
107} 107}
108 108
109static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, 109static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
110 bool suspending) 110 bool suspending, bool do_wakeup)
111{ 111{
112 int port; 112 int port;
113 u32 temp; 113 u32 temp;
@@ -117,8 +117,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
117 * when the controller is suspended or resumed. In all other 117 * when the controller is suspended or resumed. In all other
118 * cases they don't need to be changed. 118 * cases they don't need to be changed.
119 */ 119 */
120 if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || 120 if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
121 device_may_wakeup(ehci_to_hcd(ehci)->self.controller))
122 return; 121 return;
123 122
124 /* clear phy low-power mode before changing wakeup flags */ 123 /* clear phy low-power mode before changing wakeup flags */
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index a307d550bdaf..f555e4f35a04 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -277,7 +277,7 @@ done:
277 * Also they depend on separate root hub suspend/resume. 277 * Also they depend on separate root hub suspend/resume.
278 */ 278 */
279 279
280static int ehci_pci_suspend(struct usb_hcd *hcd) 280static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
281{ 281{
282 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 282 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
283 unsigned long flags; 283 unsigned long flags;
@@ -291,7 +291,7 @@ static int ehci_pci_suspend(struct usb_hcd *hcd)
291 * the root hub is either suspended or stopped. 291 * the root hub is either suspended or stopped.
292 */ 292 */
293 spin_lock_irqsave (&ehci->lock, flags); 293 spin_lock_irqsave (&ehci->lock, flags);
294 ehci_prepare_ports_for_controller_suspend(ehci); 294 ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup);
295 ehci_writel(ehci, 0, &ehci->regs->intr_enable); 295 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
296 (void)ehci_readl(ehci, &ehci->regs->intr_enable); 296 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
297 297
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index e6c57cc416f6..a4a63ce290e9 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -540,11 +540,11 @@ struct ehci_fstn {
540 540
541/* Prepare the PORTSC wakeup flags during controller suspend/resume */ 541/* Prepare the PORTSC wakeup flags during controller suspend/resume */
542 542
543#define ehci_prepare_ports_for_controller_suspend(ehci) \ 543#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup) \
544 ehci_adjust_port_wakeup_flags(ehci, true); 544 ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup);
545 545
546#define ehci_prepare_ports_for_controller_resume(ehci) \ 546#define ehci_prepare_ports_for_controller_resume(ehci) \
547 ehci_adjust_port_wakeup_flags(ehci, false); 547 ehci_adjust_port_wakeup_flags(ehci, false, false);
548 548
549/*-------------------------------------------------------------------------*/ 549/*-------------------------------------------------------------------------*/
550 550
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index b8a1148f248e..6bdc8b25a6a1 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -392,7 +392,7 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd)
392 392
393#ifdef CONFIG_PM 393#ifdef CONFIG_PM
394 394
395static int ohci_pci_suspend(struct usb_hcd *hcd) 395static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
396{ 396{
397 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 397 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
398 unsigned long flags; 398 unsigned long flags;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 2743ec770f0c..a7850f51fdc5 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -788,7 +788,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
788 return rc; 788 return rc;
789} 789}
790 790
791static int uhci_pci_suspend(struct usb_hcd *hcd) 791static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
792{ 792{
793 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 793 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
794 int rc = 0; 794 int rc = 0;