From df8dce9766bdbca1dc91dbba694ff4e9d3785b86 Mon Sep 17 00:00:00 2001 From: Gary Zhang Date: Fri, 26 Oct 2012 16:16:56 +0800 Subject: [PATCH] ENGR00231321-2 wm8962: enhance audio driver 1. correct indent issue 2. when driver is unloaded, remove disable clock operateion and free irq Signed-off-by: Gary Zhang --- sound/soc/imx/imx-wm8962.c | 42 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/sound/soc/imx/imx-wm8962.c b/sound/soc/imx/imx-wm8962.c index b13f68f2647b..04aca39ab2d5 100644 --- a/sound/soc/imx/imx-wm8962.c +++ b/sound/soc/imx/imx-wm8962.c @@ -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; } -- 2.39.5