Title: [9183] branches/2010R1/sound/soc/codecs: [#6269] ssm2602/ssm2604: save/restore power state during suspend/resume.
Revision
9183
Author
lliubbo
Date
2010-09-29 05:26:30 -0400 (Wed, 29 Sep 2010)

Log Message

[#6269] ssm2602/ssm2604: save/restore power state during suspend/resume.

The current function can't save and restore the power state correctly
during suspend, so after resume there will be input/output error.

This commit add save/restore the power state.

Modified Paths

Diff

Modified: branches/2010R1/sound/soc/codecs/ssm2602.c (9182 => 9183)


--- branches/2010R1/sound/soc/codecs/ssm2602.c	2010-09-29 09:24:31 UTC (rev 9182)
+++ branches/2010R1/sound/soc/codecs/ssm2602.c	2010-09-29 09:26:30 UTC (rev 9183)
@@ -49,6 +49,7 @@
 static struct snd_soc_codec *ssm2602_codec;
 /* codec private data */
 struct ssm2602_priv {
+	u16 pwr_state;
 	unsigned int sysclk;
 	struct snd_soc_codec codec;
 };
@@ -440,7 +441,9 @@
 {
 	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 	struct snd_soc_codec *codec = socdev->card->codec;
+	struct ssm2602_priv *ssm2602 = codec->private_data;
 
+	ssm2602->pwr_state = snd_soc_read(codec, SSM2602_PWR);
 	ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF);
 	return 0;
 }
@@ -449,6 +452,7 @@
 {
 	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 	struct snd_soc_codec *codec = socdev->card->codec;
+	struct ssm2602_priv *ssm2602 = codec->private_data;
 	int i;
 	u8 data[2];
 	u16 *cache = codec->reg_cache;
@@ -461,6 +465,7 @@
 	}
 	ssm2602_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 	ssm2602_set_bias_level(codec, codec->suspend_bias_level);
+	snd_soc_write(codec, SSM2602_PWR, ssm2602->pwr_state);
 	return 0;
 }
 

Modified: branches/2010R1/sound/soc/codecs/ssm2604.c (9182 => 9183)


--- branches/2010R1/sound/soc/codecs/ssm2604.c	2010-09-29 09:24:31 UTC (rev 9182)
+++ branches/2010R1/sound/soc/codecs/ssm2604.c	2010-09-29 09:26:30 UTC (rev 9183)
@@ -30,6 +30,7 @@
 /* codec private data */
 struct ssm2604_priv {
 	unsigned int sysclk;
+	u16 pwr_state;
 	struct snd_pcm_substream *master_substream;
 	struct snd_pcm_substream *slave_substream;
 	struct snd_soc_codec codec;
@@ -438,7 +439,9 @@
 {
 	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 	struct snd_soc_codec *codec = socdev->card->codec;
+	struct ssm2602_priv *ssm2602 = codec->private_data;
 
+	ssm2602->pwr_state = snd_soc_read(codec, SSM2602_PWR);
 	ssm2604_set_bias_level(codec, SND_SOC_BIAS_OFF);
 	return 0;
 }
@@ -447,6 +450,7 @@
 {
 	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 	struct snd_soc_codec *codec = socdev->card->codec;
+	struct ssm2602_priv *ssm2602 = codec->private_data;
 	int i;
 	u8 data[2];
 	u16 *cache = codec->reg_cache;
@@ -459,6 +463,7 @@
 	}
 	ssm2604_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 	ssm2604_set_bias_level(codec, codec->suspend_bias_level);
+	snd_soc_write(codec, SSM2602_PWR, ssm2602->pwr_state);
 	return 0;
 }
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to