soc-core.c
soc_probe
platform_get_drvdata(pdev)//获取声卡
snd_soc_register_card
snd_soc_instantiate_card
static int snd_soc_instantiate_card(struct snd_soc_card *card)
{
struct snd_soc_codec *codec;
struct snd_soc_dai_link *dai_link;
int ret, i, order, dai_fmt;
//card->rtd对象绑定codec dai、codec、cpu dai、platform
for (i = 0; i < card->num_links; i++) {
ret = soc_bind_dai_link(card, i);
}
/* card bind complete so register a sound card */
ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
card->owner, 0, &card->snd_card);
card->dapm.bias_level = SND_SOC_BIAS_OFF;
card->dapm.dev = card->dev;
card->dapm.card = card;
list_add(&card->dapm.list, &card->dapm_list);
/* initialise the sound card only once */
if (card->probe) {
ret = card->probe(card);
}
/* probe all components used by DAI links on this card */
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) {
for (i = 0; i < card->num_links; i++) {
ret = soc_probe_link_components(card, i, order);
}
}
/* probe all DAI links on this card */
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) {
for (i = 0; i < card->num_links; i++) {
ret = soc_probe_link_dais(card, i, order);
}
}
if (card->controls)
snd_soc_add_card_controls(card, card->controls, card->num_controls);
ret = snd_card_register(card->snd_card);//注册声卡
card
Android音频驱动-ASOC之Sound Card注册
最新推荐文章于 2023-11-22 11:29:19 发布
这篇博客探讨了Android音频驱动中ASOC框架的Sound Card注册过程。内容包括创建control device并添加到声卡设备链表,以及注册声卡阶段,此阶段涉及PCM、MIX、CONTROL等逻辑设备,并通过snd_pcm_dev_register函数与用户空间应用程序建立通信节点。
摘要由CSDN通过智能技术生成