summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2011-05-31 09:23:17 +0100
committerAndy Green <andy.green@linaro.org>2011-05-31 11:04:45 +0100
commit0fc3eb0654c13580a4a4d01306c41fa682101131 (patch)
treef4e4d34fe6d88624169ff7be386fadc908b84551 /sound
parent5ac695688903ebbfa29e0ce947bfb0d6f7bb622e (diff)
ASoC: McPDM: Avoid multiple irq request/free
McPDM irq request and free was associated to mcpdm_request and mcpdm_free APIs, which are called when audio stream is opened and closed, respectively. These multiple calls are unnecessary as irq can be requested when driver is probed and released during driver removal. Change-Id: I3afcae888eb0baffd8a3f85878e30b61c70c73c8 Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/omap-mcpdm.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index f2e6ac36f4c..a68546d228a 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -417,22 +417,20 @@ static int omap_mcpdm_request(struct omap_mcpdm *mcpdm)
{
struct platform_device *pdev;
struct omap_mcpdm_platform_data *pdata;
- int ret;
int ctrl;
int attemps = 0;
pdev = to_platform_device(mcpdm->dev);
pdata = pdev->dev.platform_data;
- pm_runtime_get_sync(&pdev->dev);
-
if (!mcpdm->free) {
dev_err(mcpdm->dev, "McPDM interface is in use\n");
- ret = -EBUSY;
- goto err;
+ return -EBUSY;
}
mcpdm->free = 0;
+ pm_runtime_get_sync(&pdev->dev);
+
/* Perform SW RESET of McPDM IP */
ctrl = omap_mcpdm_read(mcpdm, MCPDM_SYSCONFIG);
ctrl |= MCPDM_SOFTRESET;
@@ -448,13 +446,6 @@ static int omap_mcpdm_request(struct omap_mcpdm *mcpdm)
/* Disable lines while request is ongoing */
omap_mcpdm_write(mcpdm, MCPDM_CTRL, 0x00);
- ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler,
- 0, "McPDM", (void *)mcpdm);
- if (ret) {
- dev_err(mcpdm->dev, "Request for McPDM IRQ failed\n");
- goto err;
- }
-
if (omap_rev() != OMAP4430_REV_ES1_0) {
/* Enable McPDM watch dog for ES above ES 1.0 to avoid saturation */
ctrl = omap_mcpdm_read(mcpdm, MCPDM_CTRL);
@@ -463,10 +454,6 @@ static int omap_mcpdm_request(struct omap_mcpdm *mcpdm)
}
return 0;
-
-err:
- pm_runtime_put_sync(&pdev->dev);
- return ret;
}
static void omap_mcpdm_free(struct omap_mcpdm *mcpdm)
@@ -484,8 +471,6 @@ static void omap_mcpdm_free(struct omap_mcpdm *mcpdm)
mcpdm->free = 1;
pm_runtime_put_sync(&pdev->dev);
-
- free_irq(mcpdm->irq, (void *)mcpdm);
}
/* Enable/disable DC offset cancelation for the analog
@@ -907,6 +892,13 @@ static __devinit int asoc_mcpdm_probe(struct platform_device *pdev)
goto err_irq;
}
+ ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler,
+ 0, "McPDM", mcpdm);
+ if (ret) {
+ dev_err(mcpdm->dev, "Request for McPDM IRQ failed: %d\n", ret);
+ goto err_irq;
+ }
+
pm_runtime_enable(&pdev->dev);
mcpdm->dev = &pdev->dev;
@@ -923,10 +915,12 @@ static __devinit int asoc_mcpdm_probe(struct platform_device *pdev)
ret = snd_soc_register_dais(&pdev->dev, omap_mcpdm_dai,
ARRAY_SIZE(omap_mcpdm_dai));
if (ret < 0)
- goto err_irq;
+ goto err_dai;
return 0;
+err_dai:
+ free_irq(mcpdm->irq, mcpdm);
err_irq:
iounmap(mcpdm->io_base);
err:
@@ -940,7 +934,7 @@ static int __devexit asoc_mcpdm_remove(struct platform_device *pdev)
snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(omap_mcpdm_dai));
iounmap(mcpdm->io_base);
- pm_runtime_put_sync(&pdev->dev);
+ free_irq(mcpdm->irq, mcpdm);
kfree(mcpdm);
return 0;
}