diff options
author | NeilBrown <neilb@suse.de> | 2013-01-20 14:59:07 +1100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@no-log.org> | 2013-03-09 14:51:26 +0100 |
commit | 79a9309b564b8ce36ae4f465a076004c5a42b278 (patch) | |
tree | b3514710c8427dd34c3c46366c3646c3ab2ca0bf | |
parent | 0fd2ee8443956d444406b3c20cdcc6b1b92d506c (diff) | |
download | kernel_goldelico_gta04-79a9309b564b8ce36ae4f465a076004c5a42b278.zip kernel_goldelico_gta04-79a9309b564b8ce36ae4f465a076004c5a42b278.tar.gz kernel_goldelico_gta04-79a9309b564b8ce36ae4f465a076004c5a42b278.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.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index bb56a0e..284044e 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2278,6 +2278,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; } @@ -2287,6 +2289,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; } |