From: yj Date: Tue, 6 May 2014 02:02:21 +0000 (+0800) Subject: codec:mod for pop X-Git-Tag: firefly_0821_release~5369 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8fcf576f064c788c308d87d5b955cf98172eb440;p=firefly-linux-kernel-4.4.55.git codec:mod for pop --- diff --git a/sound/soc/codecs/rt3261.c b/sound/soc/codecs/rt3261.c index e900add9b2bd..b70408e456f3 100755 --- a/sound/soc/codecs/rt3261.c +++ b/sound/soc/codecs/rt3261.c @@ -106,8 +106,15 @@ static struct rt3261_init_reg init_list[] = { {RT3261_OUTPUT , 0x8888},//unmute OUTVOLL/R {RT3261_SPO_CLSD_RATIO , 0x0001}, {RT3261_I2S1_SDP , 0xd000}, + {RT3261_GLB_CLK , 0x4000},//0424 + //{0x90 , 0x636},//0424 + {RT3261_CHARGE_PUMP , 0xe00},//0424 + {RT3261_DEPOP_M3 , 0x636},//0424 + {RT3261_DEPOP_M1 , 0x84},//0424 + {RT3261_PWR_DIG1 , 0x8000},//0424 + //{0x64 , 0x0c00},//0424 // huangcun 20130816 s -#if 1 +#if 0 /*speaker*/ {RT3261_DSP_PATH2 , 0x0000}, {RT3261_PRIV_INDEX , 0x003f},//PR3d[14] = 0'b; @@ -122,7 +129,7 @@ static struct rt3261_init_reg init_list[] = { {RT3261_OUT_R3_MIXER, 0x01fd}, {RT3261_HPO_MIXER, 0xc000}, #endif -#if 1 +#if 0 /*capture*/ {RT3261_IN1_IN2, 0x2080},//boost1 = 24db {RT3261_REC_R2_MIXER, 0x007d}, @@ -316,6 +323,7 @@ static int rt3261_write(struct snd_soc_codec *codec, unsigned int reg, data[2] = value & 0xff; DBG("rt3261_write 0x%x = 0x%x\n",reg,value); + return do_hw_write(codec, reg, value, data, 3); } @@ -860,11 +868,16 @@ void rt3261_hp_amp_power(struct snd_soc_codec *codec, int on) RT3261_PWR_I2S1, RT3261_PWR_I2S1); /* depop parameters */ rt3261_index_update_bits(codec, RT3261_CHPUMP_INT_REG1,0x0700, 0x0200); //bard 12-6 + snd_soc_write(codec, RT3261_DEPOP_M2, 0x3100); //bard 4-22 + snd_soc_write(codec, RT3261_DEPOP_M1, 0x0009); //bard 4-22 + msleep(50); +/* snd_soc_update_bits(codec, RT3261_DEPOP_M2, RT3261_DEPOP_MASK, RT3261_DEPOP_MAN); snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_HP_CP_MASK | RT3261_HP_SG_MASK | RT3261_HP_CB_MASK, RT3261_HP_CP_PU | RT3261_HP_SG_DIS | RT3261_HP_CB_PU); +*/ rt3261_index_write(codec, RT3261_HP_DCC_INT1, 0x9f00); /* headphone amp power on */ snd_soc_update_bits(codec, RT3261_PWR_ANLG1, @@ -875,7 +888,7 @@ void rt3261_hp_amp_power(struct snd_soc_codec *codec, int on) snd_soc_update_bits(codec, RT3261_PWR_ANLG1, RT3261_PWR_HP_L | RT3261_PWR_HP_R | RT3261_PWR_HA , //bard 10-18 RT3261_PWR_HP_L | RT3261_PWR_HP_R | RT3261_PWR_HA); //bard 10-18 - msleep(50); + msleep(30); //bard 4-22 snd_soc_update_bits(codec, RT3261_PWR_ANLG1, RT3261_PWR_FV1 | RT3261_PWR_FV2, RT3261_PWR_FV1 | RT3261_PWR_FV2); @@ -930,6 +943,7 @@ static int rt3261_hp_mute_put(struct snd_kcontrol *kcontrol, if(ucontrol->value.integer.value[0]) { /* headphone unmute sequence */ + snd_soc_update_bits(codec, RT3261_DEPOP_M3, RT3261_CP_FQ1_MASK | RT3261_CP_FQ2_MASK | RT3261_CP_FQ3_MASK, (RT3261_CP_FQ_192_KHZ << RT3261_CP_FQ1_SFT) | @@ -943,9 +957,9 @@ static int rt3261_hp_mute_put(struct snd_kcontrol *kcontrol, snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_RSTN_MASK | RT3261_HP_L_SMT_MASK | RT3261_HP_R_SMT_MASK, RT3261_RSTN_DIS | RT3261_HP_L_SMT_EN | RT3261_HP_R_SMT_EN); - snd_soc_update_bits(codec, RT3261_HP_VOL, - RT3261_L_MUTE | RT3261_R_MUTE, 0); - msleep(100); + //snd_soc_update_bits(codec, RT3261_HP_VOL, + // RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); + msleep(60); //bard 4-22 snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_HP_SG_MASK | RT3261_HP_L_SMT_MASK | RT3261_HP_R_SMT_MASK, RT3261_HP_SG_DIS | @@ -978,10 +992,12 @@ static int rt3261_hp_mute_put(struct snd_kcontrol *kcontrol, */ snd_soc_update_bits(codec, RT3261_HP_VOL, RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); - msleep(30); + msleep(60); +/* snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_HP_R_SMT_MASK | RT3261_HP_L_SMT_MASK, RT3261_HP_L_SMT_DIS | RT3261_HP_R_SMT_DIS); +*/ } return 0; } @@ -1266,8 +1282,10 @@ static const struct snd_kcontrol_new rt3261_snd_controls[] = { RT3261_L_VOL_SFT, RT3261_R_VOL_SFT, RT3261_VOL_RSCL_RANGE, 0, rt3261_vol_rescale_get, rt3261_vol_rescale_put, out_vol_tlv), /* Headphone Output Volume */ +/* SOC_DOUBLE("HP Playback Switch", RT3261_HP_VOL, RT3261_L_MUTE_SFT, RT3261_R_MUTE_SFT, 1, 1), +*/ SOC_DOUBLE_EXT_TLV("Headphone Playback Volume", RT3261_HP_VOL, RT3261_L_VOL_SFT, RT3261_R_VOL_SFT, RT3261_VOL_RSCL_RANGE, 0, rt3261_vol_rescale_get, rt3261_vol_rescale_put, out_vol_tlv), @@ -1993,9 +2011,10 @@ static void rt3261_pmu_depop(struct snd_soc_codec *codec) snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_RSTN_MASK | RT3261_HP_L_SMT_MASK | RT3261_HP_R_SMT_MASK, RT3261_RSTN_DIS | RT3261_HP_L_SMT_EN | RT3261_HP_R_SMT_EN); + //msleep(30); snd_soc_update_bits(codec, RT3261_HP_VOL, RT3261_L_MUTE | RT3261_R_MUTE, 0); - msleep(100); + msleep(30); //bard 4-22 snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_HP_SG_MASK | RT3261_HP_L_SMT_MASK | RT3261_HP_R_SMT_MASK, RT3261_HP_SG_DIS | @@ -2026,9 +2045,8 @@ static void rt3261_pmd_depop(struct snd_soc_codec *codec) RT3261_HP_L_SMT_EN | RT3261_HP_R_SMT_EN); /*bard 10-18 r snd_soc_update_bits(codec, RT3261_HP_CALIB_AMP_DET, - RT3261_HPD_PS_MASK, RT3261_HPD_PS_DIS); - msleep(90); - */ + RT3261_HPD_PS_MASK, RT3261_HPD_PS_DIS);*/ + //msleep(90); snd_soc_update_bits(codec, RT3261_HP_VOL, RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); msleep(30); @@ -2112,10 +2130,8 @@ static void rt3261_pmd_depop(struct snd_soc_codec *codec) snd_soc_update_bits(codec, RT3261_HP_VOL, RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); - msleep(90); snd_soc_update_bits(codec, RT3261_DEPOP_M1, RT3261_HP_CB_MASK, RT3261_HP_CB_PD); - msleep(30); //rt3261_index_update_bits(codec, RT3261_CHOP_DAC_ADC, 0x0200, 0x0); snd_soc_update_bits(codec, RT3261_PWR_ANLG1, RT3261_PWR_HP_L | RT3261_PWR_HP_R | RT3261_PWR_HA, @@ -2127,7 +2143,6 @@ static int rt3261_hp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; - switch (event) { case SND_SOC_DAPM_POST_PMU: rt3261_pmu_depop(codec); @@ -2268,8 +2283,10 @@ static const struct snd_soc_dapm_widget rt3261_dapm_widgets[] = { SND_SOC_DAPM_PGA("INR VOL", RT3261_PWR_VOL, RT3261_PWR_IN_R_BIT, 0, NULL, 0), /* IN Mux */ +/* SND_SOC_DAPM_MUX("INL Mux", SND_SOC_NOPM, 0, 0, &rt3261_inl_mux), SND_SOC_DAPM_MUX("INR Mux", SND_SOC_NOPM, 0, 0, &rt3261_inr_mux), +*/ /* REC Mixer */ SND_SOC_DAPM_MIXER("RECMIXL", RT3261_PWR_MIXER, RT3261_PWR_RM_L_BIT, 0, rt3261_rec_l_mix, ARRAY_SIZE(rt3261_rec_l_mix)), @@ -2328,8 +2345,8 @@ static const struct snd_soc_dapm_widget rt3261_dapm_widgets[] = { &rt3261_if2_adc_r_mux), /* Digital Interface */ - SND_SOC_DAPM_SUPPLY("I2S1", RT3261_PWR_DIG1, - RT3261_PWR_I2S1_BIT, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S1", SND_SOC_NOPM, + 0, 0, NULL, 0), SND_SOC_DAPM_PGA("IF1 DAC", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_PGA("IF1 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_PGA("IF1 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0), @@ -3079,6 +3096,7 @@ static int rt3261_set_dai_sysclk(struct snd_soc_dai *dai, if (freq == rt3261->sysclk && clk_id == rt3261->sysclk_src) return 0; + snd_soc_update_bits(codec, RT3261_PWR_ANLG2, RT3261_PWR_PLL, RT3261_PWR_PLL); switch (clk_id) { case RT3261_SCLK_S_MCLK: @@ -3277,8 +3295,8 @@ static int rt3261_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_PREPARE: - snd_soc_update_bits(codec, RT3261_HP_VOL, - RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); //bard 12-7 + //snd_soc_update_bits(codec, RT3261_HP_VOL, + // RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); //bard 12-7 snd_soc_update_bits(codec, RT3261_SPK_VOL, RT3261_L_MUTE | RT3261_R_MUTE, RT3261_L_MUTE | RT3261_R_MUTE); @@ -3310,8 +3328,8 @@ static int rt3261_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_OFF: - snd_soc_write(codec, RT3261_DEPOP_M1, 0x0004); - snd_soc_write(codec, RT3261_DEPOP_M2, 0x1100); + //snd_soc_write(codec, RT3261_DEPOP_M1, 0x0004);//bard 4-22 r + //snd_soc_write(codec, RT3261_DEPOP_M2, 0x1100);//bard 4-22 r snd_soc_write(codec, RT3261_GEN_CTRL1, 0x3700); snd_soc_write(codec, RT3261_PWR_DIG1, 0x0000); snd_soc_write(codec, RT3261_PWR_DIG2, 0x0000); @@ -3444,6 +3462,7 @@ static int rt3261_probe(struct snd_soc_codec *codec) return ret; } rt3261_codec = codec; + return 0; } diff --git a/sound/soc/codecs/rt5616.c b/sound/soc/codecs/rt5616.c index 54005a73cdf8..3e89815e3056 100755 --- a/sound/soc/codecs/rt5616.c +++ b/sound/soc/codecs/rt5616.c @@ -45,15 +45,21 @@ static struct rt5616_init_reg init_list[] = { {RT5616_PRIV_INDEX , 0x0025}, //PR-25 = 6110 {RT5616_PRIV_DATA , 0x6110}, /*Playback*/ - {RT5616_STO_DAC_MIXER , 0x1212}, + //{RT5616_STO_DAC_MIXER , 0x1212}, /*HP*/ //{RT5616_HPO_MIXER , 0x2000}, //DAC -> HPO - {RT5616_HPO_MIXER , 0x4000}, //HPVOL -> HPO + //{RT5616_HPO_MIXER , 0x4000}, //HPVOL -> HPO {RT5616_HP_VOL , 0x8888}, //unmute HPVOL - {RT5616_OUT_L3_MIXER , 0x0278}, //DACL1 -> OUTMIXL - {RT5616_OUT_R3_MIXER , 0x0278}, //DACR1 -> OUTMIXR + //{RT5616_OUT_L3_MIXER , 0x0278}, //DACL1 -> OUTMIXL + //{RT5616_OUT_R3_MIXER , 0x0278}, //DACR1 -> OUTMIXR /*LOUT*/ - {RT5616_LOUT_MIXER , 0x3000}, + //{RT5616_LOUT_MIXER , 0x3000}, + //{RT5616_DEPOP_M1 , 0x8019}, + //{RT5616_DEPOP_M2 , 0x3100}, + {RT5616_DEPOP_M3 , 0x0636},//0424 + {RT5616_CHARGE_PUMP , 0x0f00}, + {RT5616_PWR_DIG1 , 0x8000},//0424 + {RT5616_PWR_ANLG1 , 0xe818},//0424 /*Capture*/ //{RT5616_REC_L2_MIXER , 0x006d}, //MIC1 -> RECMIXL //{RT5616_REC_R2_MIXER , 0x006d}, //MIC1 -> RECMIXR @@ -707,16 +713,18 @@ static int rt5616_adc_event(struct snd_soc_dapm_widget *w, void rt5616_hp_amp_power(struct snd_soc_codec *codec, int on) { + static int hp_amp_power_count; - if(on) { if(hp_amp_power_count <= 0) { /* depop parameters */ - snd_soc_update_bits(codec, RT5616_DEPOP_M2, + /*snd_soc_update_bits(codec, RT5616_DEPOP_M2, RT5616_DEPOP_MASK, RT5616_DEPOP_MAN); snd_soc_update_bits(codec, RT5616_DEPOP_M1, RT5616_HP_CP_MASK | RT5616_HP_SG_MASK | RT5616_HP_CB_MASK | RT5616_HP_CD_PD_MASK, - RT5616_HP_CP_PU | RT5616_HP_SG_DIS | RT5616_HP_CB_PU | RT5616_HP_CD_PD_DIS); + RT5616_HP_CP_PU | RT5616_HP_SG_DIS | RT5616_HP_CB_PU | RT5616_HP_CD_PD_DIS);*/ + snd_soc_write(codec, RT5616_DEPOP_M2, 0x3100); //bard 4-22 + snd_soc_write(codec, RT5616_DEPOP_M1, 0x0009); //bard 4-22 rt5616_index_write(codec, RT5616_HP_DCC_INT1, 0x9f00); /* headphone amp power on */ snd_soc_update_bits(codec, RT5616_PWR_ANLG1, @@ -732,33 +740,38 @@ void rt5616_hp_amp_power(struct snd_soc_codec *codec, int on) RT5616_PWR_FV1 | RT5616_PWR_FV2, RT5616_PWR_FV1 | RT5616_PWR_FV2); - snd_soc_update_bits(codec, RT5616_CHARGE_PUMP, - RT5616_PM_HP_MASK, RT5616_PM_HP_HV); + //snd_soc_update_bits(codec, RT5616_CHARGE_PUMP, + // RT5616_PM_HP_MASK, RT5616_PM_HP_HV); + snd_soc_write(codec, RT5616_CHARGE_PUMP, 0x0f00); + /* rt5616_index_update_bits(codec, RT5616_CHOP_DAC_ADC, 0x0200, 0x0200); snd_soc_update_bits(codec, RT5616_DEPOP_M1, RT5616_HP_CO_MASK | RT5616_HP_SG_MASK, RT5616_HP_CO_EN | RT5616_HP_SG_EN); + */ } hp_amp_power_count++; } else { hp_amp_power_count--; if(hp_amp_power_count <= 0) { - rt5616_index_update_bits(codec, RT5616_CHOP_DAC_ADC, 0x0200, 0x0); - snd_soc_update_bits(codec, RT5616_DEPOP_M1, + snd_soc_write(codec, RT5616_DEPOP_M1, 0x8019); + snd_soc_write(codec, RT5616_HP_VOL, 0xc8c8); + //rt5616_index_update_bits(codec, RT5616_CHOP_DAC_ADC, 0x0200, 0x0); + /*snd_soc_update_bits(codec, RT5616_DEPOP_M1, RT5616_HP_SG_MASK | RT5616_HP_L_SMT_MASK | RT5616_HP_R_SMT_MASK, RT5616_HP_SG_DIS | - RT5616_HP_L_SMT_DIS | RT5616_HP_R_SMT_DIS); + RT5616_HP_L_SMT_DIS | RT5616_HP_R_SMT_DIS);*/ /* headphone amp power down */ - snd_soc_update_bits(codec, RT5616_DEPOP_M1, + /*snd_soc_update_bits(codec, RT5616_DEPOP_M1, RT5616_SMT_TRIG_MASK | RT5616_HP_CD_PD_MASK | RT5616_HP_CO_MASK | RT5616_HP_CP_MASK | RT5616_HP_SG_MASK | RT5616_HP_CB_MASK, RT5616_SMT_TRIG_DIS | RT5616_HP_CD_PD_EN | RT5616_HP_CO_DIS | RT5616_HP_CP_PD | - RT5616_HP_SG_EN | RT5616_HP_CB_PD); - snd_soc_update_bits(codec, RT5616_PWR_ANLG1, - RT5616_PWR_HP_L | RT5616_PWR_HP_R | RT5616_PWR_HA | RT5616_PWR_LM, - 0); + RT5616_HP_SG_EN | RT5616_HP_CB_PD);*/ + //snd_soc_update_bits(codec, RT5616_PWR_ANLG1, + //RT5616_PWR_HP_L | RT5616_PWR_HP_R | RT5616_PWR_HA | RT5616_PWR_LM, + //0); } } } @@ -768,7 +781,7 @@ static void rt5616_pmu_depop(struct snd_soc_codec *codec) rt5616_hp_amp_power(codec, 1); /* headphone unmute sequence */ - snd_soc_update_bits(codec, RT5616_DEPOP_M3, + /*snd_soc_update_bits(codec, RT5616_DEPOP_M3, RT5616_CP_FQ1_MASK | RT5616_CP_FQ2_MASK | RT5616_CP_FQ3_MASK, (RT5616_CP_FQ_192_KHZ << RT5616_CP_FQ1_SFT) | (RT5616_CP_FQ_12_KHZ << RT5616_CP_FQ2_SFT) | @@ -780,7 +793,13 @@ static void rt5616_pmu_depop(struct snd_soc_codec *codec) RT5616_RSTN_MASK, RT5616_RSTN_EN); snd_soc_update_bits(codec, RT5616_DEPOP_M1, RT5616_RSTN_MASK | RT5616_HP_L_SMT_MASK | RT5616_HP_R_SMT_MASK, - RT5616_RSTN_DIS | RT5616_HP_L_SMT_EN | RT5616_HP_R_SMT_EN); + RT5616_RSTN_DIS | RT5616_HP_L_SMT_EN | RT5616_HP_R_SMT_EN);*/ + snd_soc_write(codec, 0x8e, 0x001d); + rt5616_index_write(codec, RT5616_MAMP_INT_REG2, 0xfc00); + snd_soc_write(codec, 0x8e, 0x801d); + snd_soc_write(codec, 0x8e, 0x805d); + snd_soc_write(codec, 0x8e, 0x801d); + snd_soc_write(codec, 0x8e, 0x831d); snd_soc_update_bits(codec, RT5616_HP_VOL, RT5616_L_MUTE | RT5616_R_MUTE, 0); msleep(100); @@ -788,7 +807,7 @@ static void rt5616_pmu_depop(struct snd_soc_codec *codec) RT5616_HP_SG_MASK | RT5616_HP_L_SMT_MASK | RT5616_HP_R_SMT_MASK, RT5616_HP_SG_DIS | RT5616_HP_L_SMT_DIS | RT5616_HP_R_SMT_DIS); - msleep(20); + // msleep(20); // snd_soc_update_bits(codec, RT5616_HP_CALIB_AMP_DET, // RT5616_HPD_PS_MASK, RT5616_HPD_PS_EN); } @@ -796,6 +815,8 @@ static void rt5616_pmu_depop(struct snd_soc_codec *codec) static void rt5616_pmd_depop(struct snd_soc_codec *codec) { /* headphone mute sequence */ + rt5616_index_write(codec, 0x24, 0x0120); + snd_soc_write(codec, RT5616_HP_CALIB_AMP_DET, 0x0400); snd_soc_update_bits(codec, RT5616_DEPOP_M3, RT5616_CP_FQ1_MASK | RT5616_CP_FQ2_MASK | RT5616_CP_FQ3_MASK, (RT5616_CP_FQ_96_KHZ << RT5616_CP_FQ1_SFT) | @@ -812,9 +833,11 @@ static void rt5616_pmd_depop(struct snd_soc_codec *codec) RT5616_HP_L_SMT_EN | RT5616_HP_R_SMT_EN); // snd_soc_update_bits(codec, RT5616_HP_CALIB_AMP_DET, // RT5616_HPD_PS_MASK, RT5616_HPD_PS_DIS); - msleep(90); + msleep(100); snd_soc_update_bits(codec, RT5616_HP_VOL, - RT5616_L_MUTE | RT5616_R_MUTE, RT5616_L_MUTE | RT5616_R_MUTE); + RT5616_L_MUTE | RT5616_R_MUTE, + RT5616_L_MUTE | RT5616_R_MUTE); + msleep(30); rt5616_hp_amp_power(codec, 0); @@ -832,7 +855,7 @@ static int rt5616_hp_event(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_PRE_PMD: - //rt5616_pmd_depop(codec); + rt5616_pmd_depop(codec); break; default: @@ -1252,14 +1275,10 @@ static int rt5616_prepare(struct snd_pcm_substream *substream, static int rt5616_set_gpio(struct rt5616_priv *rt5616, int gpio, bool level) { -#if 0 - printk("%s : set %s ctl gpio %s\n", __func__, - gpio & rt5616_CODEC_SET_SPK ? "spk" : "", - level ? "HIGH" : "LOW"); -#endif if ((gpio & rt5616_CODEC_SET_SPK) && gpio_is_valid(rt5616->spk_ctl_gpio)) { - mdelay(100); + //printk("%s..level=%d\n",__func__,level); gpio_set_value(rt5616->spk_ctl_gpio, level); + mdelay(100); } return 0; @@ -1536,11 +1555,36 @@ static int rt5616_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_PREPARE: + + if (SND_SOC_BIAS_STANDBY == codec->dapm.bias_level) { + rt5616_index_write(codec, 0x24, 0x0120); + snd_soc_write(codec, RT5616_HP_CALIB_AMP_DET, 0x0400); + snd_soc_update_bits(codec, RT5616_DEPOP_M3, + RT5616_CP_FQ1_MASK | RT5616_CP_FQ2_MASK | RT5616_CP_FQ3_MASK, + (RT5616_CP_FQ_96_KHZ << RT5616_CP_FQ1_SFT) | + (RT5616_CP_FQ_12_KHZ << RT5616_CP_FQ2_SFT) | + (RT5616_CP_FQ_96_KHZ << RT5616_CP_FQ3_SFT)); + rt5616_index_write(codec, RT5616_MAMP_INT_REG2, 0xfc00); + snd_soc_write(codec, RT5616_DEPOP_M1, 0x801d); + snd_soc_write(codec, RT5616_DEPOP_M1, 0x803d); + snd_soc_write(codec, RT5616_DEPOP_M1, 0x831d); + snd_soc_write(codec, RT5616_HP_VOL, 0x8888); + + // snd_soc_update_bits(codec, RT5616_HP_CALIB_AMP_DET, + // RT5616_HPD_PS_MASK, RT5616_HPD_PS_DIS); + msleep(90); + snd_soc_write(codec, RT5616_DEPOP_M1, 0x8019); + } + + msleep(30); + /*snd_soc_update_bits(codec, RT5616_LOUT_CTRL1, + RT5616_L_MUTE | RT5616_R_MUTE, + RT5616_L_MUTE | RT5616_R_MUTE);*/ break; case SND_SOC_BIAS_STANDBY: if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) { - snd_soc_update_bits(codec, RT5616_PWR_ANLG1, + /*snd_soc_update_bits(codec, RT5616_PWR_ANLG1, RT5616_PWR_VREF1 | RT5616_PWR_MB | RT5616_PWR_BG | RT5616_PWR_VREF2, RT5616_PWR_VREF1 | RT5616_PWR_MB | @@ -1548,12 +1592,14 @@ static int rt5616_set_bias_level(struct snd_soc_codec *codec, msleep(10); snd_soc_update_bits(codec, RT5616_PWR_ANLG1, RT5616_PWR_FV1 | RT5616_PWR_FV2, - RT5616_PWR_FV1 | RT5616_PWR_FV2); + RT5616_PWR_FV1 | RT5616_PWR_FV2);*/ + snd_soc_write(codec, RT5616_D_MISC, 0x0011); + snd_soc_write(codec, RT5616_PWR_ANLG1, 0xe818); + //snd_soc_update_bits(codec, RT5616_PWR_ANLG2, RT5616_PWR_MB1, RT5616_PWR_MB1); codec->cache_only = false; codec->cache_sync = 1; snd_soc_cache_sync(codec); rt5616_index_sync(codec); - snd_soc_write(codec, RT5616_D_MISC, 0x0011); } break; @@ -1601,10 +1647,11 @@ static int rt5616_probe(struct snd_soc_codec *codec) RT5616_PWR_FV1 | RT5616_PWR_FV2); rt5616_reg_init(codec); + rt5616_index_write(codec, RT5616_CHOP_DAC_ADC, 0x3e00); snd_soc_update_bits(codec, RT5616_PWR_ANLG1, RT5616_PWR_LDO_DVO_MASK, RT5616_PWR_LDO_DVO_1_2V); - codec->dapm.bias_level = SND_SOC_BIAS_STANDBY; + codec->dapm.bias_level = SND_SOC_BIAS_OFF; rt5616->codec = codec; rt5616_codec = codec; @@ -1794,6 +1841,8 @@ static void rt5616_i2c_shutdown(struct i2c_client *client) if (codec != NULL) { + rt5616_set_gpio(rt5616,rt5616_CODEC_SET_SPK, 0); + mdelay(100); snd_soc_write(codec, RT5616_HP_VOL, 0xc8c8); snd_soc_write(codec, RT5616_LOUT_CTRL1, 0xc8c8); rt5616_set_bias_level(codec, SND_SOC_BIAS_OFF);