[alsa-devel] [PATCH] ASoC: wm8962: Restore device state after reset in runtime resume

Mark Brown broonie at linaro.org
Fri Jun 7 17:43:17 CEST 2013


After the device has been reset we need to repeat the same
initialisation we do on probe to make sure that the device is in
a known state.

Signed-off-by: Mark Brown <broonie at linaro.org>
---
 sound/soc/codecs/wm8962.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index d56dd86..32c2c47 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3723,6 +3723,21 @@ static int wm8962_runtime_resume(struct device *dev)
 
 	wm8962_reset(wm8962);
 
+	/* SYSCLK defaults to on; make sure it is off so we can safely
+	 * write to registers if the device is declocked.
+	 */
+	regmap_update_bits(wm8962->regmap, WM8962_CLOCKING2,
+			   WM8962_SYSCLK_ENA, 0);
+
+	/* Ensure we have soft control over all registers */
+	regmap_update_bits(wm8962->regmap, WM8962_CLOCKING2,
+			   WM8962_CLKREG_OVD, WM8962_CLKREG_OVD);
+
+	/* Ensure that the oscillator and PLLs are disabled */
+	regmap_update_bits(wm8962->regmap, WM8962_PLL2,
+			   WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA,
+			   0);
+
 	regcache_sync(wm8962->regmap);
 
 	return 0;
-- 
1.7.10.4



More information about the Alsa-devel mailing list