From: 陈金泉 Date: Tue, 27 Aug 2013 10:26:28 +0000 (+0800) Subject: rk616_codec: add SPK/HP close before incall change X-Git-Tag: firefly_0821_release~6680 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=183af6915a2f01a271c88a9b7b351bbe9188ba89;p=firefly-linux-kernel-4.4.55.git rk616_codec: add SPK/HP close before incall change --- diff --git a/sound/soc/codecs/rk616_codec.c b/sound/soc/codecs/rk616_codec.c index c01b9d6f6c3f..a1aeddc31ac5 100755 --- a/sound/soc/codecs/rk616_codec.c +++ b/sound/soc/codecs/rk616_codec.c @@ -1334,17 +1334,19 @@ static int rk616_voice_call_path_put(struct snd_kcontrol *kcontrol, switch (rk616->voice_call_path) { case OFF: - //mute output for incall route pop nosie - rk616_set_gpio(RK616_CODEC_SET_SPK, GPIO_LOW); - rk616_set_gpio(RK616_CODEC_SET_HP, GPIO_LOW); - - if (pre_path == SPK_PATH) - mdelay(SPK_AMP_DELAY); - else if (pre_path == HP_PATH || pre_path == HP_NO_MIC) - mdelay(HP_MOS_DELAY); + if (pre_path != RCV && + pre_path != BT) { + //mute output for incall route pop nosie + rk616_set_gpio(RK616_CODEC_SET_SPK, GPIO_LOW); + rk616_set_gpio(RK616_CODEC_SET_HP, GPIO_LOW); + if (pre_path == SPK_PATH) + mdelay(SPK_AMP_DELAY); + else if (pre_path == HP_PATH || + pre_path == HP_NO_MIC) + mdelay(HP_MOS_DELAY); - //close incall route - rk616_codec_power_down(RK616_CODEC_INCALL); + rk616_codec_power_down(RK616_CODEC_INCALL); + } if (pre_path == SPK_PATH) { rk616_set_gpio(RK616_CODEC_SET_SPK, GPIO_HIGH); @@ -1362,10 +1364,10 @@ static int rk616_voice_call_path_put(struct snd_kcontrol *kcontrol, //mute output for incall route pop nosie rk616_set_gpio(RK616_CODEC_SET_SPK, GPIO_LOW); rk616_set_gpio(RK616_CODEC_SET_HP, GPIO_LOW); - if (rk616->voice_call_path == SPK_PATH) + if (pre_path == SPK_PATH) mdelay(SPK_AMP_DELAY); - else if (rk616->voice_call_path == HP_PATH || - rk616->voice_call_path == HP_NO_MIC) + else if (pre_path == HP_PATH || + pre_path == HP_NO_MIC) mdelay(HP_MOS_DELAY); rk616_codec_power_down(RK616_CODEC_INCALL); @@ -1378,6 +1380,8 @@ static int rk616_voice_call_path_put(struct snd_kcontrol *kcontrol, //set mic for modem rk616_set_gpio(RK616_CODEC_SET_MIC, GPIO_HIGH); + rk616_set_gpio(RK616_CODEC_SET_HP, GPIO_LOW); + //open incall route if (pre_path == OFF || pre_path == RCV || @@ -1393,7 +1397,9 @@ static int rk616_voice_call_path_put(struct snd_kcontrol *kcontrol, break; case HP_PATH: //set mic for modem - rk616_set_gpio(RK616_CODEC_SET_MIC, GPIO_LOW); + rk616_set_gpio(RK616_CODEC_SET_MIC, GPIO_LOW); + + rk616_set_gpio(RK616_CODEC_SET_SPK, GPIO_LOW); //open incall route if (pre_path == OFF || @@ -1412,6 +1418,8 @@ static int rk616_voice_call_path_put(struct snd_kcontrol *kcontrol, //set mic for modem rk616_set_gpio(RK616_CODEC_SET_MIC, GPIO_HIGH); + rk616_set_gpio(RK616_CODEC_SET_SPK, GPIO_LOW); + //open incall route if (pre_path == OFF || pre_path == RCV ||