[PATCH] USB: ohci-omap pm updates
The recent "pm_message_t" changes removed functionality from the Linux PM framework. This patch removes it from the OMAP OHCI too, removing the distinction between (previous) PM_SUSPEND_MEM and PM_SUSPEND_DISK state transitions ... now the only suspend semantics supportable are what was previously PM_SUSPEND_DISK (4) and is now "PMSG_SUSPEND" (3). From: Todd Poynor <tpoynor@mvista.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1d7beee3d4
commit
b404a5b02a
@@ -456,34 +456,22 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
|
|||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
|
|
||||||
/* states match PCI usage, always suspending the root hub except that
|
static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level)
|
||||||
* 4 ~= D3cold (ACPI D3) with clock off (resume sees reset).
|
|
||||||
*
|
|
||||||
* FIXME: above comment is not right, and code is wrong, too :-(.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level)
|
|
||||||
{
|
{
|
||||||
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
|
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
|
||||||
int status = -EINVAL;
|
int status = -EINVAL;
|
||||||
|
|
||||||
if (level != SUSPEND_POWER_DOWN)
|
if (level != SUSPEND_POWER_DOWN)
|
||||||
return 0;
|
return 0;
|
||||||
if (state <= dev->power.power_state)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
dev_dbg(dev, "suspend to %d\n", state);
|
|
||||||
down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
||||||
status = ohci_hub_suspend(ohci_to_hcd(ohci));
|
status = ohci_hub_suspend(ohci_to_hcd(ohci));
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
if (state >= 4) {
|
omap_ohci_clock_power(0);
|
||||||
omap_ohci_clock_power(0);
|
ohci_to_hcd(ohci)->self.root_hub->state =
|
||||||
ohci_to_hcd(ohci)->self.root_hub->state =
|
USB_STATE_SUSPENDED;
|
||||||
USB_STATE_SUSPENDED;
|
|
||||||
state = 4;
|
|
||||||
}
|
|
||||||
ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
|
ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
|
||||||
dev->power.power_state = state;
|
dev->power.power_state = PMSG_SUSPEND;
|
||||||
}
|
}
|
||||||
up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
||||||
return status;
|
return status;
|
||||||
@@ -497,29 +485,20 @@ static int ohci_omap_resume(struct device *dev, u32 level)
|
|||||||
if (level != RESUME_POWER_ON)
|
if (level != RESUME_POWER_ON)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (dev->power.power_state) {
|
if (time_before(jiffies, ohci->next_statechange))
|
||||||
case 0:
|
msleep(5);
|
||||||
break;
|
ohci->next_statechange = jiffies;
|
||||||
case 4:
|
omap_ohci_clock_power(1);
|
||||||
if (time_before(jiffies, ohci->next_statechange))
|
|
||||||
msleep(5);
|
|
||||||
ohci->next_statechange = jiffies;
|
|
||||||
omap_ohci_clock_power(1);
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
default:
|
|
||||||
dev_dbg(dev, "resume from %d\n", dev->power.power_state);
|
|
||||||
#ifdef CONFIG_USB_SUSPEND
|
#ifdef CONFIG_USB_SUSPEND
|
||||||
/* get extra cleanup even if remote wakeup isn't in use */
|
/* get extra cleanup even if remote wakeup isn't in use */
|
||||||
status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub);
|
status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub);
|
||||||
#else
|
#else
|
||||||
down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
||||||
status = ohci_hub_resume(ohci_to_hcd(ohci));
|
status = ohci_hub_resume(ohci_to_hcd(ohci));
|
||||||
up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
|
||||||
#endif
|
#endif
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
dev->power.power_state = 0;
|
dev->power.power_state = PMSG_ON;
|
||||||
break;
|
|
||||||
}
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user