From 4fa51e5bb36cfadde3e6677e032c43951321d382 Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Wed, 14 Mar 2012 12:30:08 +0530 Subject: ASoC: Tegra wm8903 machine: suspend/resume code for HP detection Suspend and resume code included for headphone detection. Earlier, it was causing problem in HP detection when device enters into LP0 state and headphone is plugged in. (Bug 937153) Change-Id: If625f0e7b857b40b0535f8bc8d1c262650886fa7 Signed-off-by: Ankit Gupta Reviewed-on: http://git-master/r/89975 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sumit Bhattacharya Reviewed-by: Scott Peterson --- sound/soc/tegra/tegra_wm8903.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 55187f871957..a75d67b2d973 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -747,10 +747,33 @@ static struct snd_soc_dai_link tegra_wm8903_dai[] = { }, }; +void tegra_wm8903_suspend_post(struct snd_soc_card *card) +{ + struct snd_soc_jack_gpio *gpio = &tegra_wm8903_hp_jack_gpio; + + if (gpio_is_valid(gpio->gpio)) + disable_irq(gpio_to_irq(gpio->gpio)); +} + +void tegra_wm8903_resume_pre(struct snd_soc_card *card) +{ + int val; + struct snd_soc_jack_gpio *gpio = &tegra_wm8903_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); + enable_irq(gpio_to_irq(gpio->gpio)); + } +} + static struct snd_soc_card snd_soc_tegra_wm8903 = { .name = "tegra-wm8903", .dai_link = tegra_wm8903_dai, .num_links = ARRAY_SIZE(tegra_wm8903_dai), + .suspend_post = tegra_wm8903_suspend_post, + .resume_pre = tegra_wm8903_resume_pre, //.set_bias_level = tegra30_soc_set_bias_level, //.set_bias_level_post = tegra30_soc_set_bias_level_post, }; -- cgit v1.2.3