OMAP: AESS: Add omap_device for AESS
Register Audio Engine Subsystem (AESS) device through omap
device framework.
Change-Id: Ia0b380544730c11c25207eb8b50892b52351c0b5
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 53c6bb1..a66a468 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -16,11 +16,14 @@
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/memblock.h>
+#include <linux/err.h>
#include <mach/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/map.h>
+#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
#include <plat/tc.h>
#include <plat/board.h>
#include <plat/mmc.h>
@@ -30,6 +33,8 @@
#include <plat/mcpdm.h>
#include <plat/omap44xx.h>
+#include <sound/omap-abe-dsp.h>
+
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
@@ -201,6 +206,55 @@
/*-------------------------------------------------------------------------*/
+#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP) || \
+ defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE)
+
+static struct omap_device_pm_latency omap_aess_latency[] = {
+ {
+ .deactivate_func = omap_device_idle_hwmods,
+ .activate_func = omap_device_enable_hwmods,
+ .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+ },
+};
+
+static void omap_init_aess(void)
+{
+ struct omap_hwmod *oh;
+ struct omap_device *od;
+ struct omap4_abe_dsp_pdata *pdata;
+
+ oh = omap_hwmod_lookup("aess");
+ if (!oh) {
+ printk (KERN_ERR "Could not look up aess hw_mod\n");
+ return;
+ }
+
+ pdata = kzalloc(sizeof(struct omap4_abe_dsp_pdata), GFP_KERNEL);
+ if (!pdata) {
+ printk(KERN_ERR "Could not allocate platform data\n");
+ return;
+ }
+
+ /* FIXME: Add correct context loss counter */
+ //pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
+ od = omap_device_build("aess", -1, oh, pdata,
+ sizeof(struct omap4_abe_dsp_pdata),
+ omap_aess_latency,
+ ARRAY_SIZE(omap_aess_latency), 0);
+
+ kfree(pdata);
+
+ if (IS_ERR(od))
+ printk(KERN_ERR "Could not build omap_device for omap-aess-audio\n");
+}
+#else
+static inline void omap_init_aess(void) {}
+#endif
+
+
+/*-------------------------------------------------------------------------*/
+
#if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
#ifdef CONFIG_ARCH_OMAP2
@@ -232,8 +286,6 @@
static inline void omap_init_rng(void) {}
#endif
-/*-------------------------------------------------------------------------*/
-
/* Numbering for the SPI-capable controllers when used for SPI:
* spi = 1
* uwire = 2
@@ -335,6 +387,7 @@
omap_init_rng();
omap_init_dmic();
omap_init_mcpdm();
+ omap_init_aess();
omap_init_uwire();
return 0;
}