diff options
Diffstat (limited to 'sound/soc/tegra/tegra_wm8903.c')
-rw-r--r-- | sound/soc/tegra/tegra_wm8903.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index a42e9ac30f28..be27f1d229af 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #define GPIO_HP_MUTE BIT(1) | 56 | #define GPIO_HP_MUTE BIT(1) |
57 | #define GPIO_INT_MIC_EN BIT(2) | 57 | #define GPIO_INT_MIC_EN BIT(2) |
58 | #define GPIO_EXT_MIC_EN BIT(3) | 58 | #define GPIO_EXT_MIC_EN BIT(3) |
59 | #define GPIO_HP_DET BIT(4) | ||
59 | 60 | ||
60 | struct tegra_wm8903 { | 61 | struct tegra_wm8903 { |
61 | struct tegra_asoc_utils_data util_data; | 62 | struct tegra_asoc_utils_data util_data; |
@@ -304,6 +305,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) | |||
304 | snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, | 305 | snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, |
305 | 1, | 306 | 1, |
306 | &tegra_wm8903_hp_jack_gpio); | 307 | &tegra_wm8903_hp_jack_gpio); |
308 | machine->gpio_requested |= GPIO_HP_DET; | ||
307 | } | 309 | } |
308 | 310 | ||
309 | snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, | 311 | snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, |
@@ -317,7 +319,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) | |||
317 | snd_soc_dapm_force_enable_pin(dapm, "Mic Bias"); | 319 | snd_soc_dapm_force_enable_pin(dapm, "Mic Bias"); |
318 | 320 | ||
319 | /* FIXME: Calculate automatically based on DAPM routes? */ | 321 | /* FIXME: Calculate automatically based on DAPM routes? */ |
320 | if (!machine_is_harmony() && !machine_is_ventana()) | 322 | if (!machine_is_harmony()) |
321 | snd_soc_dapm_nc_pin(dapm, "IN1L"); | 323 | snd_soc_dapm_nc_pin(dapm, "IN1L"); |
322 | if (!machine_is_seaboard() && !machine_is_aebl()) | 324 | if (!machine_is_seaboard() && !machine_is_aebl()) |
323 | snd_soc_dapm_nc_pin(dapm, "IN1R"); | 325 | snd_soc_dapm_nc_pin(dapm, "IN1R"); |
@@ -393,7 +395,7 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) | |||
393 | platform_set_drvdata(pdev, card); | 395 | platform_set_drvdata(pdev, card); |
394 | snd_soc_card_set_drvdata(card, machine); | 396 | snd_soc_card_set_drvdata(card, machine); |
395 | 397 | ||
396 | if (machine_is_harmony() || machine_is_ventana()) { | 398 | if (machine_is_harmony()) { |
397 | card->dapm_routes = harmony_audio_map; | 399 | card->dapm_routes = harmony_audio_map; |
398 | card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map); | 400 | card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map); |
399 | } else if (machine_is_seaboard()) { | 401 | } else if (machine_is_seaboard()) { |
@@ -429,10 +431,10 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) | |||
429 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); | 431 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
430 | struct tegra_wm8903_platform_data *pdata = machine->pdata; | 432 | struct tegra_wm8903_platform_data *pdata = machine->pdata; |
431 | 433 | ||
432 | snd_soc_unregister_card(card); | 434 | if (machine->gpio_requested & GPIO_HP_DET) |
433 | 435 | snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, | |
434 | tegra_asoc_utils_fini(&machine->util_data); | 436 | 1, |
435 | 437 | &tegra_wm8903_hp_jack_gpio); | |
436 | if (machine->gpio_requested & GPIO_EXT_MIC_EN) | 438 | if (machine->gpio_requested & GPIO_EXT_MIC_EN) |
437 | gpio_free(pdata->gpio_ext_mic_en); | 439 | gpio_free(pdata->gpio_ext_mic_en); |
438 | if (machine->gpio_requested & GPIO_INT_MIC_EN) | 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 | gpio_free(pdata->gpio_hp_mute); | 443 | gpio_free(pdata->gpio_hp_mute); |
442 | if (machine->gpio_requested & GPIO_SPKR_EN) | 444 | if (machine->gpio_requested & GPIO_SPKR_EN) |
443 | gpio_free(pdata->gpio_spkr_en); | 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 | kfree(machine); | 452 | kfree(machine); |
446 | 453 | ||