ASoC: free jack GPIOs before the sound card is freed
[pandora-kernel.git] / sound / soc / samsung / smartq_wm8987.c
index c3b2ada..271a904 100644 (file)
@@ -162,8 +162,6 @@ static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd)
        snd_soc_dapm_nc_pin(dapm, "ROUT1");
 
        /* set endpoints to default off mode */
-       snd_soc_dapm_enable_pin(dapm, "Internal Speaker");
-       snd_soc_dapm_enable_pin(dapm, "Internal Mic");
        snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
 
        /* Headphone jack detection */
@@ -184,6 +182,14 @@ static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd)
        return err;
 }
 
+static int smartq_wm8987_card_remove(struct snd_soc_pcm_runtime *rtd)
+{
+       snd_soc_jack_free_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios),
+                               smartq_jack_gpios);
+
+       return 0;
+}
+
 static struct snd_soc_dai_link smartq_dai[] = {
        {
                .name           = "wm8987",
@@ -200,6 +206,7 @@ static struct snd_soc_dai_link smartq_dai[] = {
 static struct snd_soc_card snd_soc_smartq = {
        .name = "SmartQ",
        .owner = THIS_MODULE,
+       .remove = smartq_wm8987_card_remove,
        .dai_link = smartq_dai,
        .num_links = ARRAY_SIZE(smartq_dai),
 
@@ -261,8 +268,6 @@ err_unregister_device:
 static void __exit smartq_exit(void)
 {
        gpio_free(S3C64XX_GPK(12));
-       snd_soc_jack_free_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios),
-                               smartq_jack_gpios);
 
        platform_device_unregister(smartq_snd_device);
 }