asoc: davinci: let platform data define edma queue numbers
Subsystems (5)
PATCH 1/1 asoc: davinci: let platform data define edma queue numbers
Currently the EDMA queue to be used by for servicing ASP through internal RAM is fixed to EDMAQ_0 and that to service internal RAM from external RAM is fixed to EDMAQ_1.
This may not be the desirable configuration on all platforms. For example, on DM365, queue 0 has large fifo size and is more suitable for video transfers. Having audio and video transfers on the same queue may lead to starvation on audio side.
platform data as defined currently passes a queue number to the driver but that remains unused inside the driver.
Fix this by defining one queue each for ASP and RAM transfers in the platform data and using it inside the driver.
Since EDMAQ_0 maps to 0, thats the queue that will be used if the asp queue number is not initialized. None of the platforms currently utilize ping-pong transfers through internal RAM so that functionality remains unchanged too.
This patch has been tested on DM644x and OMAP-L138 EVMs.
---
This patch applies to latest of Linus's tree.
arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/board-dm646x-evm.c | 4 ++-- arch/arm/mach-davinci/include/mach/asp.h | 3 ++- sound/soc/davinci/davinci-i2s.c | 10 ++++++++++ sound/soc/davinci/davinci-mcasp.c | 6 ++++-- sound/soc/davinci/davinci-pcm.c | 5 +++-- sound/soc/davinci/davinci-pcm.h | 3 ++- 8 files changed, 25 insertions(+), 10 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +1 -1
@@ -208,7 +208,7 @@ static struct snd_platform_data da830_evm_snd_data = { .num_serializer = ARRAY_SIZE(da830_iis_serializer_direction), .tdm_slots = 2, .serial_dir = da830_iis_serializer_direction, - .eventq_no = EVENTQ_0, + .asp_chan_q = EVENTQ_0, .version = MCASP_VERSION_2, .txnumevt = 1, .rxnumevt = 1,
arch/arm/mach-davinci/board-da850-evm.c +1 -1
@@ -342,7 +342,7 @@ static struct snd_platform_data da850_evm_snd_data = { .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), .tdm_slots = 2, .serial_dir = da850_iis_serializer_direction, - .eventq_no = EVENTQ_1, + .asp_chan_q = EVENTQ_1, .version = MCASP_VERSION_2, .txnumevt = 1, .rxnumevt = 1,
arch/arm/mach-davinci/board-dm646x-evm.c +2 -2
@@ -323,7 +323,7 @@ static struct snd_platform_data dm646x_evm_snd_data[] = { .num_serializer = ARRAY_SIZE(dm646x_iis_serializer_direction), .tdm_slots = 2, .serial_dir = dm646x_iis_serializer_direction, - .eventq_no = EVENTQ_0, + .asp_chan_q = EVENTQ_0, }, { .tx_dma_offset = 0x400,
@@ -332,7 +332,7 @@ static struct snd_platform_data dm646x_evm_snd_data[] = { .num_serializer = ARRAY_SIZE(dm646x_dit_serializer_direction), .tdm_slots = 32, .serial_dir = dm646x_dit_serializer_direction, - .eventq_no = EVENTQ_0, + .asp_chan_q = EVENTQ_0, }, };
arch/arm/mach-davinci/include/mach/asp.h +2 -1
@@ -52,7 +52,8 @@struct snd_platform_data {u32 tx_dma_offset;u32 rx_dma_offset; -enum dma_event_q eventq_no;/* event queue number */ +enum dma_event_q asp_chan_q;/* event queue number for ASP channel */ +enum dma_event_q ram_chan_q;/* event queue number for RAM channel */ unsigned int codec_fmt;/* * Allowing this is more efficient and eliminates left and right swaps
sound/soc/davinci/davinci-i2s.c +10 -0
@@ -526,6 +526,8 @@ static int davinci_i2s_probe(struct platform_device *pdev)struct snd_platform_data *pdata = pdev->dev.platform_data;struct davinci_mcbsp_dev *dev;struct resource *mem, *ioarea, *res; +enum dma_event_q asp_chan_q =EVENTQ_0 ; +enum dma_event_q ram_chan_q =EVENTQ_1 ;int ret; mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -552,7 +554,15 @@ static int davinci_i2s_probe(struct platform_device *pdev) pdata->sram_size_playback; dev->dma_params[SNDRV_PCM_STREAM_CAPTURE ].sram_size = pdata->sram_size_capture; + asp_chan_q = pdata->asp_chan_q; + ram_chan_q = pdata->ram_chan_q; } + + dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK ].asp_chan_q = asp_chan_q; + dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK ].ram_chan_q = ram_chan_q; + dev->dma_params[SNDRV_PCM_STREAM_CAPTURE ].asp_chan_q = asp_chan_q; + dev->dma_params[SNDRV_PCM_STREAM_CAPTURE ].ram_chan_q = ram_chan_q; + dev->clk =clk_get (&pdev->dev,NULL );if (IS_ERR (dev->clk)) { ret = -ENODEV ;
sound/soc/davinci/davinci-mcasp.c +4 -2
@@ -890,7 +890,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK ]; - dma_data->eventq_no = pdata->eventq_no; + dma_data->asp_chan_q = pdata->asp_chan_q; + dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +io_v2p (dev->base));
@@ -904,7 +905,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->channel = res->start; dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE ]; - dma_data->eventq_no = pdata->eventq_no; + dma_data->asp_chan_q = pdata->asp_chan_q; + dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +io_v2p (dev->base));
sound/soc/davinci/davinci-pcm.c +3 -2
@@ -381,7 +381,7 @@ static int request_ping_pong(struct snd_pcm_substream *substream,/* Request ram master channel */ link = prtd->ram_channel =edma_alloc_channel (EDMA_CHANNEL_ANY , davinci_pcm_dma_irq, substream, -EVENTQ_1 ); + prtd->params->ram_chan_q);if (link <0 ) goto exit1;
@@ -477,7 +477,8 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)/* Request asp master DMA channel */ link = prtd->asp_channel =edma_alloc_channel (params->channel, - davinci_pcm_dma_irq, substream,EVENTQ_0 ); + davinci_pcm_dma_irq, substream, + prtd->params->asp_chan_q);if (link <0 ) goto exit1;
sound/soc/davinci/davinci-pcm.h +2 -1
@@ -21,7 +21,8 @@ struct davinci_pcm_dma_params {unsigned short acnt;dma_addr_t dma_addr;/* device physical address for DMA */ unsigned sram_size; -enum dma_event_q eventq_no;/* event queue number */ +enum dma_event_q asp_chan_q;/* event queue number for ASP channel */ +enum dma_event_q ram_chan_q;/* event queue number for RAM channel */ unsigned char data_type;/* xfer data type */ unsigned char convert_mono_stereo;unsigned int fifo_level;
Signature · 1 line
1.6.2.4
Quoted 15 lines · Sekhar Nori
Currently the EDMA queue to be used by for servicing ASP through internal RAM is fixed to
EDMAQ_0and that to service internal RAM from external RAM is fixed toEDMAQ_1.This may not be the desirable configuration on all platforms. For example, on DM365, queue 0 has large fifo size and is more suitable for video transfers. Having audio and video transfers on the same queue may lead to starvation on audio side.
platform data as defined currently passes a queue number to the driver but that remains unused inside the driver.
Fix this by defining one queue each for ASP and RAM transfers in the platform data and using it inside the driver.
Quoted 8 lines
Since
EDMAQ_0maps to 0, thats the queue that will be used if the asp queue number is not initialized. None of the platforms currently utilize ping-pong transfers through internal RAM so that functionality remains unchanged too.This patch has been tested on DM644x and OMAP-L138 EVMs.
Signed-off-by Sekhar Nori <[email protected]>
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Quoted 5 lines · Sekhar Nori
This patch has been tested on DM644x and OMAP-L138 EVMs.
Signed-off-by Sekhar Nori <[email protected]>This patch applies to latest of Linus's tree.
...so it doesn't apply against my for-2.6.36 branch (and obviously there's crossover with Kevin's tree as well which makes things possibly a bit interesting too). Could you please regenerate against for-2.6.36? You should generally always send patches against the latest version of code rather than Linus' tree, using other trees increases the chances that your patch will not apply.
A message that is not in the archive (sent off-list or not yet received): 20100717185018.GC27456-HF5t3jzXg/6ND3a5+9QAFujbO/[email protected]
Hi Mark,
Quoted 6 lines · Mark Brown
Quoted 3 lines · Sekhar Nori
This patch has been tested on DM644x and OMAP-L138 EVMs.
Signed-off-by Sekhar Nori <[email protected]>
Quoted 8 lines
Quoted 1 line
This patch applies to latest of Linus's tree.
...so it doesn't apply against my for-2.6.36 branch (and obviously there's crossover with Kevin's tree as well which makes things possibly a bit interesting too). Could you please regenerate against for-2.6.36? You should generally always send patches against the latest version of code rather than Linus' tree, using other trees increases the chances that your patch will not apply.
Thanks for the feedback. I rebased against for-2.6.36 and sent a v2.
Regards,
Sekhar