aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8994-core.c
diff options
context:
space:
mode:
authorChris Rattray <crattray@opensource.wolfsonmicro.com>2012-06-11 12:43:35 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-07-08 18:16:11 -0400
commit78a27cd3e891e8da343942aec10c926eaffabd63 (patch)
tree0d366f5c203a3ec151520dcc518a64658615876e /drivers/mfd/wm8994-core.c
parenta834e81051fd51890bd9a64e109b587f8e12199a (diff)
mfd: Restore wm8994 pin configuration after reset during suspend
Ensure that we leave the device with the pins in the expected configuration if we leave it in reset over suspend, avoiding any interoperation problems with other devices in the system. Signed-off-by: Chris Rattray <crattray@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r--drivers/mfd/wm8994-core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 1e321d349777..f75cdccd1043 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -196,6 +196,7 @@ static int wm8994_suspend(struct device *dev)
196{ 196{
197 struct wm8994 *wm8994 = dev_get_drvdata(dev); 197 struct wm8994 *wm8994 = dev_get_drvdata(dev);
198 int ret; 198 int ret;
199 int gpio_regs[WM8994_NUM_GPIO_REGS];
199 200
200 /* Don't actually go through with the suspend if the CODEC is 201 /* Don't actually go through with the suspend if the CODEC is
201 * still active (eg, for audio passthrough from CP. */ 202 * still active (eg, for audio passthrough from CP. */
@@ -277,12 +278,24 @@ static int wm8994_suspend(struct device *dev)
277 WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD, 278 WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
278 WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD); 279 WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD);
279 280
281 /* Save GPIO registers before reset */
282 regmap_bulk_read(wm8994->regmap, WM8994_GPIO_1, gpio_regs,
283 WM8994_NUM_GPIO_REGS);
284
280 /* Explicitly put the device into reset in case regulators 285 /* Explicitly put the device into reset in case regulators
281 * don't get disabled in order to ensure consistent restart. 286 * don't get disabled in order to ensure consistent restart.
282 */ 287 */
283 wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, 288 wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET,
284 wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET)); 289 wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
285 290
291 /* Restore GPIO registers to prevent problems with mismatched
292 * pin configurations.
293 */
294 ret = regmap_bulk_write(wm8994->regmap, WM8994_GPIO_1, gpio_regs,
295 WM8994_NUM_GPIO_REGS);
296 if (ret != 0)
297 dev_err(dev, "Failed to restore GPIO registers: %d\n", ret);
298
286 regcache_cache_only(wm8994->regmap, true); 299 regcache_cache_only(wm8994->regmap, true);
287 regcache_mark_dirty(wm8994->regmap); 300 regcache_mark_dirty(wm8994->regmap);
288 301