linux-3.0.x for AP-SH4A-0A Board
Révision | cbdeede6a6725dcc13f1a1dc1fc1d1ebe238c7fd (tree) |
---|---|
l'heure | 2011-08-18 02:55:53 |
Auteur | Stephen Warren <swarren@nvid...> |
Commiter | Greg Kroah-Hartman |
ASoC: Tegra: wm8903 machine driver: Allow re-insertion of module
commit 29591ed4ac6fe00e3ff23b5be0cdc7016ef9c47e upstream.
Two issues were preventing module snd-soc-tegra-wm8903.ko from being
removed and re-inserted:
a) The speaker-enable GPIO is hosted by the WM8903 chip. This GPIO must
b) We need to call snd_soc_jack_free_gpios() to match the call to
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
@@ -56,6 +56,7 @@ | ||
56 | 56 | #define GPIO_HP_MUTE BIT(1) |
57 | 57 | #define GPIO_INT_MIC_EN BIT(2) |
58 | 58 | #define GPIO_EXT_MIC_EN BIT(3) |
59 | +#define GPIO_HP_DET BIT(4) | |
59 | 60 | |
60 | 61 | struct tegra_wm8903 { |
61 | 62 | struct tegra_asoc_utils_data util_data; |
@@ -304,6 +305,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) | ||
304 | 305 | snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, |
305 | 306 | 1, |
306 | 307 | &tegra_wm8903_hp_jack_gpio); |
308 | + machine->gpio_requested |= GPIO_HP_DET; | |
307 | 309 | } |
308 | 310 | |
309 | 311 | snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, |
@@ -429,10 +431,10 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) | ||
429 | 431 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
430 | 432 | struct tegra_wm8903_platform_data *pdata = machine->pdata; |
431 | 433 | |
432 | - snd_soc_unregister_card(card); | |
433 | - | |
434 | - tegra_asoc_utils_fini(&machine->util_data); | |
435 | - | |
434 | + if (machine->gpio_requested & GPIO_HP_DET) | |
435 | + snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, | |
436 | + 1, | |
437 | + &tegra_wm8903_hp_jack_gpio); | |
436 | 438 | if (machine->gpio_requested & GPIO_EXT_MIC_EN) |
437 | 439 | gpio_free(pdata->gpio_ext_mic_en); |
438 | 440 | if (machine->gpio_requested & GPIO_INT_MIC_EN) |
@@ -441,6 +443,11 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) | ||
441 | 443 | gpio_free(pdata->gpio_hp_mute); |
442 | 444 | if (machine->gpio_requested & GPIO_SPKR_EN) |
443 | 445 | gpio_free(pdata->gpio_spkr_en); |
446 | + machine->gpio_requested = 0; | |
447 | + | |
448 | + snd_soc_unregister_card(card); | |
449 | + | |
450 | + tegra_asoc_utils_fini(&machine->util_data); | |
444 | 451 | |
445 | 452 | kfree(machine); |
446 | 453 |