mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
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>
This commit is contained in:
parent
e2d287c179
commit
e44fbbd458
1 changed files with 2 additions and 8 deletions
|
@ -50,12 +50,9 @@
|
|||
|
||||
#define DRV_NAME "tegra-snd-wm8903"
|
||||
|
||||
#define GPIO_HP_DET BIT(4)
|
||||
|
||||
struct tegra_wm8903 {
|
||||
struct tegra_wm8903_platform_data pdata;
|
||||
struct tegra_asoc_utils_data util_data;
|
||||
int gpio_requested;
|
||||
};
|
||||
|
||||
static 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)
|
|||
snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack,
|
||||
1,
|
||||
&tegra_wm8903_hp_jack_gpio);
|
||||
machine->gpio_requested |= GPIO_HP_DET;
|
||||
}
|
||||
|
||||
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)
|
|||
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
|
||||
|
||||
if (machine->gpio_requested & GPIO_HP_DET)
|
||||
snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack,
|
||||
1,
|
||||
&tegra_wm8903_hp_jack_gpio);
|
||||
snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, 1,
|
||||
&tegra_wm8903_hp_jack_gpio);
|
||||
|
||||
snd_soc_unregister_card(card);
|
||||
|
||||
|
|
Loading…
Reference in a new issue