*参照元 [#rd857104]
#backlinks

*説明 [#h4545bb2]
-パス: [[linux-4.4.1/sound/soc/soc-core.c]]

-FIXME: これは何?
--説明


**引数 [#md666b9c]
-struct snd_soc_card *card
--
--[[linux-4.4.1/snd_soc_card]]


**返り値 [#oaab868e]
-int
--


**参考 [#h84ac2a9]


*実装 [#xb1da611]
 /**
  * snd_soc_register_card - Register a card with the ASoC core
  *
  * @card: Card to register
  *
  */
 int snd_soc_register_card(struct snd_soc_card *card)
 {
         int i, j, ret;
 
         if (!card->name || !card->dev)
                 return -EINVAL;
 
         for (i = 0; i < card->num_links; i++) {
                 struct snd_soc_dai_link *link = &card->dai_link[i];
 
-
--[[linux-4.4.1/snd_soc_dai_link]]

                 ret = snd_soc_init_multicodec(card, link);
                 if (ret) {
                         dev_err(card->dev, "ASoC: failed to init multicodec\n");
                         return ret;
                 }
 
-
--[[linux-4.4.1/snd_soc_init_multicodec()]]
--[[linux-4.4.1/dev_err()]]

                 for (j = 0; j < link->num_codecs; j++) {
                         /*
                          * Codec must be specified by 1 of name or OF node,
                          * not both or neither.
                          */
                         if (!!link->codecs[j].name ==
                             !!link->codecs[j].of_node) {
                                 dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n",
                                         link->name);
                                 return -EINVAL;
                         }
                         /* Codec DAI name must be specified */
                         if (!link->codecs[j].dai_name) {
                                 dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n",
                                         link->name);
                                 return -EINVAL;
                         }
                 }
 
                 /*
                  * Platform may be specified by either name or OF node, but
                  * can be left unspecified, and a dummy platform will be used.
                  */
                 if (link->platform_name && link->platform_of_node) {
                         dev_err(card->dev,
                                 "ASoC: Both platform name/of_node are set for %s\n",
                                 link->name);
                         return -EINVAL;
                 }
 
                 /*
                  * CPU device may be specified by either name or OF node, but
                  * can be left unspecified, and will be matched based on DAI
                  * name alone..
                  */
                 if (link->cpu_name && link->cpu_of_node) {
                         dev_err(card->dev,
                                 "ASoC: Neither/both cpu name/of_node are set for %s\n",
                                 link->name);
                         return -EINVAL;
                 }
                 /*
                  * At least one of CPU DAI name or CPU device name/node must be
                  * specified
                  */
                 if (!link->cpu_dai_name &&
                     !(link->cpu_name || link->cpu_of_node)) {
                         dev_err(card->dev,
                                 "ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s\n",
                                 link->name);
                         return -EINVAL;
                 }
         }
 
         dev_set_drvdata(card->dev, card);
 
-
--[[linux-4.4.1/dev_set_drvdata()]]

         snd_soc_initialize_card_lists(card);
 
-
--[[linux-4.4.1/snd_soc_initialize_card_lists()]]

         card->rtd = devm_kzalloc(card->dev,
                                  sizeof(struct snd_soc_pcm_runtime) *
                                  (card->num_links + card->num_aux_devs),
                                  GFP_KERNEL);
         if (card->rtd == NULL)
                 return -ENOMEM;
         card->num_rtd = 0;
         card->rtd_aux = &card->rtd[card->num_links];
 
-
--[[linux-4.4.1/devm_kzalloc()]]

         for (i = 0; i < card->num_links; i++) {
                 card->rtd[i].card = card;
                 card->rtd[i].dai_link = &card->dai_link[i];
                 card->rtd[i].codec_dais = devm_kzalloc(card->dev,
                                         sizeof(struct snd_soc_dai *) *
                                         (card->rtd[i].dai_link->num_codecs),
                                         GFP_KERNEL);
                 if (card->rtd[i].codec_dais == NULL)
                         return -ENOMEM;
         }
 
         for (i = 0; i < card->num_aux_devs; i++)
                 card->rtd_aux[i].card = card;
 
         INIT_LIST_HEAD(&card->dapm_dirty);
         INIT_LIST_HEAD(&card->dobj_list);
         card->instantiated = 0;
         mutex_init(&card->mutex);
         mutex_init(&card->dapm_mutex);
 
-
--[[linux-4.4.1/INIT_LIST_HEAD()]]
--[[linux-4.4.1/mutex_init()]]

         ret = snd_soc_instantiate_card(card);
         if (ret != 0)
                 return ret;
 
-
--[[linux-4.4.1/snd_soc_instantiate_card()]]

         /* deactivate pins to sleep state */
         for (i = 0; i < card->num_rtd; i++) {
                 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
                 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
                 int j;
 
-
--[[linux-4.4.1/snd_soc_pcm_runtime]]
--[[linux-4.4.1/snd_soc_dai]]

                 for (j = 0; j < rtd->num_codecs; j++) {
                         struct snd_soc_dai *codec_dai = rtd->codec_dais[j];
                         if (!codec_dai->active)
                                 pinctrl_pm_select_sleep_state(codec_dai->dev);
                 }
 
-
--[[linux-4.4.1/pinctrl_pm_select_sleep_state()]]

                 if (!cpu_dai->active)
                         pinctrl_pm_select_sleep_state(cpu_dai->dev);
         }
 
         return ret;
 }


*コメント [#bdbdd691]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS