aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorMatthias Reichl <hias@horus.com>2016-04-27 09:26:51 -0400
committerMark Brown <broonie@kernel.org>2016-04-27 12:34:11 -0400
commit73fe01cfb3babff01748a9fbc95cc3ea2079cc7f (patch)
treef3f6b72b1fa9e2d0374f9417c9e97f1779d5af4a /sound/core
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
ASoC: dmaengine_pcm: Add support for packed transfers
dmaengine_pcm currently only supports setups where FIFO reads/writes correspond to exactly one sample, eg 16-bit sample data is transferred via 16-bit FIFO accesses, 32-bit data via 32-bit accesses. This patch adds support for setups with fixed width FIFOs where multiple samples are packed into a larger word. For example setups with a 32-bit wide FIFO register that expect 16-bit sample transfers to be done with the left+right sample data packed into a 32-bit word. Support for packed transfers is controlled via the SND_DMAENGINE_PCM_DAI_FLAG_PACK flag in snd_dmaengine_dai_dma_data.flags If this flag is set dmaengine_pcm doesn't put any restriction on the supported formats and sets the DMA transfer width to undefined. This means control over the constraints is now transferred to the DAI driver and it's responsible to provide proper configuration and check for possible corner cases that aren't handled by the ALSA core. Signed-off-by: Matthias Reichl <hias@horus.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_dmaengine.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index 697c166acf05..8eb58c709b14 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -106,8 +106,9 @@ EXPORT_SYMBOL_GPL(snd_hwparams_to_dma_slave_config);
106 * direction of the substream. If the substream is a playback stream the dst 106 * direction of the substream. If the substream is a playback stream the dst
107 * fields will be initialized, if it is a capture stream the src fields will be 107 * fields will be initialized, if it is a capture stream the src fields will be
108 * initialized. The {dst,src}_addr_width field will only be initialized if the 108 * initialized. The {dst,src}_addr_width field will only be initialized if the
109 * addr_width field of the DAI DMA data struct is not equal to 109 * SND_DMAENGINE_PCM_DAI_FLAG_PACK flag is set or if the addr_width field of
110 * DMA_SLAVE_BUSWIDTH_UNDEFINED. 110 * the DAI DMA data struct is not equal to DMA_SLAVE_BUSWIDTH_UNDEFINED. If
111 * both conditions are met the latter takes priority.
111 */ 112 */
112void snd_dmaengine_pcm_set_config_from_dai_data( 113void snd_dmaengine_pcm_set_config_from_dai_data(
113 const struct snd_pcm_substream *substream, 114 const struct snd_pcm_substream *substream,
@@ -117,11 +118,17 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
117 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 118 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
118 slave_config->dst_addr = dma_data->addr; 119 slave_config->dst_addr = dma_data->addr;
119 slave_config->dst_maxburst = dma_data->maxburst; 120 slave_config->dst_maxburst = dma_data->maxburst;
121 if (dma_data->flags & SND_DMAENGINE_PCM_DAI_FLAG_PACK)
122 slave_config->dst_addr_width =
123 DMA_SLAVE_BUSWIDTH_UNDEFINED;
120 if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED) 124 if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED)
121 slave_config->dst_addr_width = dma_data->addr_width; 125 slave_config->dst_addr_width = dma_data->addr_width;
122 } else { 126 } else {
123 slave_config->src_addr = dma_data->addr; 127 slave_config->src_addr = dma_data->addr;
124 slave_config->src_maxburst = dma_data->maxburst; 128 slave_config->src_maxburst = dma_data->maxburst;
129 if (dma_data->flags & SND_DMAENGINE_PCM_DAI_FLAG_PACK)
130 slave_config->src_addr_width =
131 DMA_SLAVE_BUSWIDTH_UNDEFINED;
125 if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED) 132 if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED)
126 slave_config->src_addr_width = dma_data->addr_width; 133 slave_config->src_addr_width = dma_data->addr_width;
127 } 134 }