Add power management functions for the pxa27x USB OHCI host controller.
This is a totally rewritten version of the patch by Nicolas Pitre and
Todd Poynor which accounts for recent USB changes.
Signed-off-by: Richard Purdie
Index: git/drivers/usb/host/ohci-pxa27x.c
===================================================================
--- git.orig/drivers/usb/host/ohci-pxa27x.c 2005-10-30 11:26:52.000000000
+0000
+++ git/drivers/usb/host/ohci-pxa27x.c 2005-10-30 12:11:18.000000000 +0000
@@ -310,23 +310,40 @@
return 0;
}
+#ifdef CONFIG_PM
static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state)
{
-// struct platform_device *pdev = to_platform_device(dev);
-// struct usb_hcd *hcd = dev_get_drvdata(dev);
- printk("%s: not implemented yet\n", __FUNCTION__);
+ struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
+
+ if (time_before(jiffies, ohci->next_statechange))
+ msleep(5);
+ ohci->next_statechange = jiffies;
+
+ pxa27x_stop_hc(dev);
+ ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
+ dev->power.power_state = PMSG_SUSPEND;
return 0;
}
static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
{
-// struct platform_device *pdev = to_platform_device(dev);
-// struct usb_hcd *hcd = dev_get_drvdata(dev);
- printk("%s: not implemented yet\n", __FUNCTION__);
+ struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
+ int status;
+
+ if (time_before(jiffies, ohci->next_statechange))
+ msleep(5);
+ ohci->next_statechange = jiffies;
+
+ if ((status = pxa27x_start_hc(dev)) < 0)
+ return status;
+
+ dev->power.power_state = PMSG_ON;
+ usb_hcd_resume_root_hub(dev_get_drvdata(dev));
return 0;
}
+#endif
static struct device_driver ohci_hcd_pxa27x_driver = {
@@ -334,8 +351,10 @@
.bus = &platform_bus_type,
.probe = ohci_hcd_pxa27x_drv_probe,
.remove = ohci_hcd_pxa27x_drv_remove,
+#ifdef CONFIG_PM
.suspend = ohci_hcd_pxa27x_drv_suspend,
.resume = ohci_hcd_pxa27x_drv_resume,
+#endif
};
static int __init ohci_hcd_pxa27x_init (void)
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel