aboutsummaryrefslogtreecommitdiffstats
path: root/bsp/pandaboard/OMAP-McPDM-Convert-McPDM-device-to-omap_device.patch
blob: b6fbf583c45a71672777e4ffc70e4f5dd3fdff21 (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
92
From bc06030c9db4bc6e4bc75207ffaa1c88dd833b93 Mon Sep 17 00:00:00 2001
From: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
Date: Sat, 12 Feb 2011 22:28:56 -0600
Subject: [PATCH 08/60] OMAP: McPDM: Convert McPDM device to omap_device

commit b4e3cdc3ac8b9ae1aeb20f1b52c3f7238ba65f6b upstream

McPDM device is converted to omap device.

Change-Id: Ifaa96a6396101d80bdce49c0c1d401be385f3708
Signed-off-by: Jorge Eduardo Candelaria <jorge.candelaria@ticom>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Integrated-by: Jingdong Lu <jingdong.lu@windriver.com>
---
 arch/arm/plat-omap/devices.c |   46 ++++++++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index ea28f98..0015759 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -27,6 +27,7 @@
 #include <mach/gpio.h>
 #include <plat/menelaus.h>
 #include <plat/mcbsp.h>
+#include <plat/mcpdm.h>
 #include <plat/omap44xx.h>
 
 /*-------------------------------------------------------------------------*/
@@ -77,31 +78,38 @@ void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
 #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
 		defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
 
-static struct resource mcpdm_resources[] = {
+static struct omap_device_pm_latency omap_mcpdm_latency[] = {
 	{
-		.name		= "mcpdm_mem",
-		.start		= OMAP44XX_MCPDM_BASE,
-		.end		= OMAP44XX_MCPDM_BASE + SZ_4K,
-		.flags		= IORESOURCE_MEM,
-	},
-	{
-		.name		= "mcpdm_irq",
-		.start		= OMAP44XX_IRQ_MCPDM,
-		.end		= OMAP44XX_IRQ_MCPDM,
-		.flags		= IORESOURCE_IRQ,
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func = omap_device_enable_hwmods,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
 	},
 };
 
-static struct platform_device omap_mcpdm_device = {
-	.name		= "omap-mcpdm",
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(mcpdm_resources),
-	.resource	= mcpdm_resources,
-};
-
 static void omap_init_mcpdm(void)
 {
-	(void) platform_device_register(&omap_mcpdm_device);
+	struct omap_hwmod *oh;
+	struct omap_device *od;
+	struct omap_mcpdm_platform_data *pdata;
+
+	oh = omap_hwmod_lookup("omap-mcpdm-dai");
+	if (!oh) {
+		printk(KERN_ERR "Could not look up mcpdm hw_mod\n");
+		return;
+	}
+
+	pdata = kzalloc(sizeof(struct omap_mcpdm_platform_data), GFP_KERNEL);
+	if (!pdata) {
+		printk(KERN_ERR "Could not allocate platform data\n");
+		return;
+	}
+
+	od = omap_device_build("omap-mcpdm-dai", -1, oh, pdata,
+				sizeof(struct omap_mcpdm_platform_data),
+				omap_mcpdm_latency,
+				ARRAY_SIZE(omap_mcpdm_latency), 0);
+	if (IS_ERR(od))
+		printk(KERN_ERR "Could not build omap_device for omap-mcpdm-dai\n");
 }
 #else
 static inline void omap_init_mcpdm(void) {}
-- 
1.7.4.1