Lines Matching full:pcm

10 #include <sound/pcm.h>
24 static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm, in dmaengine_dma_dev() argument
27 if (!pcm->chan[substream->stream]) in dmaengine_dma_dev()
30 return pcm->chan[substream->stream]->device->dev; in dmaengine_dma_dev()
35 * @substream: PCM substream
76 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_pcm_hw_params() local
86 if (!pcm->config) in dmaengine_pcm_hw_params()
89 prepare_slave_config = pcm->config->prepare_slave_config; in dmaengine_pcm_hw_params()
109 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_pcm_set_runtime_hwparams() local
110 struct device *dma_dev = dmaengine_dma_dev(pcm, substream); in dmaengine_pcm_set_runtime_hwparams()
111 struct dma_chan *chan = pcm->chan[substream->stream]; in dmaengine_pcm_set_runtime_hwparams()
121 if (pcm->config && pcm->config->pcm_hardware) in dmaengine_pcm_set_runtime_hwparams()
123 pcm->config->pcm_hardware); in dmaengine_pcm_set_runtime_hwparams()
137 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE) in dmaengine_pcm_set_runtime_hwparams()
156 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_pcm_open() local
157 struct dma_chan *chan = pcm->chan[substream->stream]; in dmaengine_pcm_open()
184 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_pcm_compat_request_channel() local
196 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0]) in dmaengine_pcm_compat_request_channel()
197 return pcm->chan[0]; in dmaengine_pcm_compat_request_channel()
199 if (pcm->config && pcm->config->compat_request_channel) in dmaengine_pcm_compat_request_channel()
200 return pcm->config->compat_request_channel(rtd, substream); in dmaengine_pcm_compat_request_channel()
202 if (pcm->config) in dmaengine_pcm_compat_request_channel()
203 fn = pcm->config->compat_filter_fn; in dmaengine_pcm_compat_request_channel()
230 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_pcm_new() local
231 const struct snd_dmaengine_pcm_config *config = pcm->config; in dmaengine_pcm_new()
247 substream = rtd->pcm->streams[i].substream; in dmaengine_pcm_new()
251 if (!pcm->chan[i] && config && config->chan_names[i]) in dmaengine_pcm_new()
252 pcm->chan[i] = dma_request_slave_channel(dev, in dmaengine_pcm_new()
255 if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { in dmaengine_pcm_new()
256 pcm->chan[i] = dmaengine_pcm_compat_request_channel( in dmaengine_pcm_new()
260 if (!pcm->chan[i]) { in dmaengine_pcm_new()
268 dmaengine_dma_dev(pcm, substream), in dmaengine_pcm_new()
272 if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i])) in dmaengine_pcm_new()
273 pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE; in dmaengine_pcm_new()
275 if (rtd->pcm->streams[i].pcm->name[0] == '\0') { in dmaengine_pcm_new()
276 strscpy_pad(rtd->pcm->streams[i].pcm->name, in dmaengine_pcm_new()
277 rtd->pcm->streams[i].pcm->id, in dmaengine_pcm_new()
278 sizeof(rtd->pcm->streams[i].pcm->name)); in dmaengine_pcm_new()
289 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_pcm_pointer() local
291 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE) in dmaengine_pcm_pointer()
303 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); in dmaengine_copy_user() local
306 void *buf, unsigned long bytes) = pcm->config->process; in dmaengine_copy_user()
357 static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, in dmaengine_pcm_request_chan_of() argument
364 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || (!dev->of_node && in dmaengine_pcm_request_chan_of()
381 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) in dmaengine_pcm_request_chan_of()
396 pcm->chan[i] = NULL; in dmaengine_pcm_request_chan_of()
398 pcm->chan[i] = chan; in dmaengine_pcm_request_chan_of()
400 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) in dmaengine_pcm_request_chan_of()
404 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) in dmaengine_pcm_request_chan_of()
405 pcm->chan[1] = pcm->chan[0]; in dmaengine_pcm_request_chan_of()
410 static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm) in dmaengine_pcm_release_chan() argument
415 if (!pcm->chan[i]) in dmaengine_pcm_release_chan()
417 dma_release_channel(pcm->chan[i]); in dmaengine_pcm_release_chan()
418 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) in dmaengine_pcm_release_chan()
424 * snd_dmaengine_pcm_register - Register a dmaengine based PCM device
425 * @dev: The parent device for the PCM device
426 * @config: Platform specific PCM configuration
433 struct dmaengine_pcm *pcm; in snd_dmaengine_pcm_register() local
436 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); in snd_dmaengine_pcm_register()
437 if (!pcm) in snd_dmaengine_pcm_register()
441 pcm->component.debugfs_prefix = "dma"; in snd_dmaengine_pcm_register()
443 pcm->config = config; in snd_dmaengine_pcm_register()
444 pcm->flags = flags; in snd_dmaengine_pcm_register()
446 ret = dmaengine_pcm_request_chan_of(pcm, dev, config); in snd_dmaengine_pcm_register()
455 ret = snd_soc_component_initialize(&pcm->component, driver, dev); in snd_dmaengine_pcm_register()
459 ret = snd_soc_add_component(&pcm->component, NULL, 0); in snd_dmaengine_pcm_register()
466 dmaengine_pcm_release_chan(pcm); in snd_dmaengine_pcm_register()
467 kfree(pcm); in snd_dmaengine_pcm_register()
473 * snd_dmaengine_pcm_unregister - Removes a dmaengine based PCM device
474 * @dev: Parent device the PCM was register with
476 * Removes a dmaengine based PCM device previously registered with
482 struct dmaengine_pcm *pcm; in snd_dmaengine_pcm_unregister() local
488 pcm = soc_component_to_pcm(component); in snd_dmaengine_pcm_unregister()
491 dmaengine_pcm_release_chan(pcm); in snd_dmaengine_pcm_unregister()
492 kfree(pcm); in snd_dmaengine_pcm_unregister()