diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-06-11 13:27:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-11 23:38:48 -0400 |
commit | 3419ae781f1592b3d367107db6500090495490cd (patch) | |
tree | cdf058925b8126d184fd6dfaa003e2128ca730de /sound | |
parent | 9c699e0a9566cfb6245284ce4857d7a06b02f3b1 (diff) |
ASoC: tegra+wm8903: turn of mic detect when card is removed
If mic detect is left enabled and the WM8903 detects a status change,
the WM8903 driver will make a callback against the free()d jack, which
will cause a crash.
This problem can be triggered by fully initializing an audio card, then
removing and re-inserting the machine driver module.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra/tegra_wm8903.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 0b0df49d9d33..3b6da91188a9 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c | |||
@@ -346,6 +346,17 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) | |||
346 | return 0; | 346 | return 0; |
347 | } | 347 | } |
348 | 348 | ||
349 | static int tegra_wm8903_remove(struct snd_soc_card *card) | ||
350 | { | ||
351 | struct snd_soc_pcm_runtime *rtd = &(card->rtd[0]); | ||
352 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
353 | struct snd_soc_codec *codec = codec_dai->codec; | ||
354 | |||
355 | wm8903_mic_detect(codec, NULL, 0, 0); | ||
356 | |||
357 | return 0; | ||
358 | } | ||
359 | |||
349 | static struct snd_soc_dai_link tegra_wm8903_dai = { | 360 | static struct snd_soc_dai_link tegra_wm8903_dai = { |
350 | .name = "WM8903", | 361 | .name = "WM8903", |
351 | .stream_name = "WM8903 PCM", | 362 | .stream_name = "WM8903 PCM", |
@@ -363,6 +374,8 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = { | |||
363 | .dai_link = &tegra_wm8903_dai, | 374 | .dai_link = &tegra_wm8903_dai, |
364 | .num_links = 1, | 375 | .num_links = 1, |
365 | 376 | ||
377 | .remove = tegra_wm8903_remove, | ||
378 | |||
366 | .controls = tegra_wm8903_controls, | 379 | .controls = tegra_wm8903_controls, |
367 | .num_controls = ARRAY_SIZE(tegra_wm8903_controls), | 380 | .num_controls = ARRAY_SIZE(tegra_wm8903_controls), |
368 | .dapm_widgets = tegra_wm8903_dapm_widgets, | 381 | .dapm_widgets = tegra_wm8903_dapm_widgets, |