Skip to contentSkip to conversation

ASoC: add DMA platform driver for MX1x and MX2x

PATCH In review javier Martin 2 participants 2 messages Aug 4, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ASoC: add DMA platform driver for MX1x and MX2x

This adds support for DMA platform valid for i.MX1 and i.MX2 platforms.

This is not valid for i.MX3 since it doesn't share the same DMA interface than i.MX1 and i.MX2.

It has been tested on i.MX27 board.

---
 sound/soc/Makefile          |    1 +
 sound/soc/imx/Kconfig       |   11 +
 sound/soc/imx/Makefile      |    4 +
 sound/soc/imx/mx1_mx2-pcm.c |  487 +++++++++++++++++++++++++++++++++++++++++++
 sound/soc/imx/mx1_mx2-pcm.h |   48 +++++
 5 files changed, 551 insertions(+), 0 deletions(-)
sound/soc/Makefile +1 -0
index 0237879..8120b52 100644
@@ -11,3 +11,4 @@ obj-$(CONFIG_SND_SOC)	+= omap/
 obj-$(CONFIG_SND_SOC)	+= pxa/
 obj-$(CONFIG_SND_SOC)	+= s3c24xx/
 obj-$(CONFIG_SND_SOC)	+= sh/
+obj-$(CONFIG_SND_SOC)   += imx/
sound/soc/imx/Kconfig new file +11 -0
new file mode 100644
index 0000000..a1bf053
@@ -0,0 +1,11 @@
+config SND_MX1_MX2_SOC
+	tristate "SoC Audio for Freecale i.MX1x i.MX2x CPUs"
+	depends on (ARCH_MX2 || ARCH_MX1) && SND
+	select SND_PCM
+	help
+	  Say Y or M if you want to add support for codecs attached to
+	  the MX1 or MX2 SSI interface.
+
+
+
+
sound/soc/imx/Makefile new file +4 -0
new file mode 100644
index 0000000..c390f0f
@@ -0,0 +1,4 @@
+# i.MX Platform Support
+snd-soc-mx1_mx2-objs := mx1_mx2-pcm.o
+
+obj-$(CONFIG_SND_MX1_MX2_SOC) += snd-soc-mx1_mx2.o
sound/soc/imx/mx1_mx2-pcm.c new file +487 -0

487 lines not on this page · raw message

sound/soc/imx/mx1_mx2-pcm.h new file +48 -0

48 lines not on this page · raw message

--

Signature · 8 lines
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#1 lore raw
Quoted 8 lines · javier Martin

This adds support for DMA platform valid for i.MX1 and i.MX2 platforms.

This is not valid for i.MX3 since it doesn't share the same DMA interface than i.MX1 and i.MX2.

It has been tested on i.MX27 board.

This looks basically good. I'll need to check to make sure it's up to date against the more current code but if there's anything wrong there it'll be fairly minor stuff.

sound/soc/imx/Kconfig line 3

Quoted 1 line
sound/soc/imx/Kconfig new file +1 -0
+	depends on (ARCH_MX2 || ARCH_MX1) && SND

No need to depend on SND, the menu will stop the configuration being visible if it's not selected.

sound/soc/imx/mx1_mx2-pcm.c line 131

Quoted 7 lines
sound/soc/imx/mx1_mx2-pcm.c new file +7 -0
+		ret = imx_dma_setup_single(prtd->dma_ch, mem_addr,
+					dma_size, dev_addr,
+					prtd->dma_params->transfer_type);
+		if (ret < 0) {
+			printk(KERN_ERR "Error configuring DMA\n");
+			return ret;
+		}

It'd be nice to print out ret here - the same thing applies in quite a few other places in the driver.

Quoted 14 lines
sound/soc/imx/mx1_mx2-pcm.h new file +14 -0
+#ifndef _MXC_PCM_H
+#define _MXC_PCM_H
+
+/* AUDMUX register definitions */
+#define AUDMUX_IO_BASE_ADDR	IO_ADDRESS(AUDMUX_BASE_ADDR)
+
+#define DAM_HPCR1	(*((volatile u32 *)(AUDMUX_IO_BASE_ADDR + 0x00)))
+#define DAM_HPCR2	(*((volatile u32 *)(AUDMUX_IO_BASE_ADDR + 0x04)))
+#define DAM_HPCR3	(*((volatile u32 *)(AUDMUX_IO_BASE_ADDR + 0x08)))
+#define DAM_PPCR1	(*((volatile u32 *)(AUDMUX_IO_BASE_ADDR + 0x10)))
+#define DAM_PPCR2	(*((volatile u32 *)(AUDMUX_IO_BASE_ADDR + 0x14)))
+#define DAM_PPCR3	(*((volatile u32 *)(AUDMUX_IO_BASE_ADDR + 0x1C)))
+
+#define AUDMUX_HPCR_TFSDIR	(1 << 31)

sound/soc/imx/mx1_mx2-pcm.h line 32

Quoted 10 lines
sound/soc/imx/mx1_mx2-pcm.h new file +10 -0
+#define AUDMUX_HPCR_TCLKDIR	(1 << 30)
+#define AUDMUX_HPCR_TFCSEL(x)	(((x) & 0xff) << 26)
+#define AUDMUX_HPCR_RXDSEL(x)	(((x) & 0x7) << 13)
+#define AUDMUX_HPCR_SYN		(1 << 12)
+
+#define AUDMUX_PPCR_TFSDIR	(1 << 31)
+#define AUDMUX_PPCR_TCLKDIR	(1 << 30)
+#define AUDMUX_PPCR_TFCSEL(x)	(((x) & 0xff) << 26)
+#define AUDMUX_PPCR_RXDSEL(x)	(((x) & 0x7) << 13)
+#define AUDMUX_PPCR_SYN		(1 << 12)

Hrm. I suspect these should be under arch/arm somewhere; they're not actually used by this driver so could be removed.