Lines Matching +full:dai +full:- +full:links

1 // SPDX-License-Identifier: GPL-2.0
8 // based on ${LINUX}/sound/soc/generic/simple-card.c
29 struct snd_soc_dapm_context *dapm = w->dapm; in graph_outdrv_event()
30 struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(dapm->card); in graph_outdrv_event()
34 gpiod_set_value_cansleep(priv->pa_gpio, 1); in graph_outdrv_event()
37 gpiod_set_value_cansleep(priv->pa_gpio, 0); in graph_outdrv_event()
40 return -EINVAL; in graph_outdrv_event()
67 /* use driver specified DAI ID if exist */ in graph_get_dai_id()
69 if (ret != -ENOTSUPP) in graph_get_dai_id()
97 id = -1; in graph_get_dai_id()
107 return -ENODEV; in graph_get_dai_id()
114 struct snd_soc_dai *dai = snd_soc_find_dai_with_mutex(dlc); in soc_component_is_pcm() local
116 if (dai && (dai->component->driver->pcm_construct || in soc_component_is_pcm()
117 dai->driver->pcm_new)) in soc_component_is_pcm()
136 /* Get dai->name */ in asoc_simple_parse_dai()
144 * Here, dlc->dai_name is pointer to CPU/Codec DAI name. in asoc_simple_parse_dai()
146 * dlc->dai_name is keeping unbinded CPU or Codec in asoc_simple_parse_dai()
149 * If user re-bind CPU or Codec driver again, ALSA SoC will try in asoc_simple_parse_dai()
160 ret = snd_soc_get_dai_name(&args, &dlc->dai_name); in asoc_simple_parse_dai()
166 dlc->of_node = node; in asoc_simple_parse_dai()
178 struct device_node *top = dev->of_node; in graph_parse_convert()
201 of_property_read_u32(top, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
203 of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
204 of_property_read_u32(port, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
205 of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
217 struct device_node *top = dev->of_node; in graph_parse_node()
218 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_parse_node()
219 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in graph_parse_node()
221 struct asoc_simple_dai *dai; in graph_parse_node() local
226 dai = simple_props_to_dai_cpu(dai_props, 0); in graph_parse_node()
229 dai = simple_props_to_dai_codec(dai_props, 0); in graph_parse_node()
238 ret = asoc_simple_parse_tdm(ep, dai); in graph_parse_node()
242 ret = asoc_simple_parse_clk(dev, ep, dai, dlc); in graph_parse_node()
256 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
260 NULL, &dai_link->dai_fmt); in graph_link_init()
264 dai_link->init = asoc_simple_dai_init; in graph_link_init()
265 dai_link->ops = &graph_ops; in graph_link_init()
266 if (priv->ops) in graph_link_init()
267 dai_link->ops = priv->ops; in graph_link_init()
278 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_dai_link_of_dpcm()
279 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in graph_dai_link_of_dpcm()
280 struct device_node *top = dev->of_node; in graph_dai_link_of_dpcm()
281 struct device_node *ep = li->cpu ? cpu_ep : codec_ep; in graph_dai_link_of_dpcm()
287 if (li->cpu) { in graph_dai_link_of_dpcm()
296 dai_link->dynamic = 1; in graph_dai_link_of_dpcm()
297 dai_link->dpcm_merged_format = 1; in graph_dai_link_of_dpcm()
304 "fe.%pOFP.%s", cpus->of_node, cpus->dai_name); in graph_dai_link_of_dpcm()
306 * In BE<->BE connections it is not required to create in graph_dai_link_of_dpcm()
307 * PCM devices at CPU end of the dai link and thus 'no_pcm' in graph_dai_link_of_dpcm()
312 * For example: FE <-> BE1 <-> BE2 <-> ... <-> BEn where in graph_dai_link_of_dpcm()
315 if (card->component_chaining && !soc_component_is_pcm(cpus)) { in graph_dai_link_of_dpcm()
316 dai_link->no_pcm = 1; in graph_dai_link_of_dpcm()
317 dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; in graph_dai_link_of_dpcm()
331 dai_link->no_pcm = 1; in graph_dai_link_of_dpcm()
332 dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; in graph_dai_link_of_dpcm()
339 "be.%pOFP.%s", codecs->of_node, codecs->dai_name); in graph_dai_link_of_dpcm()
344 snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node, in graph_dai_link_of_dpcm()
347 snd_soc_of_parse_node_prefix(ports, cconf, codecs->of_node, "prefix"); in graph_dai_link_of_dpcm()
348 snd_soc_of_parse_node_prefix(port, cconf, codecs->of_node, in graph_dai_link_of_dpcm()
355 graph_parse_convert(dev, ep, &dai_props->adata); in graph_dai_link_of_dpcm()
361 li->link++; in graph_dai_link_of_dpcm()
372 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_dai_link_of()
390 "%s-%s", cpus->dai_name, codecs->dai_name); in graph_dai_link_of()
399 li->link++; in graph_dai_link_of()
408 if (priv->force_dpcm) in parse_as_dpcm_link()
411 if (!priv->dpcm_selectable) in parse_as_dpcm_link()
417 * or has convert-xxx property in parse_as_dpcm_link()
439 struct device_node *node = dev->of_node; in __graph_for_each_link()
463 /* get convert-xxx property */ in __graph_for_each_link()
476 if (li->cpu || in __graph_for_each_link()
481 if (li->cpu) in __graph_for_each_link()
514 * as "CPU-Codec". in graph_for_each_link()
517 * all CPUs are detected as "CPU-dummy", and in graph_for_each_link()
518 * all Codecs are detected as "dummy-Codec". in graph_for_each_link()
519 * To avoid random sub-device numbering, in graph_for_each_link()
520 * detect "dummy-Codec" in last; in graph_for_each_link()
522 for (li->cpu = 1; li->cpu >= 0; li->cpu--) { in graph_for_each_link()
542 return -ENOMEM; in audio_graph_parse_of()
544 card->owner = THIS_MODULE; in audio_graph_parse_of()
545 card->dev = dev; in audio_graph_parse_of()
551 if (!li->link) in audio_graph_parse_of()
552 return -EINVAL; in audio_graph_parse_of()
558 priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW); in audio_graph_parse_of()
559 if (IS_ERR(priv->pa_gpio)) { in audio_graph_parse_of()
560 ret = PTR_ERR(priv->pa_gpio); in audio_graph_parse_of()
609 if (li->link >= SNDRV_MAX_LINKS) { in graph_count_noml()
610 dev_err(dev, "too many links\n"); in graph_count_noml()
611 return -EINVAL; in graph_count_noml()
614 li->num[li->link].cpus = 1; in graph_count_noml()
615 li->num[li->link].codecs = 1; in graph_count_noml()
616 li->num[li->link].platforms = 1; in graph_count_noml()
618 li->link += 1; /* 1xCPU-Codec */ in graph_count_noml()
632 if (li->link >= SNDRV_MAX_LINKS) { in graph_count_dpcm()
633 dev_err(dev, "too many links\n"); in graph_count_dpcm()
634 return -EINVAL; in graph_count_dpcm()
637 if (li->cpu) { in graph_count_dpcm()
638 li->num[li->link].cpus = 1; in graph_count_dpcm()
639 li->num[li->link].platforms = 1; in graph_count_dpcm()
641 li->link++; /* 1xCPU-dummy */ in graph_count_dpcm()
643 li->num[li->link].codecs = 1; in graph_count_dpcm()
645 li->link++; /* 1xdummy-Codec */ in graph_count_dpcm()
657 * link_num : number of links. in graph_get_dais_count()
658 * CPU-Codec / CPU-dummy / dummy-Codec in graph_get_dais_count()
661 * same number for "dummy-Codec" in graph_get_dais_count()
664 * CPU0 --- Codec0 link : 5 in graph_get_dais_count()
665 * CPU1 --- Codec1 dais : 7 in graph_get_dais_count()
666 * CPU2 -/ ccnf : 1 in graph_get_dais_count()
667 * CPU3 --- Codec2 in graph_get_dais_count()
669 * => 5 links = 2xCPU-Codec + 2xCPU-dummy + 1xdummy-Codec in graph_get_dais_count()
671 * => 1 ccnf = 1xdummy-Codec in graph_get_dais_count()
674 * CPU0 --- Codec0 link : 5 in graph_get_dais_count()
675 * CPU1 --- Codec1 dais : 6 in graph_get_dais_count()
676 * CPU2 -/ ccnf : 1 in graph_get_dais_count()
677 * CPU3 -/ in graph_get_dais_count()
679 * => 5 links = 1xCPU-Codec + 3xCPU-dummy + 1xdummy-Codec in graph_get_dais_count()
681 * => 1 ccnf = 1xdummy-Codec in graph_get_dais_count()
684 * CPU0 --- Codec0 link : 6 in graph_get_dais_count()
685 * CPU1 -/ dais : 6 in graph_get_dais_count()
686 * CPU2 --- Codec1 ccnf : 2 in graph_get_dais_count()
687 * CPU3 -/ in graph_get_dais_count()
689 * => 6 links = 0xCPU-Codec + 4xCPU-dummy + 2xdummy-Codec in graph_get_dais_count()
691 * => 2 ccnf = 2xdummy-Codec in graph_get_dais_count()
694 * CPU0 --- Codec0 (convert-rate) link : 3 in graph_get_dais_count()
695 * CPU1 --- Codec1 dais : 4 in graph_get_dais_count()
698 * => 3 links = 1xCPU-Codec + 1xCPU-dummy + 1xdummy-Codec in graph_get_dais_count()
700 * => 1 ccnf = 1xdummy-Codec in graph_get_dais_count()
710 struct device *dev = &pdev->dev; in graph_probe()
713 /* Allocate the private data and the DAI link array */ in graph_probe()
716 return -ENOMEM; in graph_probe()
719 card->dapm_widgets = graph_dapm_widgets; in graph_probe()
720 card->num_dapm_widgets = ARRAY_SIZE(graph_dapm_widgets); in graph_probe()
721 card->probe = asoc_graph_card_probe; in graph_probe()
724 priv->dpcm_selectable = 1; in graph_probe()
730 { .compatible = "audio-graph-card", },
731 { .compatible = "audio-graph-scu-card",
739 .name = "asoc-audio-graph-card",
748 MODULE_ALIAS("platform:asoc-audio-graph-card");