linux/sound/soc/omap
Stephen Warren e1d4d3c854 ASoC: free jack GPIOs before the sound card is freed
This is the same change as commit fb6b8e7144 "ASoC: tegra: free jack
GPIOs before the sound card is freed", but applied to all other ASoC
machine drivers where code inspection indicates the same problem exists.

That commit's description is:
==========
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, guard 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.
==========

Note that I have not even compile-tested this in most cases, since most
of the drivers rely on specific mach-* support I don't have enabled, and
don't support COMPILE_TEST. Testing by the relevant board maintainers
would be useful.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-03 10:41:16 +01:00
..
am3517evm.c ASoC: am3517evm: Use the same name for platform as the cpu_dai 2014-04-18 18:00:46 +01:00
ams-delta.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
Kconfig ASoC: omap: Amstrad E3 needs TTY support for codec 2014-05-01 13:31:05 -07:00
Makefile ASoC: OMAP: Remove obsolete Makefile line 2013-05-30 11:49:24 +01:00
mcbsp.c ASoC: omap: mcbsp, mcpdm, dmic: raw read and write endian fix 2013-11-24 13:40:59 +00:00
mcbsp.h ASoC: omap: Use common DAI DMA data 2013-04-03 18:12:58 +01:00
n810.c ASoC: n810: Use the same name for platform as the cpu_dai 2014-04-18 18:00:46 +01:00
omap3pandora.c ASoC: omap3pandora: Use the same name for platform as the cpu_dai 2014-04-18 18:00:47 +01:00
omap-abe-twl6040.c ASoC: omap: Replace instances of rtd->codec->card with rtd->card 2014-05-20 22:54:54 +01:00
omap-dmic.c ASoC: omap-pcm: Move omap-pcm under include/sound 2014-05-26 15:32:32 +01:00
omap-dmic.h ASoC: OMAP4: omap-dmic: Initial support for OMAP DMIC 2011-11-28 17:21:44 +00:00
omap-hdmi-card.c ASoC: omap-hdmi-card: Use the same name for platform as the cpu_dai 2014-04-18 18:00:47 +01:00
omap-hdmi.c ASoC: omap-pcm: Move omap-pcm under include/sound 2014-05-26 15:32:32 +01:00
omap-hdmi.h ASoC: OMAP: HDMI: Expand capabilities of the HDMI DAI 2012-05-22 17:33:23 +01:00
omap-mcbsp.c ASoC: omap-pcm: Move omap-pcm under include/sound 2014-05-26 15:32:32 +01:00
omap-mcbsp.h ASoC: omap: rx51: omap_mcbsp_st_add_controls: add id parameter 2014-05-01 10:54:34 -07:00
omap-mcpdm.c ASoC: omap-pcm: Move omap-pcm under include/sound 2014-05-26 15:32:32 +01:00
omap-mcpdm.h ASoC: omap-mcpdm: API to configure offset cancellation 2011-09-26 22:23:32 +01:00
omap-pcm.c ASoC: omap-pcm: Drop the platform driver init code 2014-04-18 18:00:47 +01:00
omap-twl4030.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
osk5912.c ASoC: osk5912: Use the same name for platform as the cpu_dai 2014-04-18 18:00:47 +01:00
rx51.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00