Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280787
b: refs/heads/master
c: b870def
h: refs/heads/master
i:
  280785: 96c5d26
  280783: ac02f1b
v: v3
  • Loading branch information
Jingoo Han authored and Greg Kroah-Hartman committed Nov 30, 2011
1 parent a0520db commit aad70ac
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc27c96c2bee93068bfc60ea6b09611d88cef429
refs/heads/master: b870defebde40d01d951c9affd86c59841757c31
55 changes: 53 additions & 2 deletions trunk/drivers/usb/host/ohci-s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,66 @@ static int __devexit ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM
static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
struct platform_device *pdev = to_platform_device(dev);
unsigned long flags;
int rc = 0;

/*
* Root hub was already suspended. Disable irq emission and
* mark HW unaccessible, bail out if RH has been resumed. Use
* the spinlock to properly synchronize with possible pending
* RH suspend or resume activity.
*/
spin_lock_irqsave(&ohci->lock, flags);
if (ohci->rh_state != OHCI_RH_SUSPENDED) {
rc = -EINVAL;
goto bail;
}

clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);

s3c2410_stop_hc(pdev);
bail:
spin_unlock_irqrestore(&ohci->lock, flags);

return rc;
}

static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct platform_device *pdev = to_platform_device(dev);

s3c2410_start_hc(pdev, hcd);

set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
ohci_finish_controller_resume(hcd);

return 0;
}
#else
#define ohci_hcd_s3c2410_drv_suspend NULL
#define ohci_hcd_s3c2410_drv_resume NULL
#endif

static const struct dev_pm_ops ohci_hcd_s3c2410_pm_ops = {
.suspend = ohci_hcd_s3c2410_drv_suspend,
.resume = ohci_hcd_s3c2410_drv_resume,
};

static struct platform_driver ohci_hcd_s3c2410_driver = {
.probe = ohci_hcd_s3c2410_drv_probe,
.remove = __devexit_p(ohci_hcd_s3c2410_drv_remove),
.shutdown = usb_hcd_platform_shutdown,
/*.suspend = ohci_hcd_s3c2410_drv_suspend, */
/*.resume = ohci_hcd_s3c2410_drv_resume, */
.driver = {
.owner = THIS_MODULE,
.name = "s3c2410-ohci",
.pm = &ohci_hcd_s3c2410_pm_ops,
},
};

Expand Down

0 comments on commit aad70ac

Please sign in to comment.