aboutsummaryrefslogtreecommitdiffstats
path: root/bsp/pandaboard/ASoC-McPDM-ioremap-McPDM-memory-to-allow-module-comp.patch
blob: d19b0d8c9594d4bfbc44ac27c21d3a6b33d6d184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
From 27f0df72381a03a0b657ee32d567484b159a82f7 Mon Sep 17 00:00:00 2001
From: Misael Lopez Cruz <misael.lopez@ti.com>
Date: Wed, 23 Feb 2011 12:20:19 -0600
Subject: [PATCH 40/60] ASoC: McPDM: ioremap McPDM memory to allow module compilation

commit 3e21e349b1f9d25af0feb4fe52d44f43b6e30d53 upstream

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>
Integrated-by: Jingdong Lu <jingdong.lu@windriver.com>
---
 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 80858e0..3eff7d6 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;
-- 
1.7.4.1