aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-01-20 14:59:07 +1100
committerDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2013-03-09 20:27:47 +0100
commitd737bdb567b879edfb92cadc16059108e5548da4 (patch)
tree8f2ac12a0143dd3be7950ffae591c92eb15d8959
parent97e4f43196bdcafd3f079703b933408c6b68d07d (diff)
downloadkernel_goldelico_gta04-d737bdb567b879edfb92cadc16059108e5548da4.zip
kernel_goldelico_gta04-d737bdb567b879edfb92cadc16059108e5548da4.tar.gz
kernel_goldelico_gta04-d737bdb567b879edfb92cadc16059108e5548da4.tar.bz2
musb: fix context save over suspend.
It is possible that the musb device will be runtime-active (not suspended) when system suspend happens. In particular, usb_suspend() will have called choose_wakeup() which might have called pm_runtime_resume(). In that case, after system-resume, the state of the device will be 'active', but the state of the registers will have been lost (if off_mode is enabled). So we need to save_context in musb_suspend (if runtime state is active), and restore_context on resume. This effectively reverts 5d193ce8 (usb: musb: PM: fix context save/restore in suspend/resume path) and adds a rest to avoid saving/restoring context if device is already runtime suspended. Tested-by: Kevin Hilman <khilman@deeprootsystems.com> Cc: "Bilovol, Ruslan" <ruslan.bilovol@ti.com> Cc: Igor Grinberg <grinberg@compulab.co.il> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/usb/musb/musb_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index fd34867..9abb76d 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2225,6 +2225,8 @@ static int musb_suspend(struct device *dev)
}
spin_unlock_irqrestore(&musb->lock, flags);
+ if (!pm_runtime_status_suspended(dev))
+ musb_save_context(musb);
return 0;
}
@@ -2234,6 +2236,10 @@ static int musb_resume_noirq(struct device *dev)
* unless for some reason the whole soc powered down or the USB
* module got reset through the PSC (vs just being disabled).
*/
+ struct musb *musb = dev_to_musb(dev);
+
+ if (!pm_runtime_status_suspended(dev))
+ musb_restore_context(musb);
return 0;
}