Blob Blame History Raw
From 969943bfc9629f7c999fb5168a1d693cf03acc36 Mon Sep 17 00:00:00 2001
From: Shuming Fan <shumingf@realtek.com>
Date: Fri, 17 Jul 2020 15:02:56 +0800
Subject: [PATCH] ASoC: rt5682: disable MICBIAS and Vref2 widget in default
Git-commit: 969943bfc9629f7c999fb5168a1d693cf03acc36
Patch-mainline: v5.9-rc1
References: jsc#SLE-16518

The pin status of the widget was connected after the sound card registered.
The rt5682_headset_detect function will use the pin status of these two widgets
to decide the certain register setting on/off.
Therefore this patch disables the pin of these two widgets in the codec probe.
This patch could avoid the misjudgment.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20200717070256.28712-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 sound/soc/codecs/rt5682.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index de40b6cd16cf..5f2fbe8a3ae6 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -2831,6 +2831,7 @@ static int rt5682_probe(struct snd_soc_component *component)
 	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
 	struct sdw_slave *slave;
 	unsigned long time;
+	struct snd_soc_dapm_context *dapm = &component->dapm;
 
 #ifdef CONFIG_COMMON_CLK
 	int ret;
@@ -2868,6 +2869,9 @@ static int rt5682_probe(struct snd_soc_component *component)
 #endif
 	}
 
+	snd_soc_dapm_disable_pin(dapm, "MICBIAS");
+	snd_soc_dapm_disable_pin(dapm, "Vref2");
+	snd_soc_dapm_sync(dapm);
 	return 0;
 }
 
-- 
2.16.4