linux-2.6.33/snd_soc_instantiate_card()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#o19682d3]
#backlinks
*説明 [#de808bdd]
-パス: [[linux-2.6.33/sound/soc-core.c]]
-FIXME: これは何?
--説明
**引数 [#r3782659]
-struct snd_soc_card *card
--
--[[linux-2.6.33/snd_soc_card]]
**返り値 [#q853654f]
-なし
**参考 [#e15aa83d]
*実装 [#u7de6097]
static void snd_soc_instantiate_card(struct snd_soc_card...
{
struct platform_device *pdev = container_of(card->dev,
struct platform_device,
dev);
struct snd_soc_codec_device *codec_dev = card->socdev->...
struct snd_soc_codec *codec;
struct snd_soc_platform *platform;
struct snd_soc_dai *dai;
int i, found, ret, ac97;
-
--[[linux-2.6.33/platform_device]]
-
--[[linux-2.6.33/container_of()]]
-
--[[linux-2.6.33/snd_soc_codec_device]]
-
--[[linux-2.6.33/snd_soc_platform]]
-
--[[linux-2.6.33/snd_soc_dai]]
if (card->instantiated)
return;
found = 0;
list_for_each_entry(platform, &platform_list, list)
if (card->platform == platform) {
found = 1;
break;
}
if (!found) {
dev_dbg(card->dev, "Platform %s not registered\n",
card->platform->name);
return;
}
-デバイスが保持している snd_soc_platform と同一の platfor...
platform のリスト(platform_list)から探す。
--一致する platform がリスト内にあれば処理を続行、なけれ...
--[[linux-2.6.33/list_for_each_entry()]]
--[[linux-2.6.33/platform_list(global)]]
--[[linux-2.6.33/dev_dbg()]]
ac97 = 0;
for (i = 0; i < card->num_links; i++) {
found = 0;
list_for_each_entry(dai, &dai_list, list)
if (card->dai_link[i].cpu_dai == dai) {
found = 1;
break;
}
if (!found) {
dev_dbg(card->dev, "DAI %s not registered\n",
card->dai_link[i].cpu_dai->name);
return;
}
if (card->dai_link[i].cpu_dai->ac97_control)
ac97 = 1;
}
-
--[[linux-2.6.33/dai_list(global)]]
for (i = 0; i < card->num_links; i++) {
if (!card->dai_link[i].codec_dai->ops)
card->dai_link[i].codec_dai->ops = &null_dai_ops;
}
/* If we have AC97 in the system then don't wait for the
* codec. This will need revisiting if we have to handle
* systems with mixed AC97 and non-AC97 parts. Only ch...
* DAIs currently; we can't do this per link since some...
* codecs have non-AC97 DAIs.
*/
if (!ac97)
for (i = 0; i < card->num_links; i++) {
found = 0;
list_for_each_entry(dai, &dai_list, list)
if (card->dai_link[i].codec_dai == dai) {
found = 1;
break;
}
if (!found) {
dev_dbg(card->dev, "DAI %s not registered\n",
card->dai_link[i].codec_dai->name);
return;
}
}
/* Note that we do not current check for codec componen...
dev_dbg(card->dev, "All components present, instantiati...
/* Found everything, bring it up */
if (card->probe) {
ret = card->probe(pdev);
if (ret < 0)
return;
}
for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
-
--[[linux-2.6.33/snd_soc_dai]]
if (cpu_dai->probe) {
ret = cpu_dai->probe(pdev, cpu_dai);
if (ret < 0)
goto cpu_dai_err;
}
}
if (codec_dev->probe) {
ret = codec_dev->probe(pdev);
if (ret < 0)
goto cpu_dai_err;
}
codec = card->codec;
if (platform->probe) {
ret = platform->probe(pdev);
if (ret < 0)
goto platform_err;
}
/* DAPM stream work */
INIT_DELAYED_WORK(&card->delayed_work, close_delayed_wo...
#ifdef CONFIG_PM
/* deferred resume work */
INIT_WORK(&card->deferred_resume_work, soc_resume_defer...
#endif
-
--[[linux-2.6.33/INIT_DELAYED_WORK()]]
-
--[[linux-2.6.33/close_delayed_work()]]
-
--[[linux-2.6.33/INIT_WORK()]]
-
--[[linux-2.6.33/soc_resume_deferred()]]
for (i = 0; i < card->num_links; i++) {
if (card->dai_link[i].init) {
ret = card->dai_link[i].init(codec);
if (ret < 0) {
printk(KERN_ERR "asoc: failed to init %s\n",
card->dai_link[i].stream_name);
continue;
}
}
if (card->dai_link[i].codec_dai->ac97_control)
ac97 = 1;
}
-
--[[linux-2.6.33/printk()]]
snprintf(codec->card->shortname, sizeof(codec->card->sh...
"%s", card->name);
snprintf(codec->card->longname, sizeof(codec->card->lon...
"%s (%s)", card->name, codec->name);
-
--[[linux-2.6.33/snprintf()]]
/* Make sure all DAPM widgets are instantiated */
snd_soc_dapm_new_widgets(codec);
-
--[[linux-2.6.33/snd_soc_dapm_new_widgets()]]
ret = snd_card_register(codec->card);
if (ret < 0) {
printk(KERN_ERR "asoc: failed to register soundcard fo...
codec->name);
goto card_err;
}
-
--[[linux-2.6.33/snd_card_register()]]
mutex_lock(&codec->mutex);
#ifdef CONFIG_SND_SOC_AC97_BUS
-
--[[linux-2.6.33/mutex_lock()]]
-
--[[linux-2.6.33/CONFIG_SND_SOC_AC97_BUS]]
/* Only instantiate AC97 if not already done by the ada...
* for the generic AC97 subsystem.
*/
if (ac97 && strcmp(codec->name, "AC97") != 0) {
ret = soc_ac97_dev_register(codec);
if (ret < 0) {
printk(KERN_ERR "asoc: AC97 device register failed\n");
snd_card_free(codec->card);
mutex_unlock(&codec->mutex);
goto card_err;
}
}
-
--[[linux-2.6.33/soc_ac97_dev_register()]]
-
--[[linux-2.6.33/snd_card_free()]]
-
--[[linux-2.6.33/mutex_unlock()]]
#endif
ret = snd_soc_dapm_sys_add(card->socdev->dev);
if (ret < 0)
printk(KERN_WARNING "asoc: failed to add dapm sysfs en...
-
--[[linux-2.6.33/snd_soc_dapm_sys_add()]]
ret = device_create_file(card->socdev->dev, &dev_attr_c...
if (ret < 0)
printk(KERN_WARNING "asoc: failed to add codec sysfs f...
-
--[[linux-2.6.33/device_create_file()]]
soc_init_codec_debugfs(codec);
mutex_unlock(&codec->mutex);
-
--[[linux-2.6.33/soc_init_codec_debugfs()]]
card->instantiated = 1;
return;
card_err:
if (platform->remove)
platform->remove(pdev);
platform_err:
if (codec_dev->remove)
codec_dev->remove(pdev);
cpu_dai_err:
for (i--; i >= 0; i--) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (cpu_dai->remove)
cpu_dai->remove(pdev, cpu_dai);
}
if (card->remove)
card->remove(pdev);
}
*コメント [#fa140b93]
終了行:
*参照元 [#o19682d3]
#backlinks
*説明 [#de808bdd]
-パス: [[linux-2.6.33/sound/soc-core.c]]
-FIXME: これは何?
--説明
**引数 [#r3782659]
-struct snd_soc_card *card
--
--[[linux-2.6.33/snd_soc_card]]
**返り値 [#q853654f]
-なし
**参考 [#e15aa83d]
*実装 [#u7de6097]
static void snd_soc_instantiate_card(struct snd_soc_card...
{
struct platform_device *pdev = container_of(card->dev,
struct platform_device,
dev);
struct snd_soc_codec_device *codec_dev = card->socdev->...
struct snd_soc_codec *codec;
struct snd_soc_platform *platform;
struct snd_soc_dai *dai;
int i, found, ret, ac97;
-
--[[linux-2.6.33/platform_device]]
-
--[[linux-2.6.33/container_of()]]
-
--[[linux-2.6.33/snd_soc_codec_device]]
-
--[[linux-2.6.33/snd_soc_platform]]
-
--[[linux-2.6.33/snd_soc_dai]]
if (card->instantiated)
return;
found = 0;
list_for_each_entry(platform, &platform_list, list)
if (card->platform == platform) {
found = 1;
break;
}
if (!found) {
dev_dbg(card->dev, "Platform %s not registered\n",
card->platform->name);
return;
}
-デバイスが保持している snd_soc_platform と同一の platfor...
platform のリスト(platform_list)から探す。
--一致する platform がリスト内にあれば処理を続行、なけれ...
--[[linux-2.6.33/list_for_each_entry()]]
--[[linux-2.6.33/platform_list(global)]]
--[[linux-2.6.33/dev_dbg()]]
ac97 = 0;
for (i = 0; i < card->num_links; i++) {
found = 0;
list_for_each_entry(dai, &dai_list, list)
if (card->dai_link[i].cpu_dai == dai) {
found = 1;
break;
}
if (!found) {
dev_dbg(card->dev, "DAI %s not registered\n",
card->dai_link[i].cpu_dai->name);
return;
}
if (card->dai_link[i].cpu_dai->ac97_control)
ac97 = 1;
}
-
--[[linux-2.6.33/dai_list(global)]]
for (i = 0; i < card->num_links; i++) {
if (!card->dai_link[i].codec_dai->ops)
card->dai_link[i].codec_dai->ops = &null_dai_ops;
}
/* If we have AC97 in the system then don't wait for the
* codec. This will need revisiting if we have to handle
* systems with mixed AC97 and non-AC97 parts. Only ch...
* DAIs currently; we can't do this per link since some...
* codecs have non-AC97 DAIs.
*/
if (!ac97)
for (i = 0; i < card->num_links; i++) {
found = 0;
list_for_each_entry(dai, &dai_list, list)
if (card->dai_link[i].codec_dai == dai) {
found = 1;
break;
}
if (!found) {
dev_dbg(card->dev, "DAI %s not registered\n",
card->dai_link[i].codec_dai->name);
return;
}
}
/* Note that we do not current check for codec componen...
dev_dbg(card->dev, "All components present, instantiati...
/* Found everything, bring it up */
if (card->probe) {
ret = card->probe(pdev);
if (ret < 0)
return;
}
for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
-
--[[linux-2.6.33/snd_soc_dai]]
if (cpu_dai->probe) {
ret = cpu_dai->probe(pdev, cpu_dai);
if (ret < 0)
goto cpu_dai_err;
}
}
if (codec_dev->probe) {
ret = codec_dev->probe(pdev);
if (ret < 0)
goto cpu_dai_err;
}
codec = card->codec;
if (platform->probe) {
ret = platform->probe(pdev);
if (ret < 0)
goto platform_err;
}
/* DAPM stream work */
INIT_DELAYED_WORK(&card->delayed_work, close_delayed_wo...
#ifdef CONFIG_PM
/* deferred resume work */
INIT_WORK(&card->deferred_resume_work, soc_resume_defer...
#endif
-
--[[linux-2.6.33/INIT_DELAYED_WORK()]]
-
--[[linux-2.6.33/close_delayed_work()]]
-
--[[linux-2.6.33/INIT_WORK()]]
-
--[[linux-2.6.33/soc_resume_deferred()]]
for (i = 0; i < card->num_links; i++) {
if (card->dai_link[i].init) {
ret = card->dai_link[i].init(codec);
if (ret < 0) {
printk(KERN_ERR "asoc: failed to init %s\n",
card->dai_link[i].stream_name);
continue;
}
}
if (card->dai_link[i].codec_dai->ac97_control)
ac97 = 1;
}
-
--[[linux-2.6.33/printk()]]
snprintf(codec->card->shortname, sizeof(codec->card->sh...
"%s", card->name);
snprintf(codec->card->longname, sizeof(codec->card->lon...
"%s (%s)", card->name, codec->name);
-
--[[linux-2.6.33/snprintf()]]
/* Make sure all DAPM widgets are instantiated */
snd_soc_dapm_new_widgets(codec);
-
--[[linux-2.6.33/snd_soc_dapm_new_widgets()]]
ret = snd_card_register(codec->card);
if (ret < 0) {
printk(KERN_ERR "asoc: failed to register soundcard fo...
codec->name);
goto card_err;
}
-
--[[linux-2.6.33/snd_card_register()]]
mutex_lock(&codec->mutex);
#ifdef CONFIG_SND_SOC_AC97_BUS
-
--[[linux-2.6.33/mutex_lock()]]
-
--[[linux-2.6.33/CONFIG_SND_SOC_AC97_BUS]]
/* Only instantiate AC97 if not already done by the ada...
* for the generic AC97 subsystem.
*/
if (ac97 && strcmp(codec->name, "AC97") != 0) {
ret = soc_ac97_dev_register(codec);
if (ret < 0) {
printk(KERN_ERR "asoc: AC97 device register failed\n");
snd_card_free(codec->card);
mutex_unlock(&codec->mutex);
goto card_err;
}
}
-
--[[linux-2.6.33/soc_ac97_dev_register()]]
-
--[[linux-2.6.33/snd_card_free()]]
-
--[[linux-2.6.33/mutex_unlock()]]
#endif
ret = snd_soc_dapm_sys_add(card->socdev->dev);
if (ret < 0)
printk(KERN_WARNING "asoc: failed to add dapm sysfs en...
-
--[[linux-2.6.33/snd_soc_dapm_sys_add()]]
ret = device_create_file(card->socdev->dev, &dev_attr_c...
if (ret < 0)
printk(KERN_WARNING "asoc: failed to add codec sysfs f...
-
--[[linux-2.6.33/device_create_file()]]
soc_init_codec_debugfs(codec);
mutex_unlock(&codec->mutex);
-
--[[linux-2.6.33/soc_init_codec_debugfs()]]
card->instantiated = 1;
return;
card_err:
if (platform->remove)
platform->remove(pdev);
platform_err:
if (codec_dev->remove)
codec_dev->remove(pdev);
cpu_dai_err:
for (i--; i >= 0; i--) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (cpu_dai->remove)
cpu_dai->remove(pdev, cpu_dai);
}
if (card->remove)
card->remove(pdev);
}
*コメント [#fa140b93]
ページ名: