ASoC: wcd9335: fix pop during CLS-AB mode

Pop is observed during starting of the playback in CLS-AB mode.
Fix the pop issue by updating register sequence properly.

Change-Id: Iff17245e8a2b14354cc99150a57394ce81ec29b8
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
This commit is contained in:
Vidyakumar Athota 2016-01-11 21:54:12 -08:00 committed by David Keitel
parent 870f781d2c
commit 964f63a545
2 changed files with 31 additions and 7 deletions

View file

@ -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);

View file

@ -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,