diff options
Diffstat (limited to 'drivers/usb/host/ohci-omap.c')
-rw-r--r-- | drivers/usb/host/ohci-omap.c | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index d8f3ba7ad52e..49815ec4b842 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -14,6 +14,9 @@ | |||
14 | * This file is licenced under the GPL. | 14 | * This file is licenced under the GPL. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/signal.h> /* SA_INTERRUPT */ | ||
18 | #include <linux/jiffies.h> | ||
19 | |||
17 | #include <asm/hardware.h> | 20 | #include <asm/hardware.h> |
18 | #include <asm/io.h> | 21 | #include <asm/io.h> |
19 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
@@ -420,9 +423,9 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
420 | */ | 423 | */ |
421 | .hub_status_data = ohci_hub_status_data, | 424 | .hub_status_data = ohci_hub_status_data, |
422 | .hub_control = ohci_hub_control, | 425 | .hub_control = ohci_hub_control, |
423 | #ifdef CONFIG_USB_SUSPEND | 426 | #ifdef CONFIG_PM |
424 | .hub_suspend = ohci_hub_suspend, | 427 | .bus_suspend = ohci_bus_suspend, |
425 | .hub_resume = ohci_hub_resume, | 428 | .bus_resume = ohci_bus_resume, |
426 | #endif | 429 | #endif |
427 | .start_port_reset = ohci_start_port_reset, | 430 | .start_port_reset = ohci_start_port_reset, |
428 | }; | 431 | }; |
@@ -455,50 +458,32 @@ static int ohci_hcd_omap_drv_remove(struct device *dev) | |||
455 | 458 | ||
456 | #ifdef CONFIG_PM | 459 | #ifdef CONFIG_PM |
457 | 460 | ||
458 | static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level) | 461 | static int ohci_omap_suspend(struct device *dev, pm_message_t message) |
459 | { | 462 | { |
460 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 463 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); |
461 | int status = -EINVAL; | 464 | |
462 | 465 | if (time_before(jiffies, ohci->next_statechange)) | |
463 | if (level != SUSPEND_POWER_DOWN) | 466 | msleep(5); |
464 | return 0; | 467 | ohci->next_statechange = jiffies; |
465 | 468 | ||
466 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); | 469 | omap_ohci_clock_power(0); |
467 | status = ohci_hub_suspend(ohci_to_hcd(ohci)); | 470 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; |
468 | if (status == 0) { | 471 | dev->power.power_state = PMSG_SUSPEND; |
469 | omap_ohci_clock_power(0); | 472 | return 0; |
470 | ohci_to_hcd(ohci)->self.root_hub->state = | ||
471 | USB_STATE_SUSPENDED; | ||
472 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | ||
473 | dev->power.power_state = PMSG_SUSPEND; | ||
474 | } | ||
475 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); | ||
476 | return status; | ||
477 | } | 473 | } |
478 | 474 | ||
479 | static int ohci_omap_resume(struct device *dev, u32 level) | 475 | static int ohci_omap_resume(struct device *dev) |
480 | { | 476 | { |
481 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 477 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); |
482 | int status = 0; | ||
483 | |||
484 | if (level != RESUME_POWER_ON) | ||
485 | return 0; | ||
486 | 478 | ||
487 | if (time_before(jiffies, ohci->next_statechange)) | 479 | if (time_before(jiffies, ohci->next_statechange)) |
488 | msleep(5); | 480 | msleep(5); |
489 | ohci->next_statechange = jiffies; | 481 | ohci->next_statechange = jiffies; |
482 | |||
490 | omap_ohci_clock_power(1); | 483 | omap_ohci_clock_power(1); |
491 | #ifdef CONFIG_USB_SUSPEND | 484 | dev->power.power_state = PMSG_ON; |
492 | /* get extra cleanup even if remote wakeup isn't in use */ | 485 | usb_hcd_resume_root_hub(dev_get_drvdata(dev)); |
493 | status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); | 486 | return 0; |
494 | #else | ||
495 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); | ||
496 | status = ohci_hub_resume(ohci_to_hcd(ohci)); | ||
497 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); | ||
498 | #endif | ||
499 | if (status == 0) | ||
500 | dev->power.power_state = PMSG_ON; | ||
501 | return status; | ||
502 | } | 487 | } |
503 | 488 | ||
504 | #endif | 489 | #endif |
@@ -510,6 +495,7 @@ static int ohci_omap_resume(struct device *dev, u32 level) | |||
510 | */ | 495 | */ |
511 | static struct device_driver ohci_hcd_omap_driver = { | 496 | static struct device_driver ohci_hcd_omap_driver = { |
512 | .name = "ohci", | 497 | .name = "ohci", |
498 | .owner = THIS_MODULE, | ||
513 | .bus = &platform_bus_type, | 499 | .bus = &platform_bus_type, |
514 | .probe = ohci_hcd_omap_drv_probe, | 500 | .probe = ohci_hcd_omap_drv_probe, |
515 | .remove = ohci_hcd_omap_drv_remove, | 501 | .remove = ohci_hcd_omap_drv_remove, |