Lines Matching +full:num +full:- +full:ports

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()
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()
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()
164 dlc->of_node = node; in asoc_simple_parse_dai()
176 struct device_node *top = dev->of_node; in graph_parse_convert()
178 struct device_node *ports = of_get_parent(port); in graph_parse_convert() local
182 if (of_node_name_eq(ports, "ports")) in graph_parse_convert()
183 asoc_simple_parse_convert(ports, NULL, adata); in graph_parse_convert()
188 of_node_put(ports); in graph_parse_convert()
197 struct device_node *ports = of_get_parent(port); in graph_parse_mclk_fs() local
199 of_property_read_u32(top, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
200 if (of_node_name_eq(ports, "ports")) in graph_parse_mclk_fs()
201 of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
202 of_property_read_u32(port, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
203 of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
206 of_node_put(ports); in graph_parse_mclk_fs()
215 struct device_node *top = dev->of_node; in graph_parse_node()
216 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_parse_node()
217 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in graph_parse_node()
254 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
258 NULL, &dai_link->dai_fmt); in graph_link_init()
262 dai_link->init = asoc_simple_dai_init; in graph_link_init()
263 dai_link->ops = &graph_ops; in graph_link_init()
264 if (priv->ops) in graph_link_init()
265 dai_link->ops = priv->ops; in graph_link_init()
276 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_dai_link_of_dpcm()
277 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in graph_dai_link_of_dpcm()
278 struct device_node *top = dev->of_node; in graph_dai_link_of_dpcm()
279 struct device_node *ep = li->cpu ? cpu_ep : codec_ep; in graph_dai_link_of_dpcm()
285 if (li->cpu) { in graph_dai_link_of_dpcm()
294 dai_link->dynamic = 1; in graph_dai_link_of_dpcm()
295 dai_link->dpcm_merged_format = 1; in graph_dai_link_of_dpcm()
302 "fe.%pOFP.%s", cpus->of_node, cpus->dai_name); in graph_dai_link_of_dpcm()
304 * In BE<->BE connections it is not required to create in graph_dai_link_of_dpcm()
310 * For example: FE <-> BE1 <-> BE2 <-> ... <-> BEn where in graph_dai_link_of_dpcm()
313 if (card->component_chaining && !soc_component_is_pcm(cpus)) in graph_dai_link_of_dpcm()
314 dai_link->no_pcm = 1; in graph_dai_link_of_dpcm()
322 struct device_node *ports; in graph_dai_link_of_dpcm() local
327 dai_link->no_pcm = 1; in graph_dai_link_of_dpcm()
328 dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; in graph_dai_link_of_dpcm()
335 "be.%pOFP.%s", codecs->of_node, codecs->dai_name); in graph_dai_link_of_dpcm()
339 ports = of_get_parent(port); in graph_dai_link_of_dpcm()
340 snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node, in graph_dai_link_of_dpcm()
342 if (of_node_name_eq(ports, "ports")) in graph_dai_link_of_dpcm()
343 snd_soc_of_parse_node_prefix(ports, cconf, codecs->of_node, "prefix"); in graph_dai_link_of_dpcm()
344 snd_soc_of_parse_node_prefix(port, cconf, codecs->of_node, in graph_dai_link_of_dpcm()
347 of_node_put(ports); in graph_dai_link_of_dpcm()
351 graph_parse_convert(dev, ep, &dai_props->adata); in graph_dai_link_of_dpcm()
357 li->link++; in graph_dai_link_of_dpcm()
368 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_dai_link_of()
386 "%s-%s", cpus->dai_name, codecs->dai_name); in graph_dai_link_of()
395 li->link++; in graph_dai_link_of()
404 if (priv->force_dpcm) in parse_as_dpcm_link()
407 if (!priv->dpcm_selectable) in parse_as_dpcm_link()
413 * or has convert-xxx property in parse_as_dpcm_link()
416 (adata->convert_rate || adata->convert_channels)) in parse_as_dpcm_link()
435 struct device_node *node = dev->of_node; in __graph_for_each_link()
459 /* get convert-xxx property */ in __graph_for_each_link()
472 if (li->cpu || in __graph_for_each_link()
477 if (li->cpu) in __graph_for_each_link()
510 * as "CPU-Codec". in graph_for_each_link()
513 * all CPUs are detected as "CPU-dummy", and in graph_for_each_link()
514 * all Codecs are detected as "dummy-Codec". in graph_for_each_link()
515 * To avoid random sub-device numbering, in graph_for_each_link()
516 * detect "dummy-Codec" in last; in graph_for_each_link()
518 for (li->cpu = 1; li->cpu >= 0; li->cpu--) { in graph_for_each_link()
538 return -ENOMEM; in audio_graph_parse_of()
540 card->owner = THIS_MODULE; in audio_graph_parse_of()
541 card->dev = dev; in audio_graph_parse_of()
547 if (!li->link) in audio_graph_parse_of()
548 return -EINVAL; in audio_graph_parse_of()
554 priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW); in audio_graph_parse_of()
555 if (IS_ERR(priv->pa_gpio)) { in audio_graph_parse_of()
556 ret = PTR_ERR(priv->pa_gpio); in audio_graph_parse_of()
594 if (ret != -EPROBE_DEFER) in audio_graph_parse_of()
608 if (li->link >= SNDRV_MAX_LINKS) { in graph_count_noml()
610 return -EINVAL; in graph_count_noml()
613 li->num[li->link].cpus = 1; in graph_count_noml()
614 li->num[li->link].codecs = 1; in graph_count_noml()
615 li->num[li->link].platforms = 1; in graph_count_noml()
617 li->link += 1; /* 1xCPU-Codec */ in graph_count_noml()
631 if (li->link >= SNDRV_MAX_LINKS) { in graph_count_dpcm()
633 return -EINVAL; in graph_count_dpcm()
636 if (li->cpu) { in graph_count_dpcm()
637 li->num[li->link].cpus = 1; in graph_count_dpcm()
638 li->num[li->link].platforms = 1; in graph_count_dpcm()
640 li->link++; /* 1xCPU-dummy */ in graph_count_dpcm()
642 li->num[li->link].codecs = 1; in graph_count_dpcm()
644 li->link++; /* 1xdummy-Codec */ in graph_count_dpcm()
657 * CPU-Codec / CPU-dummy / dummy-Codec in graph_get_dais_count()
660 * same number for "dummy-Codec" in graph_get_dais_count()
663 * CPU0 --- Codec0 link : 5 in graph_get_dais_count()
664 * CPU1 --- Codec1 dais : 7 in graph_get_dais_count()
665 * CPU2 -/ ccnf : 1 in graph_get_dais_count()
666 * CPU3 --- Codec2 in graph_get_dais_count()
668 * => 5 links = 2xCPU-Codec + 2xCPU-dummy + 1xdummy-Codec in graph_get_dais_count()
670 * => 1 ccnf = 1xdummy-Codec in graph_get_dais_count()
673 * CPU0 --- Codec0 link : 5 in graph_get_dais_count()
674 * CPU1 --- Codec1 dais : 6 in graph_get_dais_count()
675 * CPU2 -/ ccnf : 1 in graph_get_dais_count()
676 * CPU3 -/ in graph_get_dais_count()
678 * => 5 links = 1xCPU-Codec + 3xCPU-dummy + 1xdummy-Codec in graph_get_dais_count()
680 * => 1 ccnf = 1xdummy-Codec in graph_get_dais_count()
683 * CPU0 --- Codec0 link : 6 in graph_get_dais_count()
684 * CPU1 -/ dais : 6 in graph_get_dais_count()
685 * CPU2 --- Codec1 ccnf : 2 in graph_get_dais_count()
686 * CPU3 -/ in graph_get_dais_count()
688 * => 6 links = 0xCPU-Codec + 4xCPU-dummy + 2xdummy-Codec in graph_get_dais_count()
690 * => 2 ccnf = 2xdummy-Codec in graph_get_dais_count()
693 * CPU0 --- Codec0 (convert-rate) link : 3 in graph_get_dais_count()
694 * CPU1 --- Codec1 dais : 4 in graph_get_dais_count()
697 * => 3 links = 1xCPU-Codec + 1xCPU-dummy + 1xdummy-Codec in graph_get_dais_count()
699 * => 1 ccnf = 1xdummy-Codec in graph_get_dais_count()
709 struct device *dev = &pdev->dev; in graph_probe()
715 return -ENOMEM; in graph_probe()
718 card->dapm_widgets = graph_dapm_widgets; in graph_probe()
719 card->num_dapm_widgets = ARRAY_SIZE(graph_dapm_widgets); in graph_probe()
720 card->probe = asoc_graph_card_probe; in graph_probe()
723 priv->dpcm_selectable = 1; in graph_probe()
729 { .compatible = "audio-graph-card", },
730 { .compatible = "audio-graph-scu-card",
738 .name = "asoc-audio-graph-card",
747 MODULE_ALIAS("platform:asoc-audio-graph-card");