/* Loop over all the dai link sub nodes */
for_each_available_child_of_node(dev->of_node, sub_node) { if (of_property_read_string(sub_node, "link-name",
&dai_link_name)) {
of_node_put(sub_node); return -EINVAL;
}
for_each_card_prelinks(card, i, dai_link) { if (!strcmp(dai_link_name, dai_link->name)) break;
}
if (i >= card->num_links) {
of_node_put(sub_node); return -EINVAL;
}
ret = set_card_codec_info(card, sub_node, dai_link); if (ret < 0) {
of_node_put(sub_node); return ret;
}
ret = set_dailink_daifmt(card, sub_node, dai_link); if (ret < 0) {
of_node_put(sub_node); return ret;
}
}
ret = snd_soc_of_parse_card_name(card, "model"); if (ret) return ret;
if (!card->name) { if (!pdata->card_name) return -EINVAL;
card->name = pdata->card_name;
}
needs_legacy_probe = !of_property_present(pdev->dev.of_node, "audio-routing"); if (needs_legacy_probe) { /* * If we have no .soc_probe() callback there's no way of using * any legacy probe mechanism, as that cannot not be generic.
*/ if (!pdata->soc_probe) return -EINVAL;
dev_info_once(&pdev->dev, "audio-routing not found: using legacy probe\n");
} else {
ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); if (ret) return ret;
}
soc_card_data = devm_kzalloc(&pdev->dev, sizeof(*soc_card_data), GFP_KERNEL); if (!soc_card_data) return -ENOMEM;
soc_card_data->card_data = pdata->card_data;
jacks = devm_kcalloc(card->dev, soc_card_data->card_data->num_jacks, sizeof(*jacks), GFP_KERNEL); if (!jacks) return -ENOMEM;
soc_card_data->card_data->jacks = jacks;
accdet_node = of_parse_phandle(pdev->dev.of_node, "mediatek,accdet", 0); if (accdet_node) {
accdet_pdev = of_find_device_by_node(accdet_node); if (accdet_pdev) {
accdet_comp = snd_soc_lookup_component(&accdet_pdev->dev, NULL); if (accdet_comp)
soc_card_data->accdet = accdet_comp; else
dev_err(&pdev->dev, "No sound component found from mediatek,accdet property\n");
put_device(&accdet_pdev->dev);
} else {
dev_err(&pdev->dev, "No device found from mediatek,accdet property\n");
}
of_node_put(accdet_node);
}
platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0); if (!platform_node) return dev_err_probe(&pdev->dev, -EINVAL, "Property mediatek,platform missing or invalid\n");
/* Check if this SoC has an Audio DSP */ if (pdata->sof_priv)
adsp_node = of_parse_phandle(pdev->dev.of_node, "mediatek,adsp", 0); else
adsp_node = NULL;
if (adsp_node) { if (of_property_present(pdev->dev.of_node, "mediatek,dai-link")) {
ret = mtk_sof_dailink_parse_of(card, pdev->dev.of_node, "mediatek,dai-link",
card->dai_link, card->num_links); if (ret) {
of_node_put(adsp_node);
of_node_put(platform_node); return dev_err_probe(&pdev->dev, ret, "Cannot parse mediatek,dai-link\n");
}
}
/* * Regardless of whether the ADSP is wanted and/or present in a machine * specific device tree or not and regardless of whether any AFE_SOF * link is present, we have to make sure that the platforms->of_node * is not NULL, and set to either ADSP (adsp_node) or AFE (platform_node).
*/
for_each_card_prelinks(card, i, dai_link) { if (adsp_node && !strncmp(dai_link->name, "AFE_SOF", strlen("AFE_SOF")))
dai_link->platforms->of_node = adsp_node; elseif (!dai_link->platforms->name && !dai_link->platforms->of_node)
dai_link->platforms->of_node = platform_node;
}
if (!needs_legacy_probe) {
ret = parse_dai_link_info(card); if (ret) goto err_restore_dais;
} else { if (adsp_node)
of_node_put(adsp_node);
of_node_put(platform_node);
}
if (pdata->soc_probe) {
ret = pdata->soc_probe(soc_card_data, needs_legacy_probe); if (ret) { if (!needs_legacy_probe)
clean_card_reference(card); goto err_restore_dais;
}
}
snd_soc_card_set_drvdata(card, soc_card_data);
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (!needs_legacy_probe)
clean_card_reference(card);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.