Lines Matching +full:additional +full:- +full:devs
1 // SPDX-License-Identifier: GPL-2.0
17 #include <sound/soc-dai.h>
22 #define DAI "sound-dai"
23 #define CELL "#sound-dai-cells"
24 #define PREFIX "simple-audio-card,"
41 * Get node via "sound-dai = <&phandle port>" in simple_parse_platform()
50 dlc->of_node = args.np; in simple_parse_platform()
68 * Get node via "sound-dai = <&phandle port>" in simple_parse_dai()
80 dlc->dai_name = snd_soc_dai_name_get(dai); in simple_parse_dai()
81 dlc->dai_args = snd_soc_copy_dai_args(dev, &args); in simple_parse_dai()
82 if (!dlc->dai_args) in simple_parse_dai()
83 return -ENOMEM; in simple_parse_dai()
91 * Here, dlc->dai_name is pointer to CPU/Codec DAI name. in simple_parse_dai()
93 * dlc->dai_name is keeping unbinded CPU or Codec in simple_parse_dai()
96 * If user re-bind CPU or Codec driver again, ALSA SoC will try in simple_parse_dai()
122 struct device_node *top = dev->of_node; in simple_parse_convert()
140 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in simple_parse_node()
141 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in simple_parse_node()
176 struct device_node *top = dev->of_node; in simple_link_init()
177 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in simple_link_init()
178 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in simple_link_init()
186 prefix, &dai_link->dai_fmt); in simple_link_init()
195 of_property_read_u32(top, "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
196 of_property_read_u32(top, PREFIX "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
197 of_property_read_u32(node, "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
198 of_property_read_u32(node, PREFIX "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
199 of_property_read_u32(cpu, "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
200 of_property_read_u32(cpu, PREFIX "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
201 of_property_read_u32(codec, "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
202 of_property_read_u32(codec, PREFIX "mclk-fs", &dai_props->mclk_fs); in simple_link_init()
209 dai_link->playback_only = playback_only; in simple_link_init()
210 dai_link->capture_only = capture_only; in simple_link_init()
212 dai_link->trigger_start = trigger_start; in simple_link_init()
213 dai_link->trigger_stop = trigger_stop; in simple_link_init()
215 dai_link->init = simple_util_dai_init; in simple_link_init()
216 dai_link->ops = &simple_ops; in simple_link_init()
232 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in simple_dai_link_of_dpcm()
233 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in simple_dai_link_of_dpcm()
234 struct device_node *top = dev->of_node; in simple_dai_link_of_dpcm()
246 if (li->cpu) { in simple_dai_link_of_dpcm()
254 dai_link->dynamic = 1; in simple_dai_link_of_dpcm()
255 dai_link->dpcm_merged_format = 1; in simple_dai_link_of_dpcm()
261 snprintf(dai_name, sizeof(dai_name), "fe.%s", cpus->dai_name); in simple_dai_link_of_dpcm()
272 dai_link->no_pcm = 1; in simple_dai_link_of_dpcm()
273 dai_link->be_hw_params_fixup = simple_util_be_hw_params_fixup; in simple_dai_link_of_dpcm()
281 snprintf(dai_name, sizeof(dai_name), "be.%s", codecs->dai_name); in simple_dai_link_of_dpcm()
284 snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node, in simple_dai_link_of_dpcm()
286 snd_soc_of_parse_node_prefix(node, cconf, codecs->of_node, in simple_dai_link_of_dpcm()
288 snd_soc_of_parse_node_prefix(np, cconf, codecs->of_node, in simple_dai_link_of_dpcm()
292 simple_parse_convert(dev, np, &dai_props->adata); in simple_dai_link_of_dpcm()
297 li->link++; in simple_dai_link_of_dpcm()
310 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in simple_dai_link_of()
347 "%s-%s", cpus->dai_name, codecs->dai_name); in simple_dai_link_of()
358 li->link++; in simple_dai_link_of()
375 struct device_node *top = dev->of_node; in __simple_for_each_link()
382 /* Check if it has dai-link */ in __simple_for_each_link()
383 node = of_get_child_by_name(top, PREFIX "dai-link"); in __simple_for_each_link()
389 add_devs = of_get_child_by_name(top, PREFIX "additional-devs"); in __simple_for_each_link()
391 /* loop for all dai-link */ in __simple_for_each_link()
399 /* Skip additional-devs node */ in __simple_for_each_link()
409 ret = -ENODEV; in __simple_for_each_link()
416 /* get convert-xxx property */ in __simple_for_each_link()
431 * or has convert-xxx property in __simple_for_each_link()
437 * |1(CPU)|0(Codec) li->cpu in __simple_for_each_link()
441 if (li->cpu != (np == codec)) in __simple_for_each_link()
447 * |1(CPU)|0(Codec) li->cpu in __simple_for_each_link()
451 if (li->cpu && (np != codec)) in __simple_for_each_link()
490 * as "CPU-Codec". in simple_for_each_link()
493 * all CPUs are detected as "CPU-dummy", and in simple_for_each_link()
494 * all Codecs are detected as "dummy-Codec". in simple_for_each_link()
495 * To avoid random sub-device numbering, in simple_for_each_link()
496 * detect "dummy-Codec" in last; in simple_for_each_link()
498 for (li->cpu = 1; li->cpu >= 0; li->cpu--) { in simple_for_each_link()
520 node = of_get_child_by_name(dev->of_node, PREFIX "additional-devs"); in simple_populate_aux()
565 ret = snd_soc_of_parse_aux_devs(card, PREFIX "aux-devs"); in simple_parse_of()
575 if (li->link >= SNDRV_MAX_LINKS) { in simple_count_noml()
579 return -EINVAL; in simple_count_noml()
585 * Some CPU might be using soc-generic-dmaengine-pcm. This means CPU and Platform in simple_count_noml()
586 * are different Component, but are sharing same component->dev. in simple_count_noml()
594 * simple-card-utils.c :: simple_util_canonicalize_platform() in simple_count_noml()
596 li->num[li->link].cpus = 1; in simple_count_noml()
597 li->num[li->link].platforms = 1; in simple_count_noml()
599 li->num[li->link].codecs = 1; in simple_count_noml()
601 li->link += 1; in simple_count_noml()
611 if (li->link >= SNDRV_MAX_LINKS) { in simple_count_dpcm()
615 return -EINVAL; in simple_count_dpcm()
618 if (li->cpu) { in simple_count_dpcm()
624 li->num[li->link].cpus = 1; in simple_count_dpcm()
625 li->num[li->link].platforms = 1; in simple_count_dpcm()
627 li->link++; /* CPU-dummy */ in simple_count_dpcm()
629 li->num[li->link].codecs = 1; in simple_count_dpcm()
631 li->link++; /* dummy-Codec */ in simple_count_dpcm()
641 struct device_node *top = dev->of_node; in simple_get_dais_count()
645 * CPU-Codec / CPU-dummy / dummy-Codec in simple_get_dais_count()
648 * same number for "dummy-Codec" in simple_get_dais_count()
651 * CPU0 --- Codec0 link : 5 in simple_get_dais_count()
652 * CPU1 --- Codec1 dais : 7 in simple_get_dais_count()
653 * CPU2 -/ ccnf : 1 in simple_get_dais_count()
654 * CPU3 --- Codec2 in simple_get_dais_count()
656 * => 5 links = 2xCPU-Codec + 2xCPU-dummy + 1xdummy-Codec in simple_get_dais_count()
658 * => 1 ccnf = 1xdummy-Codec in simple_get_dais_count()
661 * CPU0 --- Codec0 link : 5 in simple_get_dais_count()
662 * CPU1 --- Codec1 dais : 6 in simple_get_dais_count()
663 * CPU2 -/ ccnf : 1 in simple_get_dais_count()
664 * CPU3 -/ in simple_get_dais_count()
666 * => 5 links = 1xCPU-Codec + 3xCPU-dummy + 1xdummy-Codec in simple_get_dais_count()
668 * => 1 ccnf = 1xdummy-Codec in simple_get_dais_count()
671 * CPU0 --- Codec0 link : 6 in simple_get_dais_count()
672 * CPU1 -/ dais : 6 in simple_get_dais_count()
673 * CPU2 --- Codec1 ccnf : 2 in simple_get_dais_count()
674 * CPU3 -/ in simple_get_dais_count()
676 * => 6 links = 0xCPU-Codec + 4xCPU-dummy + 2xdummy-Codec in simple_get_dais_count()
678 * => 2 ccnf = 2xdummy-Codec in simple_get_dais_count()
681 * CPU0 --- Codec0 (convert-rate) link : 3 in simple_get_dais_count()
682 * CPU1 --- Codec1 dais : 4 in simple_get_dais_count()
685 * => 3 links = 1xCPU-Codec + 1xCPU-dummy + 1xdummy-Codec in simple_get_dais_count()
687 * => 1 ccnf = 1xdummy-Codec in simple_get_dais_count()
690 li->num[0].cpus = 1; in simple_get_dais_count()
691 li->num[0].codecs = 1; in simple_get_dais_count()
692 li->num[0].platforms = 1; in simple_get_dais_count()
694 li->link = 1; in simple_get_dais_count()
708 ret = simple_util_init_hp(card, &priv->hp_jack, PREFIX); in simple_soc_probe()
712 ret = simple_util_init_mic(card, &priv->mic_jack, PREFIX); in simple_soc_probe()
726 struct device *dev = &pdev->dev; in simple_probe()
727 struct device_node *np = dev->of_node; in simple_probe()
734 return -ENOMEM; in simple_probe()
737 card->owner = THIS_MODULE; in simple_probe()
738 card->dev = dev; in simple_probe()
739 card->probe = simple_soc_probe; in simple_probe()
740 card->driver_name = "simple-card"; in simple_probe()
744 return -ENOMEM; in simple_probe()
750 if (!li->link) in simple_probe()
751 return -EINVAL; in simple_probe()
770 struct snd_soc_dai_link *dai_link = priv->dai_link; in simple_probe()
771 struct simple_dai_props *dai_props = priv->dai_props; in simple_probe()
773 ret = -EINVAL; in simple_probe()
775 cinfo = dev->platform_data; in simple_probe()
777 dev_err(dev, "no info for asoc-simple-card\n"); in simple_probe()
781 if (!cinfo->name || in simple_probe()
782 !cinfo->codec_dai.name || in simple_probe()
783 !cinfo->codec || in simple_probe()
784 !cinfo->platform || in simple_probe()
785 !cinfo->cpu_dai.name) { in simple_probe()
790 cpus = dai_link->cpus; in simple_probe()
791 cpus->dai_name = cinfo->cpu_dai.name; in simple_probe()
793 codecs = dai_link->codecs; in simple_probe()
794 codecs->name = cinfo->codec; in simple_probe()
795 codecs->dai_name = cinfo->codec_dai.name; in simple_probe()
797 platform = dai_link->platforms; in simple_probe()
798 platform->name = cinfo->platform; in simple_probe()
800 card->name = (cinfo->card) ? cinfo->card : cinfo->name; in simple_probe()
801 dai_link->name = cinfo->name; in simple_probe()
802 dai_link->stream_name = cinfo->name; in simple_probe()
803 dai_link->dai_fmt = cinfo->daifmt; in simple_probe()
804 dai_link->init = simple_util_dai_init; in simple_probe()
805 memcpy(dai_props->cpu_dai, &cinfo->cpu_dai, in simple_probe()
806 sizeof(*dai_props->cpu_dai)); in simple_probe()
807 memcpy(dai_props->codec_dai, &cinfo->codec_dai, in simple_probe()
808 sizeof(*dai_props->codec_dai)); in simple_probe()
827 { .compatible = "simple-audio-card", },
828 { .compatible = "simple-scu-audio-card",
836 .name = "asoc-simple-card",
846 MODULE_ALIAS("platform:asoc-simple-card");