]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00160605 Update ALSA Headset detect code
authorMahesh Mahadevan <r9aadq@freescale.com>
Fri, 21 Oct 2011 11:17:52 +0000 (06:17 -0500)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:16 +0000 (08:33 +0200)
Update Headset detect code incase no dedicated pin and detect is
always activated

Signed-off-by: Mahesh Mahadevan <r9aadq@freescale.com>
sound/soc/imx/imx-sgtl5000.c

index 82ee8eca86803218da130a7961c7d2da1e497601..3fd0aa211aef883f7fc6b73e81e1ca2b9c66d293 100644 (file)
@@ -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;
 }