aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-05-22 18:09:52 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-03 08:06:37 -0400
commit9f6328d910ef8df8176ed433aa2de037eba1f656 (patch)
tree383854c3d9f738acafc04dd4b25ed6c45504f4a3 /sound/soc/tegra
parentaef9a37c01a63a132d43d65d231dfe515d0f918a (diff)
ASoC: tegra+alc5632: 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. 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_alc5632.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c
index facf6f00c6b0..15669570ae31 100644
--- a/sound/soc/tegra/tegra_alc5632.c
+++ b/sound/soc/tegra/tegra_alc5632.c
@@ -33,11 +33,8 @@
33 33
34#define DRV_NAME "tegra-alc5632" 34#define DRV_NAME "tegra-alc5632"
35 35
36#define GPIO_HP_DET BIT(0)
37
38struct tegra_alc5632 { 36struct tegra_alc5632 {
39 struct tegra_asoc_utils_data util_data; 37 struct tegra_asoc_utils_data util_data;
40 int gpio_requested;
41 int gpio_hp_det; 38 int gpio_hp_det;
42}; 39};
43 40
@@ -123,7 +120,6 @@ static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd)
123 snd_soc_jack_add_gpios(&tegra_alc5632_hs_jack, 120 snd_soc_jack_add_gpios(&tegra_alc5632_hs_jack,
124 1, 121 1,
125 &tegra_alc5632_hp_jack_gpio); 122 &tegra_alc5632_hp_jack_gpio);
126 machine->gpio_requested |= GPIO_HP_DET;
127 } 123 }
128 124
129 snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); 125 snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
@@ -236,11 +232,8 @@ static int __devexit tegra_alc5632_remove(struct platform_device *pdev)
236 struct snd_soc_card *card = platform_get_drvdata(pdev); 232 struct snd_soc_card *card = platform_get_drvdata(pdev);
237 struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card); 233 struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card);
238 234
239 if (machine->gpio_requested & GPIO_HP_DET) 235 snd_soc_jack_free_gpios(&tegra_alc5632_hs_jack, 1,
240 snd_soc_jack_free_gpios(&tegra_alc5632_hs_jack, 236 &tegra_alc5632_hp_jack_gpio);
241 1,
242 &tegra_alc5632_hp_jack_gpio);
243 machine->gpio_requested = 0;
244 237
245 snd_soc_unregister_card(card); 238 snd_soc_unregister_card(card);
246 239