[alsa-devel] [PATCH] codecs/tlv320aic23: fix suspend/resume

Eric Bénard eric at eukrea.com
Sat Jun 19 10:56:54 CEST 2010


The PWR register actually can't be restored at resume because its
cached value was set to 0xFFFF when suspending and thus the initial
state won't be restored. Thus, sound doesn't work after resume (tested
on an i.MX27).

To workaround this, this patch saves the PWR value before turning
the codec's power off and store this value in the cached registers.

Signed-off-by: Eric Bénard <eric at eukrea.com>
Cc: broonie at opensource.wolfsonmicro.com
Cc: anuj.aggarwal at ti.com
Cc: lrg at slimlogic.co.uk
---
 sound/soc/codecs/tlv320aic23.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index b0bae35..75e320b 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -614,9 +614,15 @@ static int tlv320aic23_suspend(struct platform_device *pdev,
 {
 	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 	struct snd_soc_codec *codec = socdev->card->codec;
+	u16 tmp;
 
 	tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0);
+	/* backup PWR register */
+	tmp = tlv320aic23_read_reg_cache(codec, TLV320AIC23_PWR);
+	/* turn off the codec */
 	tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
+	/* restore PWR register in the cache */
+	tlv320aic23_write_reg_cache(codec, TLV320AIC23_PWR, tmp);
 
 	return 0;
 }
@@ -633,8 +639,6 @@ static int tlv320aic23_resume(struct platform_device *pdev)
 		tlv320aic23_write(codec, reg, val);
 	}
 
-	tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-
 	return 0;
 }
 
-- 
1.6.3.3



More information about the Alsa-devel mailing list