alistair23-linux/sound/soc/tegra
Stephen Warren fb6b8e7144 ASoC: tegra: free jack GPIOs before the sound card is freed
snd_soc_jack_add_gpios() schedules a work queue item to poll the GPIO to
generate an initial jack status report. If sound card initialization
fails, that work item needs to be cancelled, so it doesn't run after the
card has been freed. Specifically, freeing the card calls
snd_jack_dev_free() which calls snd_jack_dev_disconnect() which sets
jack->input_dev = NULL, and input_dev is used by snd_jack_report(), which
is called from the work queue item.

snd_soc_jack_free_gpios() cancels the work item. The Tegra ASoC machine
drivers do call this function in the platform driver remove() callback.
However, this happens after the sound card is freed, at least when the
card is freed due to errors late during snd_soc_instantiate_card(). This
leaves a window where the work item can execute after the card is freed.
In next-20140522, sound card initialization does fail for unrelated
reasons, and hits the problem described above.

To solve this, fix the Tegra ASoC machine drivers to clean up the Jack
GPIOs during the snd_soc_card's .remove() callback, which is executed
before the overall card object is freed. also, gGuard the cleanup call
based on whether we actually setup up the GPIOs in the first place.
Ideally, we'd do the cleanup in a struct snd_soc_dai_link .fini/remove
function to match where the GPIOs get set up. However, there is no such
callback.

This change fixes all Tegra machine drivers. By code inspection, I
believe some non-Tegra machine drivers have the same issue. I'll send a
patch for that separately, once this is reviewed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 14:32:34 +01:00
..
Kconfig ASoC: update Kconfig of AIC23 users to select I2C variant 2014-03-07 10:55:33 +08:00
Makefile ASoC: tegra: add tegra+MAX98090 machine driver 2013-12-05 13:31:37 +00:00
tegra20_ac97.c Merge remote-tracking branches 'asoc/topic/tdm' and 'asoc/topic/tegra' into asoc-next 2014-03-25 21:22:15 +00:00
tegra20_ac97.h ASoC: tegra: move AC97 clock handling to the machine driver 2014-03-25 18:54:50 +00:00
tegra20_das.c ASoC: tegra: Use flat regcache 2014-03-19 23:09:45 +00:00
tegra20_das.h
tegra20_i2s.c ASoC: tegra: Use flat regcache 2014-03-19 23:09:45 +00:00
tegra20_i2s.h ASoC: tegra: Use common DAI DMA data struct 2013-04-03 18:13:34 +01:00
tegra20_spdif.c ASoC: tegra: Use flat regcache 2014-03-19 23:09:45 +00:00
tegra20_spdif.h ASoC: tegra: Use common DAI DMA data struct 2013-04-03 18:13:34 +01:00
tegra30_ahub.c ASoC: tegra: Use flat regcache 2014-03-19 23:09:45 +00:00
tegra30_ahub.h ASoC: tegra: convert to standard DMA DT bindings 2013-12-11 16:43:57 -07:00
tegra30_i2s.c ASoC: tegra: Use flat regcache 2014-03-19 23:09:45 +00:00
tegra30_i2s.h ASoC: tegra: convert to standard DMA DT bindings 2013-12-11 16:43:57 -07:00
tegra_alc5632.c ASoC: tegra: free jack GPIOs before the sound card is freed 2014-05-26 14:32:34 +01:00
tegra_asoc_utils.c ASoC: tegra: support new register layouts in Tegra124 2013-10-14 14:56:27 +01:00
tegra_asoc_utils.h ASoC: tegra: support new register layouts in Tegra124 2013-10-14 14:56:27 +01:00
tegra_max98090.c ASoC: tegra: free jack GPIOs before the sound card is freed 2014-05-26 14:32:34 +01:00
tegra_pcm.c ARM: SoC cleanups for 3.14 2014-01-23 18:36:55 -08:00
tegra_pcm.h ASoC: tegra: convert to standard DMA DT bindings 2013-12-11 16:43:57 -07:00
tegra_rt5640.c ASoC: tegra: free jack GPIOs before the sound card is freed 2014-05-26 14:32:34 +01:00
tegra_wm8753.c ASoC: tegra: Remove unneeded mach-type.h incldues 2013-07-17 10:19:20 +01:00
tegra_wm8903.c ASoC: tegra: free jack GPIOs before the sound card is freed 2014-05-26 14:32:34 +01:00
tegra_wm9712.c ASoC: tegra: move AC97 clock handling to the machine driver 2014-03-25 18:54:50 +00:00
trimslice.c ASoC: tegra: Remove unneeded mach-type.h incldues 2013-07-17 10:19:20 +01:00