android_kernel_motorola_sm6225/sound/soc/pxa
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
..
brownstone.c ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
corgi.c Merge branch 'topic/dapm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-pxa 2014-03-13 09:40:56 +00:00
e740_wm9705.c ASoC: pxa: e740_wm9705: Convert to table based DAPM setup 2014-03-03 11:01:48 +09:00
e750_wm9705.c ASoC: pxa: e750_wm9705: Convert to table based DAPM setup 2014-03-03 11:01:48 +09:00
e800_wm9712.c ASoC: pxa: e800_wm9712: Convert to table based DAPM setup 2014-03-03 11:01:48 +09:00
em-x270.c ASoC: pxa: Add .owner to struct snd_soc_card 2011-12-22 11:04:18 +00:00
hx4700.c ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
imote2.c ALSA: ASoC: pxa: add asoc pm callbacks to pxa audio drivers 2013-10-18 00:35:00 +01:00
Kconfig ASoC: pxa: TTC DKB audio needs I2C 2014-05-01 11:00:34 -07:00
magician.c ASoC: pxa: magician: Convert to table based DAPM and control setup 2014-03-13 09:41:00 +00:00
Makefile ASoC: remove saarb and tavorevb3 machine drivers 2013-05-15 08:59:29 +04:00
mioa701_wm9713.c ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup 2014-03-03 11:01:48 +09:00
mmp-pcm.c ASoC: mmp: Don't set unused struct snd_pcm_hardware fields 2013-12-30 13:58:53 +00:00
mmp-sspa.c ASoC: mmp-sspa: Use devm_snd_soc_register_component 2013-09-19 14:57:38 +01:00
mmp-sspa.h ASoC: mmp: add sspa support 2012-06-13 13:13:39 +01:00
palm27x.c ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
poodle.c ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
pxa-ssp.c Merge remote-tracking branches 'asoc/fix/pxa' and 'asoc/fix/tlv320aic3x' into asoc-linus 2014-06-03 10:39:38 +01:00
pxa-ssp.h ASoC: multi-component - ASoC Multi-Component Support 2010-08-12 14:00:00 +01:00
pxa2xx-ac97.c ALSA: ASoC: pxa: fix pxa2xx-ac97 DAI initialization order 2013-10-18 00:35:00 +01:00
pxa2xx-ac97.h ASoC: pxa2xx: fixup multi-platform AC'97 build failures 2013-06-29 13:24:29 +01:00
pxa2xx-i2s.c ASoC: pxa: Use WARN_ON() instead of BUG_ON() 2013-11-07 19:55:15 +00:00
pxa2xx-i2s.h ASoC: multi-component - ASoC Multi-Component Support 2010-08-12 14:00:00 +01:00
pxa2xx-pcm.c ASoC: pxa: remove mach header dependency 2014-05-20 23:14:49 +01:00
raumfeld.c ASoC: Remove unnecessary -codec from cs4270 driver name 2012-02-28 12:35:20 +00:00
spitz.c Merge branch 'topic/dapm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-pxa 2014-03-13 09:40:56 +00:00
tosa.c ASoC: pxa: tosa: Convert to table based DAPM and control setup 2014-03-13 09:41:00 +00:00
ttc-dkb.c ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
z2.c ASoC: Convert z2 to table based DAPM init 2012-01-02 13:08:38 +00:00
zylonite.c ASoC: pxa: zylonite: Convert to table based DAPM setup 2014-03-03 11:01:52 +09:00