summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorMahesh Mahadevan <r9aadq@freescale.com>2011-10-21 06:17:52 -0500
committerJason Liu <r64343@freescale.com>2012-01-09 20:24:01 +0800
commit7e04c30b7659d0a87def04bfe03bc29d88fab108 (patch)
tree0379016294cc0dae2db93096b3f6793668780554 /sound/soc
parent730f14876b4572fc55c50832ae0733a9cc106959 (diff)
ENGR00160605 Update ALSA Headset detect code
Update Headset detect code incase no dedicated pin and detect is always activated Signed-off-by: Mahesh Mahadevan <r9aadq@freescale.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/imx/imx-sgtl5000.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/sound/soc/imx/imx-sgtl5000.c b/sound/soc/imx/imx-sgtl5000.c
index 82ee8eca8680..3fd0aa211aef 100644
--- a/sound/soc/imx/imx-sgtl5000.c
+++ b/sound/soc/imx/imx-sgtl5000.c
@@ -249,24 +249,26 @@ static int imx_3stack_sgtl5000_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_enable_pin(&codec->dapm, "Headphone Jack");
snd_soc_dapm_sync(&codec->dapm);
- /* Jack detection API stuff */
- ret = snd_soc_jack_new(codec, "Headphone Jack",
- SND_JACK_HEADPHONE, &hs_jack);
- if (ret)
- return ret;
-
- ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
- hs_jack_pins);
- if (ret) {
- printk(KERN_ERR "failed to call snd_soc_jack_add_pins\n");
- return ret;
+ if (hs_jack_gpios[0].gpio != -1) {
+ /* Jack detection API stuff */
+ ret = snd_soc_jack_new(codec, "Headphone Jack",
+ SND_JACK_HEADPHONE, &hs_jack);
+ if (ret)
+ return ret;
+
+ ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
+ hs_jack_pins);
+ if (ret) {
+ printk(KERN_ERR "failed to call snd_soc_jack_add_pins\n");
+ return ret;
+ }
+
+ ret = snd_soc_jack_add_gpios(&hs_jack,
+ ARRAY_SIZE(hs_jack_gpios), hs_jack_gpios);
+ if (ret)
+ printk(KERN_WARNING "failed to call snd_soc_jack_add_gpios\n");
}
- ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
- hs_jack_gpios);
- if (ret)
- printk(KERN_WARNING "failed to call snd_soc_jack_add_gpios\n");
-
return 0;
}