aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-13 01:37:48 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-10-24 08:09:10 -0400
commit5f40c6b6508b622ea03c6b32c57b2e26eba2e4f1 (patch)
treefd1f51a2f3c053fb4f92d7f6731ab5903a354ff2
parentcdcc966d48cd49159b8bfd07a588cef3036624e6 (diff)
mfd: Add more checks for WM8994 being active during suspend
Enhancements to the WM8994 audio driver and new features on more modern devices in the series mean that we can no longer rely on VMID being active as an indication that the device is active. Add further checks for digital paths and microphone detection. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/wm8994-core.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 1f15743460a0..9b01a22c3e70 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -281,6 +281,40 @@ static int wm8994_suspend(struct device *dev)
281 return 0; 281 return 0;
282 } 282 }
283 283
284 ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_4);
285 if (ret < 0) {
286 dev_err(dev, "Failed to read power status: %d\n", ret);
287 } else if (ret & (WM8994_AIF2ADCL_ENA | WM8994_AIF2ADCR_ENA |
288 WM8994_AIF1ADC2L_ENA | WM8994_AIF1ADC2R_ENA |
289 WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC1R_ENA)) {
290 dev_dbg(dev, "CODEC still active, ignoring suspend\n");
291 return 0;
292 }
293
294 ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_5);
295 if (ret < 0) {
296 dev_err(dev, "Failed to read power status: %d\n", ret);
297 } else if (ret & (WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA |
298 WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA |
299 WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA)) {
300 dev_dbg(dev, "CODEC still active, ignoring suspend\n");
301 return 0;
302 }
303
304 switch (wm8994->type) {
305 case WM8958:
306 ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1);
307 if (ret < 0) {
308 dev_err(dev, "Failed to read power status: %d\n", ret);
309 } else if (ret & WM8958_MICD_ENA) {
310 dev_dbg(dev, "CODEC still active, ignoring suspend\n");
311 return 0;
312 }
313 break;
314 default:
315 break;
316 }
317
284 /* Disable LDO pulldowns while the device is suspended if we 318 /* Disable LDO pulldowns while the device is suspended if we
285 * don't know that something will be driving them. */ 319 * don't know that something will be driving them. */
286 if (!wm8994->ldo_ena_always_driven) 320 if (!wm8994->ldo_ena_always_driven)