summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5645.c
diff options
context:
space:
mode:
authorJohn Lin <john.lin@realtek.com>2015-05-12 20:43:04 +0800
committerMark Brown <broonie@kernel.org>2015-05-12 19:50:40 +0100
commitb7f22478c01dbb44545f7b8192a6111d5e992a59 (patch)
tree67e5b4cecb0d8a68f4e85b9907e95653e014c1e3 /sound/soc/codecs/rt5645.c
parent47ba5bb295431c7d2bd0e48b63b4cdce600248d3 (diff)
downloadop-kernel-dev-b7f22478c01dbb44545f7b8192a6111d5e992a59.zip
op-kernel-dev-b7f22478c01dbb44545f7b8192a6111d5e992a59.tar.gz
ASoC: rt5645: fix IRQ error in jack detection
IRQ of jack and button detection is abnormal if "LDO2" and "Mic Det Power" power disable in rt5645_jack_detect. This patch make these two power keep enabled until jack out. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt5645.c')
-rw-r--r--sound/soc/codecs/rt5645.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 0571a60..e62f3b2 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -2827,20 +2827,6 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
val = snd_soc_read(codec, RT5645_IN1_CTRL3) & 0x7;
dev_dbg(codec->dev, "val = %d\n", val);
- if (codec->component.card->instantiated) {
- if (rt5645->pdata.jd_mode == 0)
- snd_soc_dapm_disable_pin(&codec->dapm, "LDO2");
- snd_soc_dapm_disable_pin(&codec->dapm,
- "Mic Det Power");
- snd_soc_dapm_sync(&codec->dapm);
- } else {
- if (rt5645->pdata.jd_mode == 0)
- snd_soc_update_bits(codec, RT5645_PWR_MIXER,
- RT5645_PWR_LDO2, 0);
- snd_soc_update_bits(codec, RT5645_PWR_VOL,
- RT5645_PWR_MIC_DET, 0);
- }
-
if (val == 1 || val == 2) {
rt5645->jack_type = SND_JACK_HEADSET;
if (rt5645->en_button_func) {
@@ -2848,6 +2834,13 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
rt5645_enable_push_button_irq(codec, true);
}
} else {
+ if (codec->component.card->instantiated) {
+ snd_soc_dapm_disable_pin(&codec->dapm,
+ "Mic Det Power");
+ snd_soc_dapm_sync(&codec->dapm);
+ } else
+ regmap_update_bits(rt5645->regmap,
+ RT5645_PWR_VOL, RT5645_PWR_MIC_DET, 0);
rt5645->jack_type = SND_JACK_HEADPHONE;
}
@@ -2855,6 +2848,23 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
rt5645->jack_type = 0;
if (rt5645->en_button_func)
rt5645_enable_push_button_irq(codec, false);
+ else {
+ if (codec->component.card->instantiated) {
+ if (rt5645->pdata.jd_mode == 0)
+ snd_soc_dapm_disable_pin(&codec->dapm,
+ "LDO2");
+ snd_soc_dapm_disable_pin(&codec->dapm,
+ "Mic Det Power");
+ snd_soc_dapm_sync(&codec->dapm);
+ } else {
+ if (rt5645->pdata.jd_mode == 0)
+ regmap_update_bits(rt5645->regmap,
+ RT5645_PWR_MIXER,
+ RT5645_PWR_LDO2, 0);
+ regmap_update_bits(rt5645->regmap,
+ RT5645_PWR_VOL, RT5645_PWR_MIC_DET, 0);
+ }
+ }
}
return rt5645->jack_type;
OpenPOWER on IntegriCloud