diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2011-04-07 08:39:45 +0100 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-04-07 08:39:45 +0100 |
commit | 441a1261f115b163cf8a2cfb5610e61ccd3c51fa (patch) | |
tree | f7e52da486dba666da217d1a523c48c80a5cd364 /sound/soc | |
parent | 87200802e5e5611ce71dff0cb74bb891fb3dae65 (diff) |
ASoC: McPDM: ioremap McPDM memory to allow module compilation
omap_hwmod_get_mpu_rt_va cannot be used if the driver is compiled
as a module, McPDM memory is ioremap'ed explicitly instead.
Change-Id: Idd05c536a80eae7223d27cccc2b925fda4a22dc1
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 80858e0cfef..3eff7d62ae5 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -874,15 +874,9 @@ static struct snd_soc_dai_driver omap_mcpdm_dai[] = { static __devinit int asoc_mcpdm_probe(struct platform_device *pdev) { struct omap_mcpdm *mcpdm; - struct omap_hwmod *oh; + struct resource *res; int ret = 0; - oh = omap_hwmod_lookup("omap-mcpdm-dai"); - if (oh == NULL) { - dev_err(&pdev->dev, "no hwmod device found\n"); - return -ENODEV; - } - mcpdm = kzalloc(sizeof(struct omap_mcpdm), GFP_KERNEL); if (!mcpdm) return -ENOMEM; @@ -894,7 +888,14 @@ static __devinit int asoc_mcpdm_probe(struct platform_device *pdev) mutex_init(&mcpdm->mutex); mcpdm->free = 1; - mcpdm->io_base = omap_hwmod_get_mpu_rt_va(oh); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res == NULL) { + dev_err(&pdev->dev, "no resource\n"); + ret = -EINVAL; + goto err; + } + + mcpdm->io_base = ioremap(res->start, resource_size(res)); if (!mcpdm->io_base) { ret = -ENOMEM; goto err; @@ -903,7 +904,7 @@ static __devinit int asoc_mcpdm_probe(struct platform_device *pdev) mcpdm->irq = platform_get_irq(pdev, 0); if (mcpdm->irq < 0) { ret = mcpdm->irq; - goto err; + goto err_irq; } pm_runtime_enable(&pdev->dev); @@ -921,9 +922,13 @@ 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) - return 0; + if (ret < 0) + goto err_irq; + + return 0; +err_irq: + iounmap(mcpdm->io_base); err: kfree(mcpdm); return ret; @@ -934,6 +939,7 @@ static int __devexit asoc_mcpdm_remove(struct platform_device *pdev) struct omap_mcpdm *mcpdm = platform_get_drvdata(pdev); snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(omap_mcpdm_dai)); + iounmap(mcpdm->io_base); pm_runtime_put_sync(&pdev->dev); kfree(mcpdm); return 0; |