summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5645.c
diff options
context:
space:
mode:
authorOder Chiou <oder_chiou@realtek.com>2015-08-24 14:32:57 +0200
committerMark Brown <broonie@kernel.org>2015-08-25 19:59:47 +0200
commit8db7f56ddf2c4571e33756b70a1a8f492c050449 (patch)
tree2f8e3e806fd3d7c23542167baac05c187d98e66c /sound/soc/codecs/rt5645.c
parentASoC: rt5645: Modify the headphone depop and calibration function to prevent ... (diff)
downloadlinux-8db7f56ddf2c4571e33756b70a1a8f492c050449.tar.xz
linux-8db7f56ddf2c4571e33756b70a1a8f492c050449.zip
ASoC: rt5645: Modify the jack detection function to prevent the pop sound while the jack plug in
The patch corrects the sequence of the jack detection. It will prevent the pop sound while the jack plug in. Signed-off-by: Oder Chiou <oder_chiou@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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index ac2f42f4e3a0..bcb44de002c9 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -2805,14 +2805,15 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
}
regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0);
- regmap_write(rt5645->regmap, RT5645_IN1_CTRL1, 0x0006);
regmap_update_bits(rt5645->regmap,
RT5645_IN1_CTRL2, 0x1000, 0x1000);
+ regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004,
+ 0x0004);
msleep(100);
regmap_update_bits(rt5645->regmap,
RT5645_IN1_CTRL2, 0x1000, 0x0000);
- msleep(450);
+ msleep(600);
regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val);
val &= 0x7;
dev_dbg(codec->dev, "val = %d\n", val);
@@ -2828,9 +2829,17 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
rt5645->jack_type = SND_JACK_HEADPHONE;
}
+ snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200);
+ snd_soc_write(codec, RT5645_DEPOP_M1, 0x001d);
+ snd_soc_write(codec, RT5645_DEPOP_M1, 0x0001);
} else { /* jack out */
rt5645->jack_type = 0;
+ regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000,
+ 0x1000);
+ regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004,
+ 0x0000);
+
if (rt5645->en_button_func)
rt5645_enable_push_button_irq(codec, false);