aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBard Liao <bardliao@realtek.com>2016-04-26 06:07:11 -0400
committerMark Brown <broonie@kernel.org>2016-04-26 06:11:08 -0400
commit9ff49ce475cfeaf486321a2db8132a9500740faa (patch)
treeacfb10df06980c72b9176c8208497462ce1f0c64
parent3c9e014c442caefa14c71494ca4473121007f60f (diff)
ASoC: rt298: fix capture doesn't work at some cases
RT298_CBJ_CTRL1(0x4f) bit 10 is needed for headset capture. It will be turned off when "VREF" widget is on and be turned on when bias level is ON. It is odd. And if "VREF" is turned on in bias level is ON, RT298_CBJ_CTRL1(0x4f) bit 10 will be turned off. This patch move the bit control from rt298_set_bias_level and rt298_vref_event to rt298_jack_detect. So it will be turned on once a jack is plugged in. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/rt298.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index 178b1cc22e05..68cf8d5a174f 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -275,6 +275,8 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic)
275 } else { 275 } else {
276 *mic = false; 276 *mic = false;
277 regmap_write(rt298->regmap, RT298_SET_MIC1, 0x20); 277 regmap_write(rt298->regmap, RT298_SET_MIC1, 0x20);
278 regmap_update_bits(rt298->regmap,
279 RT298_CBJ_CTRL1, 0x0400, 0x0000);
278 } 280 }
279 } else { 281 } else {
280 regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf); 282 regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf);
@@ -539,30 +541,12 @@ static int rt298_mic1_event(struct snd_soc_dapm_widget *w,
539 return 0; 541 return 0;
540} 542}
541 543
542static int rt298_vref_event(struct snd_soc_dapm_widget *w,
543 struct snd_kcontrol *kcontrol, int event)
544{
545 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
546
547 switch (event) {
548 case SND_SOC_DAPM_PRE_PMU:
549 snd_soc_update_bits(codec,
550 RT298_CBJ_CTRL1, 0x0400, 0x0000);
551 mdelay(50);
552 break;
553 default:
554 return 0;
555 }
556
557 return 0;
558}
559
560static const struct snd_soc_dapm_widget rt298_dapm_widgets[] = { 544static const struct snd_soc_dapm_widget rt298_dapm_widgets[] = {
561 545
562 SND_SOC_DAPM_SUPPLY_S("HV", 1, RT298_POWER_CTRL1, 546 SND_SOC_DAPM_SUPPLY_S("HV", 1, RT298_POWER_CTRL1,
563 12, 1, NULL, 0), 547 12, 1, NULL, 0),
564 SND_SOC_DAPM_SUPPLY("VREF", RT298_POWER_CTRL1, 548 SND_SOC_DAPM_SUPPLY("VREF", RT298_POWER_CTRL1,
565 0, 1, rt298_vref_event, SND_SOC_DAPM_PRE_PMU), 549 0, 1, NULL, 0),
566 SND_SOC_DAPM_SUPPLY_S("BG_MBIAS", 1, RT298_POWER_CTRL2, 550 SND_SOC_DAPM_SUPPLY_S("BG_MBIAS", 1, RT298_POWER_CTRL2,
567 1, 0, NULL, 0), 551 1, 0, NULL, 0),
568 SND_SOC_DAPM_SUPPLY_S("LDO1", 1, RT298_POWER_CTRL2, 552 SND_SOC_DAPM_SUPPLY_S("LDO1", 1, RT298_POWER_CTRL2,
@@ -953,18 +937,9 @@ static int rt298_set_bias_level(struct snd_soc_codec *codec,
953 } 937 }
954 break; 938 break;
955 939
956 case SND_SOC_BIAS_ON:
957 mdelay(30);
958 snd_soc_update_bits(codec,
959 RT298_CBJ_CTRL1, 0x0400, 0x0400);
960
961 break;
962
963 case SND_SOC_BIAS_STANDBY: 940 case SND_SOC_BIAS_STANDBY:
964 snd_soc_write(codec, 941 snd_soc_write(codec,
965 RT298_SET_AUDIO_POWER, AC_PWRST_D3); 942 RT298_SET_AUDIO_POWER, AC_PWRST_D3);
966 snd_soc_update_bits(codec,
967 RT298_CBJ_CTRL1, 0x0400, 0x0000);
968 break; 943 break;
969 944
970 default: 945 default: