diff options
author | David Brownell <david-b@pacbell.net> | 2005-09-23 01:42:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:40 -0400 |
commit | f197b2c54b9d9a133a9a8ff92f35cadf8945ea14 (patch) | |
tree | a5a4da41e38d8681977a9f3b52fa2e5f1db278ea /drivers/usb/host/ohci-omap.c | |
parent | 5f827ea3c3820cd8e0a1a35e4d275c8b78ee94e1 (diff) |
[PATCH] OHCI PM updates
This simplifies the OHCI root hub suspend logic:
- Uses new usbcore root hub calls to make autosuspend work again:
* Uses a newish usbcore root hub wakeup mechanism,
making requests to khubd not keventd.
* Uses an even newer sibling suspend hook.
- Expect someone always made usbcore call ohci_hub_suspend() before bus
glue fires; and that ohci_hub_resume() is only called after that bus
glue ran. Previously, only CONFIG_USB_SUSPEND promised those things.
(Includes updates to PCI and OMAP bus glue.)
- Handle a not-noticed-before special case during resume from one of
the swsusp snapshots when using "usb-handoff": the controller isn't
left in RESET state. (A bug to fix in the usb-handoff code...)
Also cleans up a minor debug printk glitch, and switches an mdelay over
to an msleep (how did that stick around for so long?).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ohci-dbg.c | 4 ----
drivers/usb/host/ohci-hcd.c | 2 +-
drivers/usb/host/ohci-hub.c | 42 ++++++++++++------------------------------
drivers/usb/host/ohci-mem.c | 1 -
drivers/usb/host/ohci-omap.c | 36 ++++++++++++------------------------
drivers/usb/host/ohci-pci.c | 40 ++++++++--------------------------------
drivers/usb/host/ohci.h | 1 -
7 files changed, 33 insertions(+), 93 deletions(-)
Diffstat (limited to 'drivers/usb/host/ohci-omap.c')
-rw-r--r-- | drivers/usb/host/ohci-omap.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index e67c07dc426d..b3498b9b965f 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -458,41 +458,29 @@ static int ohci_hcd_omap_drv_remove(struct device *dev) | |||
458 | static int ohci_omap_suspend(struct device *dev, pm_message_t message) | 458 | static int ohci_omap_suspend(struct device *dev, pm_message_t message) |
459 | { | 459 | { |
460 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 460 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); |
461 | int status = -EINVAL; | 461 | |
462 | 462 | if (time_before(jiffies, ohci->next_statechange)) | |
463 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); | 463 | msleep(5); |
464 | status = ohci_hub_suspend(ohci_to_hcd(ohci)); | 464 | ohci->next_statechange = jiffies; |
465 | if (status == 0) { | 465 | |
466 | omap_ohci_clock_power(0); | 466 | omap_ohci_clock_power(0); |
467 | ohci_to_hcd(ohci)->self.root_hub->state = | 467 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; |
468 | USB_STATE_SUSPENDED; | 468 | dev->power.power_state = PMSG_SUSPEND; |
469 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | 469 | return 0; |
470 | dev->power.power_state = PMSG_SUSPEND; | ||
471 | } | ||
472 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); | ||
473 | return status; | ||
474 | } | 470 | } |
475 | 471 | ||
476 | static int ohci_omap_resume(struct device *dev) | 472 | static int ohci_omap_resume(struct device *dev) |
477 | { | 473 | { |
478 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 474 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); |
479 | int status = 0; | ||
480 | 475 | ||
481 | if (time_before(jiffies, ohci->next_statechange)) | 476 | if (time_before(jiffies, ohci->next_statechange)) |
482 | msleep(5); | 477 | msleep(5); |
483 | ohci->next_statechange = jiffies; | 478 | ohci->next_statechange = jiffies; |
479 | |||
484 | omap_ohci_clock_power(1); | 480 | omap_ohci_clock_power(1); |
485 | #ifdef CONFIG_USB_SUSPEND | 481 | dev->power.power_state = PMSG_ON; |
486 | /* get extra cleanup even if remote wakeup isn't in use */ | 482 | usb_hcd_resume_root_hub(dev_get_drvdata(dev)); |
487 | status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); | 483 | return 0; |
488 | #else | ||
489 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); | ||
490 | status = ohci_hub_resume(ohci_to_hcd(ohci)); | ||
491 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); | ||
492 | #endif | ||
493 | if (status == 0) | ||
494 | dev->power.power_state = PMSG_ON; | ||
495 | return status; | ||
496 | } | 484 | } |
497 | 485 | ||
498 | #endif | 486 | #endif |