Commit 185717e1 authored by Sudhakar Rajashekhara's avatar Sudhakar Rajashekhara Committed by Kevin Hilman

davinci: EDMA: interface changes visible to EDMA clients

Introduce macros to build IDs from controller and channel number, and to
extract them. Modify the edma_alloc_slot function to take an extra argument
for the controller.

Also update ASoC drivers to use API.  ASoC changes
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSudhakar Rajashekhara <sudhakar.raj@ti.com>
Reviewed-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 6d4f40d8
...@@ -82,10 +82,10 @@ static struct resource mmcsd0_resources[] = { ...@@ -82,10 +82,10 @@ static struct resource mmcsd0_resources[] = {
}, },
/* DMA channels: RX, then TX */ /* DMA channels: RX, then TX */
{ {
.start = DAVINCI_DMA_MMCRXEVT, .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT),
.flags = IORESOURCE_DMA, .flags = IORESOURCE_DMA,
}, { }, {
.start = DAVINCI_DMA_MMCTXEVT, .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCTXEVT),
.flags = IORESOURCE_DMA, .flags = IORESOURCE_DMA,
}, },
}; };
...@@ -119,10 +119,10 @@ static struct resource mmcsd1_resources[] = { ...@@ -119,10 +119,10 @@ static struct resource mmcsd1_resources[] = {
}, },
/* DMA channels: RX, then TX */ /* DMA channels: RX, then TX */
{ {
.start = 30, /* rx */ .start = EDMA_CTLR_CHAN(0, 30), /* rx */
.flags = IORESOURCE_DMA, .flags = IORESOURCE_DMA,
}, { }, {
.start = 31, /* tx */ .start = EDMA_CTLR_CHAN(0, 31), /* tx */
.flags = IORESOURCE_DMA, .flags = IORESOURCE_DMA,
}, },
}; };
......
This diff is collapsed.
...@@ -170,6 +170,10 @@ enum sync_dimension { ...@@ -170,6 +170,10 @@ enum sync_dimension {
ABSYNC = 1 ABSYNC = 1
}; };
#define EDMA_CTLR_CHAN(ctlr, chan) (((ctlr) << 16) | (chan))
#define EDMA_CTLR(i) ((i) >> 16)
#define EDMA_CHAN_SLOT(i) ((i) & 0xffff)
#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */ #define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */ #define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
...@@ -180,7 +184,7 @@ int edma_alloc_channel(int channel, ...@@ -180,7 +184,7 @@ int edma_alloc_channel(int channel,
void edma_free_channel(unsigned channel); void edma_free_channel(unsigned channel);
/* alloc/free parameter RAM slots */ /* alloc/free parameter RAM slots */
int edma_alloc_slot(int slot); int edma_alloc_slot(unsigned ctlr, int slot);
void edma_free_slot(unsigned slot); void edma_free_slot(unsigned slot);
/* calls that operate on part of a parameter RAM slot */ /* calls that operate on part of a parameter RAM slot */
......
...@@ -175,8 +175,8 @@ static struct resource evm_snd_resources[] = { ...@@ -175,8 +175,8 @@ static struct resource evm_snd_resources[] = {
}; };
static struct evm_snd_platform_data evm_snd_data = { static struct evm_snd_platform_data evm_snd_data = {
.tx_dma_ch = DAVINCI_DMA_ASP0_TX, .tx_dma_ch = EDMA_CTLR_CHAN(0, DAVINCI_DMA_ASP0_TX),
.rx_dma_ch = DAVINCI_DMA_ASP0_RX, .rx_dma_ch = EDMA_CTLR_CHAN(0, DAVINCI_DMA_ASP0_RX),
}; };
/* DM335 EVM uses ASP1; line-out is a stereo mini-jack */ /* DM335 EVM uses ASP1; line-out is a stereo mini-jack */
...@@ -189,8 +189,8 @@ static struct resource dm335evm_snd_resources[] = { ...@@ -189,8 +189,8 @@ static struct resource dm335evm_snd_resources[] = {
}; };
static struct evm_snd_platform_data dm335evm_snd_data = { static struct evm_snd_platform_data dm335evm_snd_data = {
.tx_dma_ch = DAVINCI_DMA_ASP1_TX, .tx_dma_ch = EDMA_CTLR_CHAN(0, DAVINCI_DMA_ASP1_TX),
.rx_dma_ch = DAVINCI_DMA_ASP1_RX, .rx_dma_ch = EDMA_CTLR_CHAN(0, DAVINCI_DMA_ASP1_RX),
}; };
static struct platform_device *evm_snd_device; static struct platform_device *evm_snd_device;
......
...@@ -143,7 +143,7 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream) ...@@ -143,7 +143,7 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
prtd->master_lch = ret; prtd->master_lch = ret;
/* Request parameter RAM reload slot */ /* Request parameter RAM reload slot */
ret = edma_alloc_slot(EDMA_SLOT_ANY); ret = edma_alloc_slot(EDMA_CTLR(prtd->master_lch), EDMA_SLOT_ANY);
if (ret < 0) { if (ret < 0) {
edma_free_channel(prtd->master_lch); edma_free_channel(prtd->master_lch);
return ret; return ret;
...@@ -160,8 +160,8 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream) ...@@ -160,8 +160,8 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
* so davinci_pcm_enqueue_dma() takes less time in IRQ. * so davinci_pcm_enqueue_dma() takes less time in IRQ.
*/ */
edma_read_slot(prtd->slave_lch, &p_ram); edma_read_slot(prtd->slave_lch, &p_ram);
p_ram.opt |= TCINTEN | EDMA_TCC(prtd->master_lch); p_ram.opt |= TCINTEN | EDMA_TCC(EDMA_CHAN_SLOT(prtd->master_lch));
p_ram.link_bcntrld = prtd->slave_lch << 5; p_ram.link_bcntrld = EDMA_CHAN_SLOT(prtd->slave_lch) << 5;
edma_write_slot(prtd->slave_lch, &p_ram); edma_write_slot(prtd->slave_lch, &p_ram);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment