linux-4.4.1/snd_soc_new_compress()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#w0fc2202]
#backlinks
*説明 [#yacd024e]
-パス: [[linux-4.4.1/sound/soc/soc-compress.c]]
-FIXME: これは何?
--説明
**引数 [#cc9c0a20]
-struct snd_soc_pcm_runtime *rtd
--
--[[linux-4.4.1/snd_soc_pcm_runtime]]
-int num
--
**返り値 [#oe228655]
-int
--
**参考 [#w1bcf13d]
*実装 [#d4ab0397]
/**
* snd_soc_new_compress - create a new compress.
*
* @rtd: The runtime for which we will create compress
* @num: the device index number (zero based - shared wi...
*
* Return: 0 for success, else error.
*/
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd...
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_platform *platform = rtd->platform;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_compr *compr;
struct snd_pcm *be_pcm;
char new_name[64];
int ret = 0, direction = 0;
int playback = 0, capture = 0;
-
--[[linux-4.4.1/snd_soc_codec]]
--[[linux-4.4.1/snd_soc_platform]]
--[[linux-4.4.1/snd_soc_dai]]
--[[linux-4.4.1/snd_compr]]
--[[linux-4.4.1/snd_pcm]]
if (rtd->num_codecs > 1) {
dev_err(rtd->card->dev, "Multicodec not ...
return -EINVAL;
}
-
--rtd->card は struct snd_soc_card * 型
--[[linux-4.4.1/snd_soc_card]]
--[[linux-4.4.1/dev_err()]]
/* check client and interface hw capabilities */
snprintf(new_name, sizeof(new_name), "%s %s-%d",
rtd->dai_link->stream_name, code...
-
--rtd->dai_link は struct snd_soc_dai_link * 型
--[[linux-4.4.1/snd_soc_dai_link]]
--[[linux-4.4.1/snprintf()]]
if (codec_dai->driver->playback.channels_min)
playback = 1;
if (codec_dai->driver->capture.channels_min)
capture = 1;
capture = capture && cpu_dai->driver->capture.ch...
playback = playback && cpu_dai->driver->playback...
-
--codec_dai->driver は 型
--codec_dai->driver.playback, codec_dai->driver.capture ...
--[[linux-4.4.1/]]
/*
* Compress devices are unidirectional so only o...
* should be set, check for that (xor)
*/
if (playback + capture != 1) {
dev_err(rtd->card->dev, "Invalid directi...
playback, capture);
return -EINVAL;
}
if(playback)
direction = SND_COMPRESS_PLAYBACK;
else
direction = SND_COMPRESS_CAPTURE;
compr = kzalloc(sizeof(*compr), GFP_KERNEL);
if (compr == NULL) {
snd_printk(KERN_ERR "Cannot allocate com...
return -ENOMEM;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/snd_printk()]]
compr->ops = devm_kzalloc(rtd->card->dev, sizeof...
GFP_KERNEL);
if (compr->ops == NULL) {
dev_err(rtd->card->dev, "Cannot allocate...
ret = -ENOMEM;
goto compr_err;
}
-
--rtd->card は struct snd_soc_card * 型
--[[linux-4.4.1/snd_soc_card]]
--[[linux-4.4.1/devm_kzalloc()]]
if (rtd->dai_link->dynamic) {
snprintf(new_name, sizeof(new_name), "(%...
rtd->dai_link->stream_name);
ret = snd_pcm_new_internal(rtd->card->sn...
rtd->dai_link->dpcm_play...
rtd->dai_link->dpcm_capt...
if (ret < 0) {
dev_err(rtd->card->dev, "ASoC: c...
rtd->dai_link->name);
goto compr_err;
}
-
--rtd->card は struct snd_soc_card * 型
--[[linux-4.4.1/snd_soc_card]]
--rtd->dai_link は struct snd_soc_dai_link * 型
--[[linux-4.4.1/snd_soc_dai_link]]
--[[linux-4.4.1/snd_pcm_new_internal()]]
rtd->pcm = be_pcm;
rtd->fe_compr = 1;
if (rtd->dai_link->dpcm_playback)
be_pcm->streams[SNDRV_PCM_STREAM...
else if (rtd->dai_link->dpcm_capture)
be_pcm->streams[SNDRV_PCM_STREAM...
memcpy(compr->ops, &soc_compr_dyn_ops, s...
} else
memcpy(compr->ops, &soc_compr_ops, sizeo...
/* Add copy callback for not memory mapped DSPs */
if (platform->driver->compr_ops && platform->dri...
compr->ops->copy = soc_compr_copy;
mutex_init(&compr->lock);
ret = snd_compress_new(rtd->card->snd_card, num,...
if (ret < 0) {
pr_err("compress asoc: can't create comp...
codec->component.name);
goto compr_err;
}
-
--be_pcm->streams は struct snd_pcm_str[2] 型
--[[linux-4.4.1/snd_pcm_str]]
--be_pcm->streams[].substream は struct snd_pcm_substream...
--[[linux-4.4.1/snd_pcm_substream]]
--[[linux-4.4.1/mutex_init()]]
--[[linux-4.4.1/snd_compress_new()]]
/* DAPM dai link stream work */
INIT_DELAYED_WORK(&rtd->delayed_work, close_dela...
-
--[[linux-4.4.1/INIT_DELAYED_WORK()]]
--[[linux-4.4.1/close_delayed_work()]]
rtd->compr = compr;
compr->private_data = rtd;
printk(KERN_INFO "compress asoc: %s <-> %s mappi...
cpu_dai->name);
return ret;
-
--[[linux-4.4.1/printk()]]
compr_err:
kfree(compr);
return ret;
-
--[[linux-4.4.1/kfree()]]
}
EXPORT_SYMBOL_GPL(snd_soc_new_compress);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#a3ca4130]
終了行:
*参照元 [#w0fc2202]
#backlinks
*説明 [#yacd024e]
-パス: [[linux-4.4.1/sound/soc/soc-compress.c]]
-FIXME: これは何?
--説明
**引数 [#cc9c0a20]
-struct snd_soc_pcm_runtime *rtd
--
--[[linux-4.4.1/snd_soc_pcm_runtime]]
-int num
--
**返り値 [#oe228655]
-int
--
**参考 [#w1bcf13d]
*実装 [#d4ab0397]
/**
* snd_soc_new_compress - create a new compress.
*
* @rtd: The runtime for which we will create compress
* @num: the device index number (zero based - shared wi...
*
* Return: 0 for success, else error.
*/
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd...
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_platform *platform = rtd->platform;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_compr *compr;
struct snd_pcm *be_pcm;
char new_name[64];
int ret = 0, direction = 0;
int playback = 0, capture = 0;
-
--[[linux-4.4.1/snd_soc_codec]]
--[[linux-4.4.1/snd_soc_platform]]
--[[linux-4.4.1/snd_soc_dai]]
--[[linux-4.4.1/snd_compr]]
--[[linux-4.4.1/snd_pcm]]
if (rtd->num_codecs > 1) {
dev_err(rtd->card->dev, "Multicodec not ...
return -EINVAL;
}
-
--rtd->card は struct snd_soc_card * 型
--[[linux-4.4.1/snd_soc_card]]
--[[linux-4.4.1/dev_err()]]
/* check client and interface hw capabilities */
snprintf(new_name, sizeof(new_name), "%s %s-%d",
rtd->dai_link->stream_name, code...
-
--rtd->dai_link は struct snd_soc_dai_link * 型
--[[linux-4.4.1/snd_soc_dai_link]]
--[[linux-4.4.1/snprintf()]]
if (codec_dai->driver->playback.channels_min)
playback = 1;
if (codec_dai->driver->capture.channels_min)
capture = 1;
capture = capture && cpu_dai->driver->capture.ch...
playback = playback && cpu_dai->driver->playback...
-
--codec_dai->driver は 型
--codec_dai->driver.playback, codec_dai->driver.capture ...
--[[linux-4.4.1/]]
/*
* Compress devices are unidirectional so only o...
* should be set, check for that (xor)
*/
if (playback + capture != 1) {
dev_err(rtd->card->dev, "Invalid directi...
playback, capture);
return -EINVAL;
}
if(playback)
direction = SND_COMPRESS_PLAYBACK;
else
direction = SND_COMPRESS_CAPTURE;
compr = kzalloc(sizeof(*compr), GFP_KERNEL);
if (compr == NULL) {
snd_printk(KERN_ERR "Cannot allocate com...
return -ENOMEM;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/snd_printk()]]
compr->ops = devm_kzalloc(rtd->card->dev, sizeof...
GFP_KERNEL);
if (compr->ops == NULL) {
dev_err(rtd->card->dev, "Cannot allocate...
ret = -ENOMEM;
goto compr_err;
}
-
--rtd->card は struct snd_soc_card * 型
--[[linux-4.4.1/snd_soc_card]]
--[[linux-4.4.1/devm_kzalloc()]]
if (rtd->dai_link->dynamic) {
snprintf(new_name, sizeof(new_name), "(%...
rtd->dai_link->stream_name);
ret = snd_pcm_new_internal(rtd->card->sn...
rtd->dai_link->dpcm_play...
rtd->dai_link->dpcm_capt...
if (ret < 0) {
dev_err(rtd->card->dev, "ASoC: c...
rtd->dai_link->name);
goto compr_err;
}
-
--rtd->card は struct snd_soc_card * 型
--[[linux-4.4.1/snd_soc_card]]
--rtd->dai_link は struct snd_soc_dai_link * 型
--[[linux-4.4.1/snd_soc_dai_link]]
--[[linux-4.4.1/snd_pcm_new_internal()]]
rtd->pcm = be_pcm;
rtd->fe_compr = 1;
if (rtd->dai_link->dpcm_playback)
be_pcm->streams[SNDRV_PCM_STREAM...
else if (rtd->dai_link->dpcm_capture)
be_pcm->streams[SNDRV_PCM_STREAM...
memcpy(compr->ops, &soc_compr_dyn_ops, s...
} else
memcpy(compr->ops, &soc_compr_ops, sizeo...
/* Add copy callback for not memory mapped DSPs */
if (platform->driver->compr_ops && platform->dri...
compr->ops->copy = soc_compr_copy;
mutex_init(&compr->lock);
ret = snd_compress_new(rtd->card->snd_card, num,...
if (ret < 0) {
pr_err("compress asoc: can't create comp...
codec->component.name);
goto compr_err;
}
-
--be_pcm->streams は struct snd_pcm_str[2] 型
--[[linux-4.4.1/snd_pcm_str]]
--be_pcm->streams[].substream は struct snd_pcm_substream...
--[[linux-4.4.1/snd_pcm_substream]]
--[[linux-4.4.1/mutex_init()]]
--[[linux-4.4.1/snd_compress_new()]]
/* DAPM dai link stream work */
INIT_DELAYED_WORK(&rtd->delayed_work, close_dela...
-
--[[linux-4.4.1/INIT_DELAYED_WORK()]]
--[[linux-4.4.1/close_delayed_work()]]
rtd->compr = compr;
compr->private_data = rtd;
printk(KERN_INFO "compress asoc: %s <-> %s mappi...
cpu_dai->name);
return ret;
-
--[[linux-4.4.1/printk()]]
compr_err:
kfree(compr);
return ret;
-
--[[linux-4.4.1/kfree()]]
}
EXPORT_SYMBOL_GPL(snd_soc_new_compress);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#a3ca4130]
ページ名: