ASoC: es8316: reinit codec when resume from deep sleep.
authorSugar Zhang <sugar.zhang@rock-chips.com>
Fri, 10 Jul 2015 08:46:25 +0000 (16:46 +0800)
committerSugar Zhang <sugar.zhang@rock-chips.com>
Fri, 10 Jul 2015 08:54:59 +0000 (16:54 +0800)
because codec power will be cut off when enter deep sleep.
so need reinit codec when resume.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
sound/soc/codecs/es8316.c

index 40971f7a970a926d88689f11adcc5afab2655896..eb8357be0ed5c1b871b2d5267a0c2f3353156987 100644 (file)
@@ -1121,6 +1121,39 @@ static int es8316_suspend(struct snd_soc_codec *codec)
 
 static int es8316_resume(struct snd_soc_codec *codec)
 {
+       struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
+       int retv;
+
+       pr_info("%s: %d\n", __func__, __LINE__);
+       retv = es8316_reset(codec); /* UPDATED BY DAVID,15-3-5 */
+       retv = snd_soc_read(codec, ES8316_CLKMGR_ADCDIV2_REG05);
+       if (retv == 0) {
+               es8316_init_regs(codec);
+               if (es8316->dmic_amic ==  dmic_used) {
+                       /* set gpio2 to DMIC CLK */
+                       snd_soc_write(codec, ES8316_GPIO_SEL_REG4D, 0x02);
+               } else {
+                       /* set gpio2 to GM SHORT */
+                       snd_soc_write(codec, ES8316_GPIO_SEL_REG4D, 0x00);
+               }
+               /* max debance time, enable interrupt, low active */
+               snd_soc_write(codec, ES8316_GPIO_DEBUNCE_INT_REG4E, 0xf3);
+               /* es8316_set_bias_level(codec, SND_SOC_BIAS_OFF); */
+               snd_soc_write(codec, ES8316_CPHP_OUTEN_REG17, 0x00);
+               snd_soc_write(codec, ES8316_DAC_PDN_REG2F, 0x11);
+               snd_soc_write(codec, ES8316_CPHP_LDOCTL_REG1B, 0x03);
+               snd_soc_write(codec, ES8316_CPHP_PDN2_REG1A, 0x22);
+               snd_soc_write(codec, ES8316_CPHP_PDN1_REG19, 0x06);
+               snd_soc_write(codec, ES8316_HPMIX_SWITCH_REG14, 0x00);
+               snd_soc_write(codec, ES8316_HPMIX_PDN_REG15, 0x33);
+               snd_soc_write(codec, ES8316_HPMIX_VOL_REG16, 0x00);
+               snd_soc_write(codec, ES8316_SYS_PDN_REG0D, 0x3F);
+               snd_soc_write(codec, ES8316_SYS_LP1_REG0E, 0xFF);
+               snd_soc_write(codec, ES8316_SYS_LP2_REG0F, 0xFF);
+               snd_soc_write(codec, ES8316_CLKMGR_CLKSW_REG01, 0xF3);
+               snd_soc_write(codec, ES8316_ADC_PDN_LINSEL_REG22, 0xc0);
+               es8316_init_reg = 1;
+       }
        return 0;
 }