From bc06030c9db4bc6e4bc75207ffaa1c88dd833b93 Mon Sep 17 00:00:00 2001 From: Jorge Eduardo Candelaria 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 Signed-off-by: Liam Girdwood Signed-off-by: Misael Lopez Cruz Signed-off-by: Margarita Olaya Cabrera Integrated-by: Jingdong Lu --- 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 #include #include +#include #include /*-------------------------------------------------------------------------*/ @@ -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