17 #include <linux/module.h>
20 #include <linux/slab.h>
74 static void ux500_pcm_dma_hw_free(
struct device *
dev,
89 snd_pcm_set_runtime_buffer(substream,
NULL);
94 int stream_id = substream->
pstr->stream;
101 u16 per_data_width, mem_data_width;
104 dev_dbg(dev,
"%s: MSP %d (%s): Enter.\n", __func__, dai->
id,
105 snd_pcm_stream_str(substream));
107 dev_dbg(dev,
"%s: Set runtime hwparams.\n", __func__);
110 &ux500_pcm_hw_playback);
113 &ux500_pcm_hw_capture);
119 dev_err(dev,
"%s: Error: snd_pcm_hw_constraints failed (%d)\n",
124 dev_dbg(dev,
"%s: Set hw-struct for %s.\n", __func__,
125 snd_pcm_stream_str(substream));
127 ux500_pcm_hw_playback : ux500_pcm_hw_capture;
131 dma_params = snd_soc_dai_get_dma_data(dai, substream);
145 "%s: Unknown data-size (%d)! Assuming 32 bits.\n",
152 dma_cfg->
src_info.data_width = mem_data_width;
153 dma_cfg->
dst_info.data_width = per_data_width;
155 dma_cfg->
src_info.data_width = per_data_width;
156 dma_cfg->
dst_info.data_width = mem_data_width;
163 "%s: ERROR: snd_dmaengine_pcm_open failed (%d)!\n",
199 if (buf->
bytes >= size)
201 ux500_pcm_dma_hw_free(
NULL, substream);
222 snd_pcm_set_runtime_buffer(substream, buf);
240 ux500_pcm_dma_hw_free(
NULL, substream);
258 .open = ux500_pcm_open,
259 .close = ux500_pcm_close,
261 .hw_params = ux500_pcm_hw_params,
262 .hw_free = ux500_pcm_hw_free,
265 .mmap = ux500_pcm_mmap
281 .ops = &ux500_pcm_ops,
292 "%s: ERROR: Failed to register platform '%s' (%d)!\n",
293 __func__, pdev->
name, ret);
313 .probe = ux500_pcm_drv_probe,