From 080f91d508cfd009fe57ebe2c90255bc35b020d2 Mon Sep 17 00:00:00 2001 From: Shridhar Rasal Date: Wed, 3 Aug 2011 15:04:28 +0530 Subject: ASOC: tegra: Disable/Enable wired jack IRQ Disable/enable wired jack interrupts while going into suspend/resume. Bug 854830 (cherry picked from commit 281195dd5892134bb1fe174c0f2955dbe926412b) Change-Id: Ie9197cf709f78e5e8e3d6ac2038b9bf0425dfc30 Reviewed-on: http://git-master/r/47308 Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- sound/soc/tegra/tegra_soc_wm8753.c | 4 ++-- sound/soc/tegra/tegra_wired_jack.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_soc_wm8753.c b/sound/soc/tegra/tegra_soc_wm8753.c index 99756a3a0b82..3f341a92da46 100644 --- a/sound/soc/tegra/tegra_soc_wm8753.c +++ b/sound/soc/tegra/tegra_soc_wm8753.c @@ -388,7 +388,7 @@ void tegra_codec_shutdown(struct snd_pcm_substream *substream) int tegra_soc_suspend_pre(struct platform_device *pdev, pm_message_t state) { - tegra_jack_suspend(); + disable_irq(gpio_to_irq(wm8753_jack->gpio)); return 0; } @@ -408,7 +408,7 @@ int tegra_soc_resume_pre(struct platform_device *pdev) int tegra_soc_resume_post(struct platform_device *pdev) { - tegra_jack_resume(); + enable_irq(gpio_to_irq(wm8753_jack->gpio)); return 0; } diff --git a/sound/soc/tegra/tegra_wired_jack.c b/sound/soc/tegra/tegra_wired_jack.c index 889d1920659c..e38ee006eb76 100644 --- a/sound/soc/tegra/tegra_wired_jack.c +++ b/sound/soc/tegra/tegra_wired_jack.c @@ -130,16 +130,26 @@ static int wired_switch_notify(struct notifier_block *self, void tegra_jack_suspend(void) { - snd_soc_jack_free_gpios(tegra_wired_jack, - ARRAY_SIZE(wired_jack_gpios), - wired_jack_gpios); + int i; + + for (i = 0; i < ARRAY_SIZE(wired_jack_gpios); i++) + disable_irq(gpio_to_irq(wired_jack_gpios[i].gpio)); } void tegra_jack_resume(void) { - snd_soc_jack_add_gpios(tegra_wired_jack, - ARRAY_SIZE(wired_jack_gpios), - wired_jack_gpios); + int i, val; + + for (i = 0; i < ARRAY_SIZE(wired_jack_gpios); i++) { + val = gpio_get_value(wired_jack_gpios[i].gpio); + val = wired_jack_gpios[i].invert ? !val : val; + val = val ? wired_jack_gpios[i].report : 0; + + snd_soc_jack_report(tegra_wired_jack, val, + wired_jack_gpios[i].report); + + enable_irq(gpio_to_irq(wired_jack_gpios[i].gpio)); + } } static struct notifier_block wired_switch_nb = { -- cgit v1.2.3