diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2005-11-12 09:22:14 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:48:29 -0500 |
commit | 2e1dcc1600c1d83b26479edd076866595bbd3523 (patch) | |
tree | 8cdee2c9a12ec62b380b6c9f8ec13171d6b5a60f /drivers/usb/host | |
parent | 81f280e22f14d6d976620acaa1b346a90f4e1adc (diff) |
[PATCH] USB: Add pxa27x OHCI PM functions
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 <rpurdie@rpsys.net>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index c165d1ebed5c..3b1cfe939483 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -312,28 +312,49 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) | |||
312 | return 0; | 312 | return 0; |
313 | } | 313 | } |
314 | 314 | ||
315 | static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state) | 315 | #ifdef CONFIG_PM |
316 | static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) | ||
316 | { | 317 | { |
317 | // struct usb_hcd *hcd = platform_get_drvdata(dev); | 318 | struct ohci_hcd *ohci = platform_get_drvdata(pdev); |
318 | printk("%s: not implemented yet\n", __FUNCTION__); | 319 | |
320 | if (time_before(jiffies, ohci->next_statechange)) | ||
321 | msleep(5); | ||
322 | ohci->next_statechange = jiffies; | ||
323 | |||
324 | pxa27x_stop_hc(&pdev->dev); | ||
325 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | ||
326 | pdev->dev.power.power_state = PMSG_SUSPEND; | ||
319 | 327 | ||
320 | return 0; | 328 | return 0; |
321 | } | 329 | } |
322 | 330 | ||
323 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev) | 331 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) |
324 | { | 332 | { |
325 | // struct usb_hcd *hcd = platform_get_drvdata(dev); | 333 | struct ohci_hcd *ohci = platform_get_drvdata(pdev); |
326 | printk("%s: not implemented yet\n", __FUNCTION__); | 334 | int status; |
335 | |||
336 | if (time_before(jiffies, ohci->next_statechange)) | ||
337 | msleep(5); | ||
338 | ohci->next_statechange = jiffies; | ||
339 | |||
340 | if ((status = pxa27x_start_hc(&pdev->dev)) < 0) | ||
341 | return status; | ||
342 | |||
343 | pdev->dev.power.power_state = PMSG_ON; | ||
344 | usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); | ||
327 | 345 | ||
328 | return 0; | 346 | return 0; |
329 | } | 347 | } |
348 | #endif | ||
330 | 349 | ||
331 | 350 | ||
332 | static struct platform_driver ohci_hcd_pxa27x_driver = { | 351 | static struct platform_driver ohci_hcd_pxa27x_driver = { |
333 | .probe = ohci_hcd_pxa27x_drv_probe, | 352 | .probe = ohci_hcd_pxa27x_drv_probe, |
334 | .remove = ohci_hcd_pxa27x_drv_remove, | 353 | .remove = ohci_hcd_pxa27x_drv_remove, |
354 | #ifdef CONFIG_PM | ||
335 | .suspend = ohci_hcd_pxa27x_drv_suspend, | 355 | .suspend = ohci_hcd_pxa27x_drv_suspend, |
336 | .resume = ohci_hcd_pxa27x_drv_resume, | 356 | .resume = ohci_hcd_pxa27x_drv_resume, |
357 | #endif | ||
337 | .driver = { | 358 | .driver = { |
338 | .name = "pxa27x-ohci", | 359 | .name = "pxa27x-ohci", |
339 | }, | 360 | }, |