diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-02-04 09:57:43 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-03-02 04:57:50 -0500 |
commit | 77bd70e9009eab6dbdef3ee08afe87ab26df8dac (patch) | |
tree | 26de85180fad61c771e3e03fb9c49017ec32be19 /drivers | |
parent | 73ee6524d55444dc80c691ff8602e08940df3d47 (diff) |
mfd: Don't suspend WM8994 if the CODEC is not suspended
ASoC supports keeping the audio subsysetm active over suspend in order
to support use cases such as audio passthrough from a cellular modem
with the main CPU suspended. Ensure that we don't power down the CODEC
when this is happening by checking to see if VMID is up and skipping
suspend and resume when it is. If the CODEC has suspended then it'll
turn VMID off before the core suspend() gets called.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/wm8994-core.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 41233c7fa58..f4016a075fd 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -246,6 +246,16 @@ static int wm8994_suspend(struct device *dev) | |||
246 | struct wm8994 *wm8994 = dev_get_drvdata(dev); | 246 | struct wm8994 *wm8994 = dev_get_drvdata(dev); |
247 | int ret; | 247 | int ret; |
248 | 248 | ||
249 | /* Don't actually go through with the suspend if the CODEC is | ||
250 | * still active (eg, for audio passthrough from CP. */ | ||
251 | ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_1); | ||
252 | if (ret < 0) { | ||
253 | dev_err(dev, "Failed to read power status: %d\n", ret); | ||
254 | } else if (ret & WM8994_VMID_SEL_MASK) { | ||
255 | dev_dbg(dev, "CODEC still active, ignoring suspend\n"); | ||
256 | return 0; | ||
257 | } | ||
258 | |||
249 | /* GPIO configuration state is saved here since we may be configuring | 259 | /* GPIO configuration state is saved here since we may be configuring |
250 | * the GPIO alternate functions even if we're not using the gpiolib | 260 | * the GPIO alternate functions even if we're not using the gpiolib |
251 | * driver for them. | 261 | * driver for them. |
@@ -261,6 +271,8 @@ static int wm8994_suspend(struct device *dev) | |||
261 | if (ret < 0) | 271 | if (ret < 0) |
262 | dev_err(dev, "Failed to save LDO registers: %d\n", ret); | 272 | dev_err(dev, "Failed to save LDO registers: %d\n", ret); |
263 | 273 | ||
274 | wm8994->suspended = true; | ||
275 | |||
264 | ret = regulator_bulk_disable(wm8994->num_supplies, | 276 | ret = regulator_bulk_disable(wm8994->num_supplies, |
265 | wm8994->supplies); | 277 | wm8994->supplies); |
266 | if (ret != 0) { | 278 | if (ret != 0) { |
@@ -276,6 +288,10 @@ static int wm8994_resume(struct device *dev) | |||
276 | struct wm8994 *wm8994 = dev_get_drvdata(dev); | 288 | struct wm8994 *wm8994 = dev_get_drvdata(dev); |
277 | int ret; | 289 | int ret; |
278 | 290 | ||
291 | /* We may have lied to the PM core about suspending */ | ||
292 | if (!wm8994->suspended) | ||
293 | return 0; | ||
294 | |||
279 | ret = regulator_bulk_enable(wm8994->num_supplies, | 295 | ret = regulator_bulk_enable(wm8994->num_supplies, |
280 | wm8994->supplies); | 296 | wm8994->supplies); |
281 | if (ret != 0) { | 297 | if (ret != 0) { |
@@ -298,6 +314,8 @@ static int wm8994_resume(struct device *dev) | |||
298 | if (ret < 0) | 314 | if (ret < 0) |
299 | dev_err(dev, "Failed to restore GPIO registers: %d\n", ret); | 315 | dev_err(dev, "Failed to restore GPIO registers: %d\n", ret); |
300 | 316 | ||
317 | wm8994->suspended = false; | ||
318 | |||
301 | return 0; | 319 | return 0; |
302 | } | 320 | } |
303 | #endif | 321 | #endif |