ASoC: WCD9310: Detect headset button press and release
Detects if inserted headset has a microphone or not, and
if there is a microphone, detects if a button is pressed
which grounds the microphone bias line.
Signed-off-by: Brad Rubin <brubin@codeaurora.org>
diff --git a/sound/soc/msm/msm8960.c b/sound/soc/msm/msm8960.c
index b10ed35..f490e28 100644
--- a/sound/soc/msm/msm8960.c
+++ b/sound/soc/msm/msm8960.c
@@ -61,6 +61,7 @@
static int msm8960_headset_gpios_configured;
static struct snd_soc_jack hs_jack;
+static struct snd_soc_jack button_jack;
static void codec_poweramp_on(void)
{
@@ -268,7 +269,15 @@
pr_err("failed to create new jack\n");
return err;
}
- tabla_hs_detect(codec, &hs_jack, &tabla_cal);
+
+ err = snd_soc_jack_new(codec, "Button Jack",
+ SND_JACK_BTN_0, &button_jack);
+ if (err) {
+ pr_err("failed to create new jack\n");
+ return err;
+ }
+
+ tabla_hs_detect(codec, &hs_jack, &button_jack, &tabla_cal);
return 0;
}