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-07-21 00:11:58 +0200
commit67b488c0ae982ca83072f2c89bb17c7cefd331b6 (patch)
tree467dcf4cc38d7fcc0ba56d59cda5eebca325d9e1
parent621e4906aae2bb3268555f0b028d8e111898f4fe (diff)
downloadkernel_goldelico_gta04-67b488c0ae982ca83072f2c89bb17c7cefd331b6.zip
kernel_goldelico_gta04-67b488c0ae982ca83072f2c89bb17c7cefd331b6.tar.gz
kernel_goldelico_gta04-67b488c0ae982ca83072f2c89bb17c7cefd331b6.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 37a261a..c14f8c6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2217,6 +2217,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;
}
@@ -2226,6 +2228,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;
}