aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8994-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-03 12:40:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-03 12:40:51 -0400
commita0a4194c943bc64dd7b6e26cccb036cb26b81363 (patch)
tree4282f0dd573344d10f69616eb05868b5cd563cc1 /drivers/mfd/wm8994-core.c
parentcf0223503e6198292cdcc864e01eeb5fe7490752 (diff)
parentb958f7a7cbdfbf59ba61de7ebb9c59b0ee3a7967 (diff)
Merge branch 'for-next' of git://git.infradead.org/users/sameo/mfd-2.6
* 'for-next' of git://git.infradead.org/users/sameo/mfd-2.6: (80 commits) mfd: Fix missing abx500 header file updates mfd: Add missing <linux/io.h> include to intel_msic x86, mrst: add platform support for MSIC MFD driver mfd: Expose TurnOnStatus in ab8500 sysfs mfd: Remove support for early drop ab8500 chip mfd: Add support for ab8500 v3.3 mfd: Add ab8500 interrupt disable hook mfd: Convert db8500-prcmu panic() into pr_crit() mfd: Refactor db8500-prcmu request_clock() function mfd: Rename db8500-prcmu init function mfd: Fix db5500-prcmu defines mfd: db8500-prcmu voltage domain consumers additions mfd: db8500-prcmu reset code retrieval mfd: db8500-prcmu tweak for modem wakeup mfd: Add db8500-pcmu watchdog accessor functions for watchdog mfd: hwacc power state db8500-prcmu accessor mfd: Add db8500-prcmu accessors for PLL and SGA clock mfd: Move to the new db500 PRCMU API mfd: Create a common interface for dbx500 PRCMU drivers mfd: Initialize DB8500 PRCMU regs ... Fix up trivial conflicts in arch/arm/mach-imx/mach-mx31moboard.c arch/arm/mach-omap2/board-omap3beagle.c arch/arm/mach-u300/include/mach/irqs.h drivers/mfd/wm831x-spi.c
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r--drivers/mfd/wm8994-core.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index b03be1d4e0ca..5d6ba132837e 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