[PATCH] codecs/tlv320aic23: fix suspend/resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Cc: broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Cc: anuj.aggarwal@xxxxxx
Cc: lrg@xxxxxxxxxxxxxxx
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux