- 追加された行はこの色です。
- 削除された行はこの色です。
*参照元 [#v86277ee]
#backlinks
*説明 [#o171c679]
-パス: [[linux-4.4.1/sound/soc/soc-generic-dmaengine-pcm.c]]
-FIXME: これは何?
--説明
**引数 [#m076f081]
-struct snd_soc_pcm_runtime *rtd
--
--[[linux-4.4.1/snd_soc_pcm_runtime]]
**返り値 [#w1ed46e3]
-int
--
**参考 [#p8a75663]
*実装 [#k6b8b773]
static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
const struct snd_dmaengine_pcm_config *config = pcm->config;
struct device *dev = rtd->platform->dev;
struct snd_dmaengine_dai_dma_data *dma_data;
struct snd_pcm_substream *substream;
size_t prealloc_buffer_size;
size_t max_buffer_size;
unsigned int i;
int ret;
-
--[[linux-4.4.1/dmaengine_pcm]]
--[[linux-4.4.1/soc_platform_to_pcm()]]
--[[linux-4.4.1/snd_dmaengine_pcm_config]]
--[[linux-4.4.1/device]]
--[[linux-4.4.1/snd_dmaengine_dai_dma_data]]
--[[linux-4.4.1/snd_pcm_substream]]
if (config && config->prealloc_buffer_size) {
prealloc_buffer_size = config->prealloc_buffer_size;
max_buffer_size = config->pcm_hardware->buffer_bytes_max;
} else {
prealloc_buffer_size = 512 * 1024;
max_buffer_size = SIZE_MAX;
}
-
--config->pcm_hardware は 型
--[[linux-4.4.1/]]
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
substream = rtd->pcm->streams[i].substream;
if (!substream)
continue;
-
--rtd->pcm は 型
--rtd->pcm->streams は 型
--[[linux-4.4.1/]]
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
-
--[[linux-4.4.1/snd_soc_dai_get_dma_data()]]
if (!pcm->chan[i] &&
(pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME))
pcm->chan[i] = dma_request_slave_channel(dev,
dma_data->chan_name);
-
--[[linux-4.4.1/dma_request_slave_channel()]]
if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd,
substream);
}
-
--[[linux-4.4.1/dmaengine_pcm_compat_request_channel()]]
if (!pcm->chan[i]) {
dev_err(rtd->platform->dev,
"Missing dma channel for stream: %d\n", i);
return -EINVAL;
}
-
--[[linux-4.4.1/dev_err()]]
ret = snd_pcm_lib_preallocate_pages(substream,
SNDRV_DMA_TYPE_DEV_IRAM,
dmaengine_dma_dev(pcm, substream),
prealloc_buffer_size,
max_buffer_size);
if (ret)
return ret;
-
--[[linux-4.4.1/snd_pcm_lib_preallocate_pages()]]
--[[linux-4.4.1/dmaengine_dma_dev()]]
if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
-
--[[linux-4.4.1/dmaengine_pcm_can_report_residue()]]
}
return 0;
}
*コメント [#fbbad646]