kernel-fxtec-pro1x/sound/soc
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
..
adi
atmel Merge remote-tracking branches 'asoc/topic/ad1980', 'asoc/topic/adsp', 'asoc/topic/ak4104', 'asoc/topic/ak4642', 'asoc/topic/alc5623', 'asoc/topic/arizona', 'asoc/topic/atmel' and 'asoc/topic/cache' into asoc-next 2014-05-22 00:23:45 +01:00
au1x
bcm
blackfin ASoC: Blackfin: ADAU1X81 eval board support 2014-05-27 20:54:51 +01:00
cirrus
codecs Merge remote-tracking branches 'asoc/topic/wm8804' and 'asoc/topic/wm9713' into asoc-next 2014-06-03 10:40:00 +01:00
davinci Merge remote-tracking branches 'asoc/topic/omap' and 'asoc/topic/rcar' into asoc-next 2014-06-03 10:39:53 +01:00
dwc
fsl Merge remote-tracking branch 'asoc/topic/fsl-ssi' into asoc-next 2014-06-03 10:39:49 +01:00
generic ASoC: simple-card: Support setting mclk via a fixed factor 2014-05-26 14:29:30 +01:00
intel Merge remote-tracking branches 'asoc/topic/gpio' and 'asoc/topic/intel' into asoc-next 2014-06-03 10:39:50 +01:00
jz4740 Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
kirkwood ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
mxs
nuc900 ASoC: nuc900: export nuc900_ac97_data 2014-04-30 20:32:20 -07:00
omap ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
pxa ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
s6000
samsung ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
sh Merge remote-tracking branches 'asoc/topic/omap' and 'asoc/topic/rcar' into asoc-next 2014-06-03 10:39:53 +01:00
sirf
spear
tegra Merge remote-tracking branch 'asoc/topic/tegra' into asoc-next 2014-06-03 10:39:59 +01:00
txx9
ux500 ASoC: mop500_ab8500: Replace instances of rtd->codec->card with rtd->card 2014-05-20 22:55:39 +01:00
Kconfig
Makefile
soc-cache.c ASoC: cache: Fix error code when not using ASoC level cache 2014-06-02 16:08:21 +01:00
soc-compress.c ASoC: compress: indent an if statement 2014-05-14 16:15:03 +01:00
soc-core.c 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
soc-dapm.c Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2014-05-22 00:23:42 +01:00
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-io.c
soc-jack.c ASoC: jack: Add support for GPIO descriptor defined jack pins 2014-05-26 15:26:00 +01:00
soc-pcm.c Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
soc-utils.c