aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-05-22 18:08:56 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-03 08:06:36 -0400
commite44fbbd45896e684d44391aaf881dd3e36bd1a16 (patch)
treedaebe04fd61db6e9f6b3ff093362696770728a6f /sound/soc/tegra
parente2d287c179a12a6069bc3b746e2e34edcddf81b3 (diff)
ASoC: tegra+wm8903: unconditionally free jack GPIOs in remove
The headphone jack GPIOs are added/initialized in the DAI link's init() method, and hence in theory may not always have been added before remove() is called in some unusual cases. In order to prevent calling snd_soc_jack_free_gpios() if snd_soc_jack_add_gpios() had not been, the code kept track of the initialization state to avoid the free call when necessary. However, it appears that snd_soc_jack_free_gpios() is robust in the face of being called without snd_soc_jack_add_gpios() first succeeding, so there is little point manually tracking this information. Hence, remove the tracking code. Almost all other machine drivers already operate this way. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra')
-rw-r--r--sound/soc/tegra/tegra_wm8903.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 5ef2063e0ab..9059525f3b0 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -50,12 +50,9 @@
50 50
51#define DRV_NAME "tegra-snd-wm8903" 51#define DRV_NAME "tegra-snd-wm8903"
52 52
53#define GPIO_HP_DET BIT(4)
54
55struct tegra_wm8903 { 53struct tegra_wm8903 {
56 struct tegra_wm8903_platform_data pdata; 54 struct tegra_wm8903_platform_data pdata;
57 struct tegra_asoc_utils_data util_data; 55 struct tegra_asoc_utils_data util_data;
58 int gpio_requested;
59}; 56};
60 57
61static int tegra_wm8903_hw_params(struct snd_pcm_substream *substream, 58static int tegra_wm8903_hw_params(struct snd_pcm_substream *substream,
@@ -252,7 +249,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
252 snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, 249 snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack,
253 1, 250 1,
254 &tegra_wm8903_hp_jack_gpio); 251 &tegra_wm8903_hp_jack_gpio);
255 machine->gpio_requested |= GPIO_HP_DET;
256 } 252 }
257 253
258 snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, 254 snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE,
@@ -458,10 +454,8 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev)
458 struct snd_soc_card *card = platform_get_drvdata(pdev); 454 struct snd_soc_card *card = platform_get_drvdata(pdev);
459 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 455 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
460 456
461 if (machine->gpio_requested & GPIO_HP_DET) 457 snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, 1,
462 snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, 458 &tegra_wm8903_hp_jack_gpio);
463 1,
464 &tegra_wm8903_hp_jack_gpio);
465 459
466 snd_soc_unregister_card(card); 460 snd_soc_unregister_card(card);
467 461