diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2012-03-15 06:20:32 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@ti.com> | 2012-05-22 12:33:18 -0400 |
commit | 778a17c31fc1c0ecc22c9012747d5249ed6db80f (patch) | |
tree | d6af1115c4411a29fe677a2a8fb075dd5a3aa492 /sound/soc/omap/omap-mcbsp.c | |
parent | 766812e6d5e2e23be1e212cf84902d5e834dd865 (diff) |
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: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/omap/omap-mcbsp.c')
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 6912ac7cb625..418dc3cebdec 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -71,18 +71,17 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) | |||
71 | 71 | ||
72 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 72 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
73 | 73 | ||
74 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ | 74 | /* |
75 | if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) | 75 | * Configure McBSP threshold based on either: |
76 | /* | 76 | * packet_size, when the sDMA is in packet mode, or based on the |
77 | * Configure McBSP threshold based on either: | 77 | * period size in THRESHOLD mode, otherwise use McBSP threshold = 1 |
78 | * packet_size, when the sDMA is in packet mode, or | 78 | * for mono streams. |
79 | * based on the period size. | 79 | */ |
80 | */ | 80 | if (dma_data->packet_size) |
81 | if (dma_data->packet_size) | 81 | words = dma_data->packet_size; |
82 | words = dma_data->packet_size; | 82 | else if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) |
83 | else | 83 | words = snd_pcm_lib_period_bytes(substream) / |
84 | words = snd_pcm_lib_period_bytes(substream) / | 84 | (mcbsp->wlen / 8); |
85 | (mcbsp->wlen / 8); | ||
86 | else | 85 | else |
87 | words = 1; | 86 | words = 1; |
88 | 87 | ||
@@ -230,6 +229,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
230 | unsigned int format, div, framesize, master; | 229 | unsigned int format, div, framesize, master; |
231 | 230 | ||
232 | dma_data = &mcbsp->dma_data[substream->stream]; | 231 | dma_data = &mcbsp->dma_data[substream->stream]; |
232 | channels = params_channels(params); | ||
233 | 233 | ||
234 | switch (params_format(params)) { | 234 | switch (params_format(params)) { |
235 | case SNDRV_PCM_FORMAT_S16_LE: | 235 | case SNDRV_PCM_FORMAT_S16_LE: |
@@ -283,6 +283,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
283 | } else { | 283 | } else { |
284 | sync_mode = OMAP_DMA_SYNC_FRAME; | 284 | sync_mode = OMAP_DMA_SYNC_FRAME; |
285 | } | 285 | } |
286 | } else if (channels > 1) { | ||
287 | /* Use packet mode for non mono streams */ | ||
288 | pkt_size = channels; | ||
289 | sync_mode = OMAP_DMA_SYNC_PACKET; | ||
286 | } | 290 | } |
287 | } | 291 | } |
288 | 292 | ||
@@ -301,7 +305,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
301 | regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7)); | 305 | regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7)); |
302 | regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7)); | 306 | regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7)); |
303 | format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; | 307 | format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; |
304 | wpf = channels = params_channels(params); | 308 | wpf = channels; |
305 | if (channels == 2 && (format == SND_SOC_DAIFMT_I2S || | 309 | if (channels == 2 && (format == SND_SOC_DAIFMT_I2S || |
306 | format == SND_SOC_DAIFMT_LEFT_J)) { | 310 | format == SND_SOC_DAIFMT_LEFT_J)) { |
307 | /* Use dual-phase frames */ | 311 | /* Use dual-phase frames */ |