aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-pxa27x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ohci-pxa27x.c')
-rw-r--r--drivers/usb/host/ohci-pxa27x.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index e44dc2cbca24..bbc0c3b720b2 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -477,38 +477,47 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
477 return 0; 477 return 0;
478} 478}
479 479
480#ifdef CONFIG_PM 480#ifdef CONFIG_PM
481static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) 481static int ohci_hcd_pxa27x_drv_suspend(struct device *dev)
482{ 482{
483 struct usb_hcd *hcd = platform_get_drvdata(pdev); 483 struct usb_hcd *hcd = dev_get_drvdata(dev);
484 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); 484 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
485 485
486 if (time_before(jiffies, ohci->ohci.next_statechange)) 486 if (time_before(jiffies, ohci->ohci.next_statechange))
487 msleep(5); 487 msleep(5);
488 ohci->ohci.next_statechange = jiffies; 488 ohci->ohci.next_statechange = jiffies;
489 489
490 pxa27x_stop_hc(ohci, &pdev->dev); 490 pxa27x_stop_hc(ohci, dev);
491 hcd->state = HC_STATE_SUSPENDED; 491 hcd->state = HC_STATE_SUSPENDED;
492 492
493 return 0; 493 return 0;
494} 494}
495 495
496static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) 496static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
497{ 497{
498 struct usb_hcd *hcd = platform_get_drvdata(pdev); 498 struct usb_hcd *hcd = dev_get_drvdata(dev);
499 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); 499 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
500 struct pxaohci_platform_data *inf = dev->platform_data;
500 int status; 501 int status;
501 502
502 if (time_before(jiffies, ohci->ohci.next_statechange)) 503 if (time_before(jiffies, ohci->ohci.next_statechange))
503 msleep(5); 504 msleep(5);
504 ohci->ohci.next_statechange = jiffies; 505 ohci->ohci.next_statechange = jiffies;
505 506
506 if ((status = pxa27x_start_hc(ohci, &pdev->dev)) < 0) 507 if ((status = pxa27x_start_hc(ohci, dev)) < 0)
507 return status; 508 return status;
508 509
510 /* Select Power Management Mode */
511 pxa27x_ohci_select_pmm(ohci, inf->port_mode);
512
509 ohci_finish_controller_resume(hcd); 513 ohci_finish_controller_resume(hcd);
510 return 0; 514 return 0;
511} 515}
516
517static struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = {
518 .suspend = ohci_hcd_pxa27x_drv_suspend,
519 .resume = ohci_hcd_pxa27x_drv_resume,
520};
512#endif 521#endif
513 522
514/* work with hotplug and coldplug */ 523/* work with hotplug and coldplug */
@@ -518,13 +527,12 @@ static struct platform_driver ohci_hcd_pxa27x_driver = {
518 .probe = ohci_hcd_pxa27x_drv_probe, 527 .probe = ohci_hcd_pxa27x_drv_probe,
519 .remove = ohci_hcd_pxa27x_drv_remove, 528 .remove = ohci_hcd_pxa27x_drv_remove,
520 .shutdown = usb_hcd_platform_shutdown, 529 .shutdown = usb_hcd_platform_shutdown,
521#ifdef CONFIG_PM
522 .suspend = ohci_hcd_pxa27x_drv_suspend,
523 .resume = ohci_hcd_pxa27x_drv_resume,
524#endif
525 .driver = { 530 .driver = {
526 .name = "pxa27x-ohci", 531 .name = "pxa27x-ohci",
527 .owner = THIS_MODULE, 532 .owner = THIS_MODULE,
533#ifdef CONFIG_PM
534 .pm = &ohci_hcd_pxa27x_pm_ops,
535#endif
528 }, 536 },
529}; 537};
530 538