linux/sound/soc/samsung
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
..
ac97.c ASoC: samsung: Use devm_snd_soc_register_component 2014-05-22 00:20:11 +01:00
bells.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00
dma.c ASoC: samsung: Use devm_snd_soc_register_platform 2014-05-22 00:20:11 +01:00
dma.h ASoC: samsung: Use devm_snd_soc_register_platform 2014-05-22 00:20:11 +01:00
dmaengine.c ASoC: samsung: Use devm_snd_soc_register_platform 2014-05-22 00:20:11 +01:00
goni_wm8994.c ASoC: samsung: Use devm_snd_soc_register_component 2014-05-22 00:20:11 +01:00
h1940_uda1380.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
i2s-regs.h ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 2013-08-13 13:44:09 +01:00
i2s.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
i2s.h ASoC: samsung: Allow setting OP_CLK of the IIS Multi Audio Interface 2014-05-20 23:20:57 +01:00
idma.c ASoC: samsung: Use devm_snd_soc_register_platform 2014-05-22 00:20:11 +01:00
idma.h ASoC: Fix __iomem annotation for IDMA registers 2011-11-29 17:28:16 +00:00
jive_wm8750.c ASoC: Samsung: Do not register samsung audio dma device as pdev 2012-12-07 19:36:07 +09:00
Kconfig Merge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf', 'asoc/topic/sta350' and 'asoc/topic/tlv320dac33' into asoc-next 2014-05-22 00:24:00 +01:00
littlemill.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00
ln2440sbc_alc650.c ASoC: Samsung: Do not register samsung audio dma device as pdev 2012-12-07 19:36:07 +09:00
lowland.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00
Makefile ASoC: samsung: Add sound card driver for Snow board 2014-04-29 12:09:38 -07:00
neo1973_wm8753.c ASoC: neo1973_wm8753: Automatically disconnected non-connected pins 2014-05-20 23:29:22 +01:00
pcm.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
pcm.h ASoC: SAMSUNG: Move PCM specific definitions into pcm.c 2011-01-10 11:38:22 +00:00
regs-ac97.h ASoC: samsung: Trivial cleanups in header files 2013-12-30 12:05:56 +00:00
regs-i2s-v2.h
regs-iis.h ASoC: samsung: Trivial cleanups in header files 2013-12-30 12:05:56 +00:00
rx1950_uda1380.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
s3c24xx_simtec_hermes.c ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
s3c24xx_simtec_tlv320aic23.c ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
s3c24xx_simtec.c ASoC: Samsung: remove __dev* attributes 2012-12-10 00:30:19 +09:00
s3c24xx_simtec.h
s3c24xx_uda134x.c ASoC: samsung: move plat/ headers to local directory 2013-04-11 18:17:38 +01:00
s3c24xx-i2s.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
s3c24xx-i2s.h
s3c2412-i2s.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
s3c2412-i2s.h
s3c-i2s-v2.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
s3c-i2s-v2.h ASoC: switch over to use snd_soc_register_component() on s3c i2s 2013-03-26 21:57:31 +00:00
smartq_wm8987.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
smdk2443_wm9710.c ASoC: Samsung: Do not register samsung audio dma device as pdev 2012-12-07 19:36:07 +09:00
smdk_spdif.c ASoC: Samsung: Do not register samsung audio dma device as pdev 2012-12-07 19:36:07 +09:00
smdk_wm8580.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
smdk_wm8580pcm.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00
smdk_wm8994.c Merge remote-tracking branches 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/simple' and 'asoc/topic/sirf' into asoc-next 2014-06-03 10:39:57 +01:00
smdk_wm8994pcm.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00
smdk_wm9713.c ASoC: Samsung: Do not register samsung audio dma device as pdev 2012-12-07 19:36:07 +09:00
snow.c ASoC: samsung: Add missing pm ops for Snow sound card driver 2014-05-14 12:34:50 +01:00
spdif.c ASoC: samsung: Use params_width() 2014-05-26 17:04:20 +01:00
spdif.h
speyside.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00
tobermory.c ASoC: samsung: Use devm_snd_soc_register_card 2014-05-22 00:20:11 +01:00