diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 05daa956fa49..2665f13be9b8 100755 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -3608,6 +3608,28 @@ static void tasha_codec_hph_post_pa_config(struct tasha_priv *tasha, } } +static void tasha_codec_override(struct snd_soc_codec *codec, + int mode, + int event) +{ + if (mode == CLS_AB) { + switch (event) { + case SND_SOC_DAPM_POST_PMU: + if (!(snd_soc_read(codec, + WCD9335_CDC_RX2_RX_PATH_CTL) & 0x10) && + (!(snd_soc_read(codec, + WCD9335_CDC_RX1_RX_PATH_CTL) & 0x10))) + snd_soc_update_bits(codec, + WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x02); + break; + case SND_SOC_DAPM_POST_PMD: + snd_soc_update_bits(codec, + WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x00); + break; + } + } +} + static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) @@ -3641,6 +3663,7 @@ static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX2_RX_PATH_MIX_CTL, 0x10, 0x00); + tasha_codec_override(codec, hph_mode, event); break; case SND_SOC_DAPM_PRE_PMD: blocking_notifier_call_chain(&tasha->notifier, @@ -3653,6 +3676,7 @@ static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, * HW requirement */ usleep_range(5000, 5500); + tasha_codec_override(codec, hph_mode, event); blocking_notifier_call_chain(&tasha->notifier, WCD_EVENT_POST_HPHR_PA_OFF, &tasha->mbhc); @@ -3702,6 +3726,7 @@ static int tasha_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_MIX_CTL, 0x10, 0x00); + tasha_codec_override(codec, hph_mode, event); break; case SND_SOC_DAPM_PRE_PMD: blocking_notifier_call_chain(&tasha->notifier, @@ -3714,6 +3739,7 @@ static int tasha_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, * HW requirement */ usleep_range(5000, 5500); + tasha_codec_override(codec, hph_mode, event); blocking_notifier_call_chain(&tasha->notifier, WCD_EVENT_POST_HPHL_PA_OFF, &tasha->mbhc); @@ -3774,12 +3800,14 @@ static int tasha_codec_enable_lineout_pa(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, lineout_mix_vol_reg, 0x10, 0x00); + tasha_codec_override(codec, CLS_AB, event); break; case SND_SOC_DAPM_POST_PMD: /* 5ms sleep is required after PA is disabled as per * HW requirement */ usleep_range(5000, 5500); + tasha_codec_override(codec, CLS_AB, event); if (!(strcmp(w->name, "ANC LINEOUT1 PA")) || !(strcmp(w->name, "ANC LINEOUT2 PA"))) { ret = tasha_codec_enable_anc(w, kcontrol, event); diff --git a/sound/soc/codecs/wcd9xxx-common-v2.c b/sound/soc/codecs/wcd9xxx-common-v2.c index fae244e48037..1d132bd04831 100644 --- a/sound/soc/codecs/wcd9xxx-common-v2.c +++ b/sound/soc/codecs/wcd9xxx-common-v2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -348,12 +348,8 @@ static void wcd_clsh_set_flyback_current(struct snd_soc_codec *codec, int mode) static void wcd_clsh_set_buck_regulator_mode(struct snd_soc_codec *codec, int mode) { - if (mode == CLS_AB) - snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES, - 0x02, 0x02); - else - snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES, - 0x02, 0x00); + snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES, + 0x02, 0x00); } static void wcd_clsh_state_lo(struct snd_soc_codec *codec,