diff options
author | Ankit Gupta <ankitgupta@nvidia.com> | 2012-03-14 12:30:08 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-03-15 10:13:38 -0700 |
commit | 4fa51e5bb36cfadde3e6677e032c43951321d382 (patch) | |
tree | 8dc4ba7461032d12abc7c7747f8842efb4e29d36 | |
parent | ddb9ce317601e11a0ee0797fd00ac752fa26ccf7 (diff) |
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 <ankitgupta@nvidia.com>
Reviewed-on: http://git-master/r/89975
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
-rw-r--r-- | sound/soc/tegra/tegra_wm8903.c | 23 |
1 files changed, 23 insertions, 0 deletions
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, }; |