asoc: tegra: ALC5640 machine:Add support to detect HP in LP0
Manoj Gangwal [Wed, 25 Apr 2012 12:52:01 +0000 (17:52 +0530)]
Add Support to detect the HP insertion or removal during
LP0 state.

Bug 969405

Change-Id: Ibedf1769338e16877240ea9cc82fa7469eb7ff9e
Signed-off-by: Manoj Gangwal <mgangwal@nvidia.com>
Reviewed-on: http://git-master/r/98745
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

sound/soc/tegra/tegra_rt5640.c

index e5e6c1f..6ca6f76 100644 (file)
@@ -582,10 +582,26 @@ static struct snd_soc_dai_link tegra_rt5640_dai[] = {
        },
 };
 
+static int tegra_rt5640_resume_pre(struct snd_soc_card *card)
+{
+       int val;
+       struct snd_soc_jack_gpio *gpio = &tegra_rt5640_hp_jack_gpio;
+
+       if (gpio_is_valid(gpio->gpio)) {
+               val = gpio_get_value(gpio->gpio);
+               val = gpio->invert ? !val : val;
+               snd_soc_jack_report(gpio->jack, val, gpio->report);
+       }
+
+       return 0;
+}
+
+
 static struct snd_soc_card snd_soc_tegra_rt5640 = {
        .name = "tegra-rt5640",
        .dai_link = tegra_rt5640_dai,
        .num_links = ARRAY_SIZE(tegra_rt5640_dai),
+       .resume_pre = tegra_rt5640_resume_pre,
 };
 
 static __devinit int tegra_rt5640_driver_probe(struct platform_device *pdev)