Skip to contentSkip to conversation

ARM: DaVinci: ASoC: Add the platform devices for ASP

PATCH In review [email protected] 2 participants 2 messages Apr 2, 2009

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

PATCH 3/5 ARM: DaVinci: ASoC: Add the platform devices for ASP

From: Naresh Medisetty <[email protected]>

Registers the platform devices for ASP on dm355, dm644x and dm646x so that the machine driver can probe to get ASP related platform data.

---
This patch applies to the DaVinci git tree available at
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-davinci.git

 arch/arm/mach-davinci/dm355.c            |   24 +++++++++++
 arch/arm/mach-davinci/dm644x.c           |   24 +++++++++++
 arch/arm/mach-davinci/dm646x.c           |   67 ++++++++++++++++++++++++++++++
 arch/arm/mach-davinci/include/mach/asp.h |   39 ++++++++++++++++-
 4 files changed, 152 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/dm355.c +24 -0
index ee92c10..b79e9ac 100644
@@ -23,6 +23,7 @@
 #include <mach/psc.h>
 #include <mach/mux.h>
 #include <mach/irqs.h>
+#include <mach/asp.h>
 
 #include "clock.h"
 #include "mux.h"
@@ -540,6 +541,28 @@ static struct platform_device dm355_edma_device = {
 	.resource		= edma_resources,
 };
 
+/* DM335 EVM uses ASP1; line-out is a stereo mini-jack */
+static struct resource dm355_evm_snd_resources[] = {
+	{
+		.start	= DAVINCI_ASP1_BASE,
+		.end	= DAVINCI_ASP1_BASE + SZ_8K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct evm_snd_platform_data dm355_evm_snd_data = {
+	.tx_dma_ch	= DAVINCI_DMA_ASP1_TX,
+	.rx_dma_ch	= DAVINCI_DMA_ASP1_RX,
+};
+
+static struct platform_device dm355_asoc_device = {
+	.name				= "davinci-asoc",
+	.id					= -1,
+	.dev.platform_data	= &dm355_evm_snd_data,
+	.num_resources		= ARRAY_SIZE(dm355_evm_snd_resources),
+	.resource			= dm355_evm_snd_resources,
+};
+
 /*----------------------------------------------------------------------*/
 
 void __init dm355_init(void)
@@ -555,6 +578,7 @@ static int __init dm355_init_devices(void)
 
 	davinci_cfg_reg(DM355_INT_EDMA_CC);
 	platform_device_register(&dm355_edma_device);
+	platform_device_register(&dm355_asoc_device);
 	return 0;
 }
 postcore_initcall(dm355_init_devices);
arch/arm/mach-davinci/dm644x.c +24 -0
index d1f5790..8921c4f 100644
@@ -20,6 +20,7 @@
 #include <mach/irqs.h>
 #include <mach/psc.h>
 #include <mach/mux.h>
+#include <mach/asp.h>
 
 #include "clock.h"
 #include "mux.h"
@@ -463,6 +464,28 @@ static struct platform_device dm644x_edma_device = {
 	.resource		= edma_resources,
 };
 
+/* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */
+static struct resource dm644x_evm_snd_resources[] = {
+	{
+		.start	= DAVINCI_ASP0_BASE,
+		.end	= DAVINCI_ASP0_BASE + SZ_8K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct evm_snd_platform_data dm644x_evm_snd_data = {
+	.tx_dma_ch	= DAVINCI_DMA_ASP0_TX,
+	.rx_dma_ch	= DAVINCI_DMA_ASP0_RX,
+};
+
+static struct platform_device dm644x_asoc_device = {
+	.name				= "davinci-asoc",
+	.id					= -1,
+	.dev.platform_data	= &dm644x_evm_snd_data,
+	.num_resources		= ARRAY_SIZE(dm644x_evm_snd_resources),
+	.resource			= dm644x_evm_snd_resources,
+};
+
 /*----------------------------------------------------------------------*/
 #if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
 
@@ -495,6 +518,7 @@ static int __init dm644x_init_devices(void)
 		return 0;
 
 	platform_device_register(&dm644x_edma_device);
+	platform_device_register(&dm644x_asoc_device);
 	return 0;
 }
 postcore_initcall(dm644x_init_devices);
arch/arm/mach-davinci/dm646x.c +67 -0

85 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/asp.h +37 -2
index e0abc43..1bb1f0b 100644
@@ -5,21 +5,56 @@
 #define __ASM_ARCH_DAVINCI_ASP_H
 
 #include <mach/irqs.h>
+#include <mach/edma.h>
 
-/* Bases of register banks */
+/* Bases of dm644x and dm355 register banks */
 #define DAVINCI_ASP0_BASE	0x01E02000
 #define DAVINCI_ASP1_BASE	0x01E04000
 
-/* EDMA channels */
+
+/* Bases of dm646x register banks */
+#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
+#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
+
+/* EDMA channels of dm644x and dm355 */
 #define DAVINCI_DMA_ASP0_TX	2
 #define DAVINCI_DMA_ASP0_RX	3
 #define DAVINCI_DMA_ASP1_TX	8
 #define DAVINCI_DMA_ASP1_RX	9
 
+
+/* EDMA channels of dm646x */
+#define	DAVINCI_DM646X_DMA_MCASP0_AXEVT0	6
+#define	DAVINCI_DM646X_DMA_MCASP0_AREVT0	9
+#define	DAVINCI_DM646X_DMA_MCASP1_AXEVT1	12
 /* Interrupts */
 #define DAVINCI_ASP0_RX_INT	IRQ_MBRINT
 #define DAVINCI_ASP0_TX_INT	IRQ_MBXINT
 #define DAVINCI_ASP1_RX_INT	IRQ_MBRINT
 #define DAVINCI_ASP1_TX_INT	IRQ_MBXINT
 
+struct evm_snd_platform_data {
+	char *clk_name;
+	int tx_dma_ch;
+	int rx_dma_ch;
+	u32 tx_dma_offset;
+	u32 rx_dma_offset;
+	enum dma_event_q eventq_no;	/* event queue number */
+	unsigned int codec_fmt;
+
+	/* McASP specific fields */
+	int tdm_slots;
+	u8 op_mode;
+	u8 num_serializer;
+	u8 *serial_dir;
+};
+
+#define INACTIVE_MODE	0
+#define TX_MODE		1
+#define RX_MODE		2
+
+#define DAVINCI_MCASP_IIS_MODE	0
+#define DAVINCI_MCASP_DIT_MODE	1
+
+
 #endif /* __ASM_ARCH_DAVINCI_ASP_H */
Signature · 1 line
1.5.6
#1 lore raw
Quoted 2 lines · On Thu, Apr 02, 2009 at 09:49:31PM -0400, [email protected] wrote:

Registers the platform devices for ASP on dm355, dm644x and dm646x so that the machine driver can probe to get ASP related platform data.

Registering the platform data like this is a good change. However, it looks like you're using this to probe the machine driver rather than the ASoC DAI or platform drivers.

The structure ought to be that instead of calling snd_soc_register_dai() in the module_init() function the McASP drivers register platform drivers for themselves there. Then the resources can be acquired and snd_soc_register_dai() called in the probe function of the driver, meaning the machine driver doesn't need to get involved in passing the data around at all.