aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@linaro.org>2013-06-12 03:57:59 -0400
committerMark Brown <broonie@linaro.org>2013-06-12 12:02:52 -0400
commiteef6473ff3ce2383febebd2e799beceaece9adda (patch)
tree19902a8739be9348659665071d72f15c05cf3842
parent20413113ffdd8c56b2a985ca8195d9c91e9c602b (diff)
ASoC: ux500: Add DMA slave config prepare routine
Implement a DMA slave config prepare routine, as until now the MSP driver depended on the DMA controller completing the channel configuration on its own, but this is not the case anymore since the recent DMA driver updates. Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/ux500/ux500_pcm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index b6e5ae277299..5f01c19776bf 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -103,10 +103,40 @@ static struct dma_chan *ux500_pcm_request_chan(struct snd_soc_pcm_runtime *rtd,
103 return snd_dmaengine_pcm_request_channel(stedma40_filter, dma_cfg); 103 return snd_dmaengine_pcm_request_channel(stedma40_filter, dma_cfg);
104} 104}
105 105
106static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
107 struct snd_pcm_hw_params *params,
108 struct dma_slave_config *slave_config)
109{
110 struct snd_soc_pcm_runtime *rtd = substream->private_data;
111 struct ux500_msp_dma_params *dma_params;
112 struct stedma40_chan_cfg *dma_cfg;
113 int ret;
114
115 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
116 dma_cfg = dma_params->dma_cfg;
117
118 ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config);
119 if (ret)
120 return ret;
121
122 slave_config->dst_maxburst = 4;
123 slave_config->dst_addr_width = dma_cfg->dst_info.data_width;
124 slave_config->src_maxburst = 4;
125 slave_config->src_addr_width = dma_cfg->src_info.data_width;
126
127 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
128 slave_config->dst_addr = dma_params->tx_rx_addr;
129 else
130 slave_config->src_addr = dma_params->tx_rx_addr;
131
132 return 0;
133}
134
106static const struct snd_dmaengine_pcm_config ux500_dmaengine_pcm_config = { 135static const struct snd_dmaengine_pcm_config ux500_dmaengine_pcm_config = {
107 .pcm_hardware = &ux500_pcm_hw, 136 .pcm_hardware = &ux500_pcm_hw,
108 .compat_request_channel = ux500_pcm_request_chan, 137 .compat_request_channel = ux500_pcm_request_chan,
109 .prealloc_buffer_size = 128 * 1024, 138 .prealloc_buffer_size = 128 * 1024,
139 .prepare_slave_config = ux500_pcm_prepare_slave_config,
110}; 140};
111 141
112int ux500_pcm_register_platform(struct platform_device *pdev) 142int ux500_pcm_register_platform(struct platform_device *pdev)