]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00231321-2 wm8962: enhance audio driver
authorGary Zhang <b13634@freescale.com>
Fri, 26 Oct 2012 08:16:56 +0000 (16:16 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:37 +0000 (08:35 +0200)
1. correct indent issue
2. when driver is unloaded, remove disable clock operateion and free irq

Signed-off-by: Gary Zhang <b13634@freescale.com>
sound/soc/imx/imx-wm8962.c

index b13f68f2647b312bf8d0296b12efc6e00115580b..04aca39ab2d57205768097d91130730f93fbf732 100644 (file)
@@ -324,25 +324,25 @@ static int imx_wm8962_init(struct snd_soc_pcm_runtime *rtd)
        snd_soc_dapm_sync(&codec->dapm);
 
        if (plat->hp_gpio != -1) {
-                       priv->hp_irq = gpio_to_irq(plat->hp_gpio);
-
-                       ret = request_irq(priv->hp_irq,
-                                               imx_headphone_detect_handler,
-                                               IRQ_TYPE_EDGE_BOTH, pdev->name, priv);
-
-                       if (ret < 0) {
-                               ret = -EINVAL;
-                               return ret;
-                       }
-
-                       ret = driver_create_file(pdev->dev.driver,
-                                                       &driver_attr_headphone);
-                       if (ret < 0) {
-                               ret = -EINVAL;
-                               return ret;
-                       }
+               priv->hp_irq = gpio_to_irq(plat->hp_gpio);
+
+               ret = request_irq(priv->hp_irq,
+                                       imx_headphone_detect_handler,
+                                       IRQ_TYPE_EDGE_BOTH, pdev->name, priv);
+
+               if (ret < 0) {
+                       ret = -EINVAL;
+                       return ret;
                }
 
+               ret = driver_create_file(pdev->dev.driver,
+                                               &driver_attr_headphone);
+               if (ret < 0) {
+                       ret = -EINVAL;
+                       return ret;
+               }
+       }
+
        if (plat->mic_gpio != -1) {
                priv->amic_irq = gpio_to_irq(plat->mic_gpio);
 
@@ -447,12 +447,16 @@ static int __devinit imx_wm8962_probe(struct platform_device *pdev)
 static int __devexit imx_wm8962_remove(struct platform_device *pdev)
 {
        struct mxc_audio_platform_data *plat = pdev->dev.platform_data;
-
-       plat->clock_enable(0);
+       struct imx_priv *priv = &card_priv;
 
        if (plat->finit)
                plat->finit();
 
+       if (priv->hp_irq)
+               free_irq(priv->hp_irq, priv);
+       if (priv->amic_irq)
+               free_irq(priv->amic_irq, priv);
+
        return 0;
 }