aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-omap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ohci-omap.c')
-rw-r--r--drivers/usb/host/ohci-omap.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index a574216625a0..45efeed1fcc3 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -420,9 +420,9 @@ static const struct hc_driver ohci_omap_hc_driver = {
420 */ 420 */
421 .hub_status_data = ohci_hub_status_data, 421 .hub_status_data = ohci_hub_status_data,
422 .hub_control = ohci_hub_control, 422 .hub_control = ohci_hub_control,
423#ifdef CONFIG_USB_SUSPEND 423#ifdef CONFIG_PM
424 .hub_suspend = ohci_hub_suspend, 424 .bus_suspend = ohci_bus_suspend,
425 .hub_resume = ohci_hub_resume, 425 .bus_resume = ohci_bus_resume,
426#endif 426#endif
427 .start_port_reset = ohci_start_port_reset, 427 .start_port_reset = ohci_start_port_reset,
428}; 428};
@@ -458,41 +458,29 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
458static int ohci_omap_suspend(struct device *dev, pm_message_t message) 458static 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
476static int ohci_omap_resume(struct device *dev) 472static 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
@@ -504,6 +492,7 @@ static int ohci_omap_resume(struct device *dev)
504 */ 492 */
505static struct device_driver ohci_hcd_omap_driver = { 493static struct device_driver ohci_hcd_omap_driver = {
506 .name = "ohci", 494 .name = "ohci",
495 .owner = THIS_MODULE,
507 .bus = &platform_bus_type, 496 .bus = &platform_bus_type,
508 .probe = ohci_hcd_omap_drv_probe, 497 .probe = ohci_hcd_omap_drv_probe,
509 .remove = ohci_hcd_omap_drv_remove, 498 .remove = ohci_hcd_omap_drv_remove,