Commit 778a17c3 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Liam Girdwood

ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+

Take the DMA packet mode into use when the McBSP is configured in element
dma_op_mode if the stream is not mono.
In this way we transfer one sample from/to McBSP FIFO upon DMA request.
This change only affects OMAP3+ versions, where the McBSP ports have FIFO.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: default avatarLiam Girdwood <lrg@ti.com>
parent 766812e6
...@@ -71,18 +71,17 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) ...@@ -71,18 +71,17 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
/* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ /*
if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) * Configure McBSP threshold based on either:
/* * packet_size, when the sDMA is in packet mode, or based on the
* Configure McBSP threshold based on either: * period size in THRESHOLD mode, otherwise use McBSP threshold = 1
* packet_size, when the sDMA is in packet mode, or * for mono streams.
* based on the period size. */
*/ if (dma_data->packet_size)
if (dma_data->packet_size) words = dma_data->packet_size;
words = dma_data->packet_size; else if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
else words = snd_pcm_lib_period_bytes(substream) /
words = snd_pcm_lib_period_bytes(substream) / (mcbsp->wlen / 8);
(mcbsp->wlen / 8);
else else
words = 1; words = 1;
...@@ -230,6 +229,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -230,6 +229,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
unsigned int format, div, framesize, master; unsigned int format, div, framesize, master;
dma_data = &mcbsp->dma_data[substream->stream]; dma_data = &mcbsp->dma_data[substream->stream];
channels = params_channels(params);
switch (params_format(params)) { switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
...@@ -283,6 +283,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -283,6 +283,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
} else { } else {
sync_mode = OMAP_DMA_SYNC_FRAME; sync_mode = OMAP_DMA_SYNC_FRAME;
} }
} else if (channels > 1) {
/* Use packet mode for non mono streams */
pkt_size = channels;
sync_mode = OMAP_DMA_SYNC_PACKET;
} }
} }
...@@ -301,7 +305,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -301,7 +305,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7)); regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7));
regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7)); regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7));
format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
wpf = channels = params_channels(params); wpf = channels;
if (channels == 2 && (format == SND_SOC_DAIFMT_I2S || if (channels == 2 && (format == SND_SOC_DAIFMT_I2S ||
format == SND_SOC_DAIFMT_LEFT_J)) { format == SND_SOC_DAIFMT_LEFT_J)) {
/* Use dual-phase frames */ /* Use dual-phase frames */
......
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