Lines Matching full:pcm

10 #include <sound/pcm.h>
28 static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm,
31 if (!pcm->chan[substream->stream])
34 return pcm->chan[substream->stream]->device->dev;
39 * @substream: PCM substream
80 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
85 if (!pcm->config->prepare_slave_config)
90 ret = pcm->config->prepare_slave_config(substream, params, &slave_config);
102 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
103 struct device *dma_dev = dmaengine_dma_dev(pcm, substream);
104 struct dma_chan *chan = pcm->chan[substream->stream];
114 if (pcm->config->pcm_hardware)
116 pcm->config->pcm_hardware);
132 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
151 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
152 struct dma_chan *chan = pcm->chan[substream->stream];
179 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
190 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
191 return pcm->chan[0];
193 if (pcm->config->compat_request_channel)
194 return pcm->config->compat_request_channel(rtd, substream);
196 return snd_dmaengine_pcm_request_channel(pcm->config->compat_filter_fn,
222 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
223 const struct snd_dmaengine_pcm_config *config = pcm->config;
240 struct snd_pcm_substream *substream = rtd->pcm->streams[i].substream;
244 if (!pcm->chan[i] && config->chan_names[i])
245 pcm->chan[i] = dma_request_slave_channel(dev,
248 if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
249 pcm->chan[i] = dmaengine_pcm_compat_request_channel(
253 if (!pcm->chan[i]) {
261 dmaengine_dma_dev(pcm, substream),
265 if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
266 pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
268 if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
269 strscpy_pad(rtd->pcm->streams[i].pcm->name,
270 rtd->pcm->streams[i].pcm->id,
271 sizeof(rtd->pcm->streams[i].pcm->name));
282 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
284 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
296 struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
299 unsigned long bytes) = pcm->config->process;
357 static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
364 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || (!dev->of_node &&
381 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
396 pcm->chan[i] = NULL;
398 pcm->chan[i] = chan;
400 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
404 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
405 pcm->chan[1] = pcm->chan[0];
410 static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm)
415 if (!pcm->chan[i])
417 dma_release_channel(pcm->chan[i]);
418 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
428 * snd_dmaengine_pcm_register - Register a dmaengine based PCM device
429 * @dev: The parent device for the PCM device
430 * @config: Platform specific PCM configuration
437 struct dmaengine_pcm *pcm;
440 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
441 if (!pcm)
445 pcm->component.debugfs_prefix = "dma";
449 pcm->config = config;
450 pcm->flags = flags;
453 pcm->component.name = config->name;
455 ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
464 ret = snd_soc_component_initialize(&pcm->component, driver, dev);
468 ret = snd_soc_add_component(&pcm->component, NULL, 0);
475 dmaengine_pcm_release_chan(pcm);
476 kfree(pcm);
482 * snd_dmaengine_pcm_unregister - Removes a dmaengine based PCM device
483 * @dev: Parent device the PCM was register with
485 * Removes a dmaengine based PCM device previously registered with
491 struct dmaengine_pcm *pcm;
497 pcm = soc_component_to_pcm(component);
500 dmaengine_pcm_release_chan(pcm);
501 kfree(pcm);
505 MODULE_DESCRIPTION("ASoC helpers for generic PCM dmaengine API");