]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ASoC: Tegra: use GPIO based HS detection
authorMohan Kumar <mkumard@nvidia.com>
Mon, 6 Jan 2014 19:20:49 +0000 (00:50 +0530)
committerWinnie Hsu <whsu@nvidia.com>
Sat, 8 Feb 2014 01:47:00 +0000 (17:47 -0800)
norrin uses TI chip ts3a225e for headset detection, the detetion
signal is handled via gpio based logic which we need to add in
the machine driver of max98090 to support it.

Bug 1434511
Bug 1419069

Change-Id: I3329ebf4577782f2cd313ce39c9d435883f91370
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/352341
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/362915
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Tested-by: Shreshtha Sahu <ssahu@nvidia.com>
Tested-by: Vikram Fugro <vfugro@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
sound/soc/tegra/tegra_max98090.c

index 8c392ca84e6dcb2f9f79de12ae1eeaf8176fc1d7..07a714792bea6d79c403c515cf74e446269ad848 100644 (file)
@@ -1022,6 +1022,26 @@ static int tegra_max98090_init(struct snd_soc_pcm_runtime *rtd)
                gpio_direction_output(pdata->gpio_hp_mute, 0);
        }
 
+       if (gpio_is_valid(pdata->gpio_hp_det) &&
+               of_machine_is_compatible("nvidia,norrin")) {
+               tegra_max98090_hp_jack_gpio.gpio = pdata->gpio_hp_det;
+               tegra_max98090_hp_jack_gpio.invert =
+                       !pdata->gpio_hp_det_active_high;
+               snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
+                                       &tegra_max98090_hp_jack);
+#ifndef CONFIG_SWITCH
+               snd_soc_jack_add_pins(&tegra_max98090_hp_jack,
+                                       ARRAY_SIZE(tegra_max98090_hs_jack_pins),
+                                       tegra_max98090_hs_jack_pins);
+#else
+               snd_soc_jack_notifier_register(&tegra_max98090_hp_jack,
+                                               &tegra_max98090_jack_detect_nb);
+#endif
+               snd_soc_jack_add_gpios(&tegra_max98090_hp_jack,
+                                       1, &tegra_max98090_hp_jack_gpio);
+               machine->gpio_requested |= GPIO_HP_DET;
+       }
+
        /* Add call mode switch control */
        ret = snd_ctl_add(codec->card->snd_card,
                snd_ctl_new1(&tegra_max98090_call_mode_control, machine));