Skip to contentSkip to conversation

ASoC: rt286: add jack detection disable with NULL jack passed

PATCH Applied Jie Yang 2 participants 2 messages Feb 10, 2015 – Feb 24, 2015

Subsystems (3)
lore
Share & tools
lore

Jie Yang

author
#0 lore raw

PATCH v4 1/1 ASoC: rt286: add jack detection disable with NULL jack passed

Some platforms, e.g. WSB, don't need jack detection when system is in Suspend, for power save reason.

Here add headphone/mic jack detection disable feature with NULL jack passed in, when disabled, it will disable interrupt, and disable LDO1, which is used for jack detection when headphone is plugged in.

---
 sound/soc/codecs/rt286.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
sound/soc/codecs/rt286.c +14 -3
index d5cc1bc..c778028 100644
@@ -394,9 +394,20 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 
 	rt286->jack = jack;
 
-	/* Send an initial empty report */
-	snd_soc_jack_report(rt286->jack, 0,
-		SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
+	if (jack) {
+		/* enable IRQ */
+		if (rt286->jack->status | SND_JACK_HEADPHONE)
+			snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO1");
+		regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2);
+		/* Send an initial empty report */
+		snd_soc_jack_report(rt286->jack, rt286->jack->status,
+			SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
+	} else {
+		/* disable IRQ */
+		regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0);
+		snd_soc_dapm_disable_pin(&codec->dapm, "LDO1");
+	}
+	snd_soc_dapm_sync(&codec->dapm);
 
 	return 0;
 }
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Jie Yang

Some platforms, e.g. WSB, don't need jack detection when system is in Suspend, for power save reason.

Applied, thanks.