From 6fa1fe7eb46ee41a076cafb85157c0125a613ba8 Mon Sep 17 00:00:00 2001 From: sam_chen Date: Tue, 5 Nov 2013 13:03:34 +0800 Subject: [PATCH] audio: asoc: wcd9310: fix headset mic recording fail. Headset mic fail in case of inserting headset while dmic is recording. Keep LDO_H always on while headset is inserted. Bug: 11506684 Change-Id: I8516d537d2c72d6f71236219e5d3e610e25ecf24 Signed-off-by: sam_chen --- sound/soc/codecs/wcd9310.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wcd9310.c b/sound/soc/codecs/wcd9310.c index 3b9fa6de897c..210c47283297 100644 --- a/sound/soc/codecs/wcd9310.c +++ b/sound/soc/codecs/wcd9310.c @@ -2887,11 +2887,27 @@ static int tabla_codec_reset_interpolator(struct snd_soc_dapm_widget *w, static int tabla_codec_enable_ldo_h(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { + struct snd_soc_codec *codec = w->codec; + struct tabla_priv *tabla = NULL; + + if (codec != NULL) + tabla = snd_soc_codec_get_drvdata(codec); + switch (event) { case SND_SOC_DAPM_POST_PMU: - case SND_SOC_DAPM_POST_PMD: usleep_range(1000, 1000); break; + case SND_SOC_DAPM_POST_PMD: + /* + * Don't disable LDO_H while headset is inserted. + * Headset need LDO_H always on. + */ + if (tabla->h2w_state == H2W_HEADSET) { + snd_soc_update_bits(codec, TABLA_A_LDO_H_MODE_1, + 0x80, 0x80); + } else + usleep_range(1000, 1000); + break; } return 0; } @@ -5164,7 +5180,8 @@ static const struct snd_soc_dapm_widget tabla_dapm_widgets[] = { 0), SND_SOC_DAPM_SUPPLY("LDO_H", TABLA_A_LDO_H_MODE_1, 7, 0, - tabla_codec_enable_ldo_h, SND_SOC_DAPM_POST_PMU), + tabla_codec_enable_ldo_h, SND_SOC_DAPM_POST_PMU | + SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SUPPLY("COMP1_CLK", SND_SOC_NOPM, 0, 0, tabla_config_compander, SND_SOC_DAPM_PRE_PMU |