diff options
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r-- | drivers/mfd/wm8994-core.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index b03be1d4e0c..5d6ba132837 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -217,6 +217,47 @@ static int wm8994_suspend(struct device *dev) | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_4); | ||
221 | if (ret < 0) { | ||
222 | dev_err(dev, "Failed to read power status: %d\n", ret); | ||
223 | } else if (ret & (WM8994_AIF2ADCL_ENA | WM8994_AIF2ADCR_ENA | | ||
224 | WM8994_AIF1ADC2L_ENA | WM8994_AIF1ADC2R_ENA | | ||
225 | WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC1R_ENA)) { | ||
226 | dev_dbg(dev, "CODEC still active, ignoring suspend\n"); | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_5); | ||
231 | if (ret < 0) { | ||
232 | dev_err(dev, "Failed to read power status: %d\n", ret); | ||
233 | } else if (ret & (WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA | | ||
234 | WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA | | ||
235 | WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA)) { | ||
236 | dev_dbg(dev, "CODEC still active, ignoring suspend\n"); | ||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | switch (wm8994->type) { | ||
241 | case WM8958: | ||
242 | ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1); | ||
243 | if (ret < 0) { | ||
244 | dev_err(dev, "Failed to read power status: %d\n", ret); | ||
245 | } else if (ret & WM8958_MICD_ENA) { | ||
246 | dev_dbg(dev, "CODEC still active, ignoring suspend\n"); | ||
247 | return 0; | ||
248 | } | ||
249 | break; | ||
250 | default: | ||
251 | break; | ||
252 | } | ||
253 | |||
254 | /* Disable LDO pulldowns while the device is suspended if we | ||
255 | * don't know that something will be driving them. */ | ||
256 | if (!wm8994->ldo_ena_always_driven) | ||
257 | wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2, | ||
258 | WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD, | ||
259 | WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD); | ||
260 | |||
220 | /* GPIO configuration state is saved here since we may be configuring | 261 | /* GPIO configuration state is saved here since we may be configuring |
221 | * the GPIO alternate functions even if we're not using the gpiolib | 262 | * the GPIO alternate functions even if we're not using the gpiolib |
222 | * driver for them. | 263 | * driver for them. |
@@ -286,6 +327,11 @@ static int wm8994_resume(struct device *dev) | |||
286 | if (ret < 0) | 327 | if (ret < 0) |
287 | dev_err(dev, "Failed to restore GPIO registers: %d\n", ret); | 328 | dev_err(dev, "Failed to restore GPIO registers: %d\n", ret); |
288 | 329 | ||
330 | /* Disable LDO pulldowns while the device is active */ | ||
331 | wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2, | ||
332 | WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD, | ||
333 | 0); | ||
334 | |||
289 | wm8994->suspended = false; | 335 | wm8994->suspended = false; |
290 | 336 | ||
291 | return 0; | 337 | return 0; |
@@ -467,8 +513,15 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
467 | pdata->gpio_defaults[i]); | 513 | pdata->gpio_defaults[i]); |
468 | } | 514 | } |
469 | } | 515 | } |
516 | |||
517 | wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven; | ||
470 | } | 518 | } |
471 | 519 | ||
520 | /* Disable LDO pulldowns while the device is active */ | ||
521 | wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2, | ||
522 | WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD, | ||
523 | 0); | ||
524 | |||
472 | /* In some system designs where the regulators are not in use, | 525 | /* In some system designs where the regulators are not in use, |
473 | * we can achieve a small reduction in leakage currents by | 526 | * we can achieve a small reduction in leakage currents by |
474 | * floating LDO outputs. This bit makes no difference if the | 527 | * floating LDO outputs. This bit makes no difference if the |