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

1 // SPDX-License-Identifier: GPL-2.0
8 // based on ${LINUX}/sound/soc/generic/audio-graph-card.c
25 ports {
28 bitclock-master;
30 frame-master;
39 You can set daifmt at ports/port/endpoint.
42 sample0: left_j, bitclock-master, frame-master
43 sample1: i2s, bitclock-master
59 linux/sound/soc/soc-utils.c
60 linux/sound/soc/generic/test-component.c
63 Normal Audio-Graph
66 CPU <---> Codec
69 compatible = "audio-graph-card2";
75 bitclock-master;
76 frame-master;
77 cpu_ep: endpoint { remote-endpoint = <&codec_ep>; }; };
81 port { codec_ep: endpoint { remote-endpoint = <&cpu_ep>; }; };
85 Multi-CPU/Codec
91 +-+ (A) +-+
92 CPU1 --(y) | | <-(X)--(X)-> | | (y)-- Codec1
93 CPU2 --(y) | | | | (y)-- Codec2
94 +-+ +-+
97 compatible = "audio-graph-card2";
102 ports@0 {
103 (X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
104 (y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
105 (y) port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
107 ports@1 {
108 (X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; };
109 (y) port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
110 (y) port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
116 ports {
117 bitclock-master;
118 frame-master;
119 port@0 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; };
120 port@1 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; };
125 ports {
126 port@0 { codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; };
127 port@1 { codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; };
137 PCM0 <--> * fe0 be0 * <--> DAI0: Codec Headset
138 PCM1 <--> * fe1 be1 * <--> DAI1: Codec Speakers
139 PCM2 <--> * fe2 be2 * <--> DAI2: MODEM
140 PCM3 <--> * fe3 be3 * <--> DAI3: BT
141 * be4 * <--> DAI4: DMIC
142 * be5 * <--> DAI5: FM
146 compatible = "audio-graph-card2";
153 // indicate all Front-End, Back-End
158 // Front-End
159 ports@0 {
160 fe0: port@0 { fe0_ep: endpoint { remote-endpoint = <&pcm0_ep>; }; };
161 fe1: port@1 { fe1_ep: endpoint { remote-endpoint = <&pcm1_ep>; }; };
164 // Back-End
165 ports@1 {
166 be0: port@0 { be0_ep: endpoint { remote-endpoint = <&dai0_ep>; }; };
167 be1: port@1 { be1_ep: endpoint { remote-endpoint = <&dai1_ep>; }; };
174 ports {
175 bitclock-master;
176 frame-master;
177 port@0 { pcm0_ep: endpoint { remote-endpoint = <&fe0_ep>; }; };
178 port@1 { pcm1_ep: endpoint { remote-endpoint = <&fe1_ep>; }; };
184 ports {
185 port@0 { dai0_ep: endpoint { remote-endpoint = <&be0_ep>; }; };
186 port@1 { dai1_ep: endpoint { remote-endpoint = <&be1_ep>; }; };
195 +--+
196 | |<-- Codec0 <- IN
197 | |--> Codec1 -> OUT
198 +--+
201 compatible = "audio-graph-card2";
209 ports {
211 c2c: port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
212 port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
217 ports {
219 bitclock-master;
220 frame-master;
221 codec0_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; };
222 port@1 { codec1_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; };
249 * ports { in __graph_get_type()
256 if (of_node_name_eq(np, "ports")) { in __graph_get_type()
302 str = "DPCM Front-End"; in graph_get_type()
304 str = "DPCM Back-End"; in graph_get_type()
326 struct device_node *ports = of_get_parent(*port); in graph_get_next_multi_ep() local
332 * ports { in graph_get_next_multi_ep()
346 *port = of_get_next_child(ports, *port); in graph_get_next_multi_ep()
357 of_node_put(ports); in graph_get_next_multi_ep()
372 struct device_node *ports = of_get_parent(port); in graph_parse_convert() local
373 struct asoc_simple_data *adata = &props->adata; in graph_parse_convert()
375 if (of_node_name_eq(ports, "ports")) in graph_parse_convert()
376 asoc_simple_parse_convert(ports, NULL, adata); in graph_parse_convert()
381 of_node_put(ports); in graph_parse_convert()
388 struct device_node *ports = of_get_parent(port); in graph_parse_mclk_fs() local
390 if (of_node_name_eq(ports, "ports")) in graph_parse_mclk_fs()
391 of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
392 of_property_read_u32(port, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
393 of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
396 of_node_put(ports); in graph_parse_mclk_fs()
406 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in __graph_parse_node()
407 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in __graph_parse_node()
441 if (!dai_link->name) { in __graph_parse_node()
447 if (dai_link->num_cpus > 1) in __graph_parse_node()
449 if (dai_link->num_codecs > 1) in __graph_parse_node()
456 asoc_simple_set_dailink_name(dev, dai_link, "%s%s-%s%s", in __graph_parse_node()
457 cpus->dai_name, cpu_multi, in __graph_parse_node()
458 codecs->dai_name, codec_multi); in __graph_parse_node()
463 cpus->of_node, cpus->dai_name, cpu_multi); in __graph_parse_node()
466 codecs->of_node, codecs->dai_name, codec_multi); in __graph_parse_node()
471 asoc_simple_set_dailink_name(dev, dai_link, "c2c.%s%s-%s%s", in __graph_parse_node()
472 cpus->dai_name, cpu_multi, in __graph_parse_node()
473 codecs->dai_name, codec_multi); in __graph_parse_node()
482 * if DPCM-BE case in __graph_parse_node()
490 if (of_node_name_eq(rports, "ports")) in __graph_parse_node()
491 snd_soc_of_parse_node_prefix(rports, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
492 snd_soc_of_parse_node_prefix(rport, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
554 * ports { in graph_parse_daifmt()
570 * if (A) or (B) or (C) has bitclock-master / frame-master flag. in graph_parse_daifmt()
584 * This function is called by (C) -> (B) -> (A) order. in graph_parse_daifmt()
598 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
600 struct device_node *ports; in graph_link_init() local
612 ports = of_get_parent(port); in graph_link_init()
615 * ports { in graph_link_init()
628 if (of_node_name_eq(ports, "ports")) in graph_link_init()
629 graph_parse_daifmt(ports, &daifmt, &bit_frame); /* (A) */ in graph_link_init()
640 dai_link->dai_fmt = daifmt | daiclk; in graph_link_init()
641 dai_link->init = asoc_simple_dai_init; in graph_link_init()
642 dai_link->ops = &graph_ops; in graph_link_init()
643 if (priv->ops) in graph_link_init()
644 dai_link->ops = priv->ops; in graph_link_init()
688 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_dpcm()
689 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in audio_graph2_link_dpcm()
696 * // Front-End in audio_graph2_link_dpcm()
697 * ports@0 { in audio_graph2_link_dpcm()
701 * // Back-End in audio_graph2_link_dpcm()
702 * ports@0 { in audio_graph2_link_dpcm()
708 * rports: ports { in audio_graph2_link_dpcm()
718 dai_link->dynamic = 1; in audio_graph2_link_dpcm()
719 dai_link->dpcm_merged_format = 1; in audio_graph2_link_dpcm()
727 * // Front-End in audio_graph2_link_dpcm()
728 * ports@0 { in audio_graph2_link_dpcm()
731 * // Back-End in audio_graph2_link_dpcm()
732 * ports@0 { in audio_graph2_link_dpcm()
739 * rports: ports { in audio_graph2_link_dpcm()
751 dai_link->no_pcm = 1; in audio_graph2_link_dpcm()
752 dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; in audio_graph2_link_dpcm()
778 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_c2c()
779 struct device_node *port0, *port1, *ports; in audio_graph2_link_c2c() local
783 int ret = -EINVAL; in audio_graph2_link_c2c()
787 * ports { in audio_graph2_link_c2c()
795 * ports { in audio_graph2_link_c2c()
803 ports = of_get_parent(port0); in audio_graph2_link_c2c()
804 port1 = of_get_next_child(ports, lnk); in audio_graph2_link_c2c()
814 of_property_read_u32(ports, "rate", &val); in audio_graph2_link_c2c()
823 c2c_conf->formats = SNDRV_PCM_FMTBIT_S32_LE; /* update ME */ in audio_graph2_link_c2c()
824 c2c_conf->rates = SNDRV_PCM_RATE_8000_384000; in audio_graph2_link_c2c()
825 c2c_conf->rate_min = in audio_graph2_link_c2c()
826 c2c_conf->rate_max = val; in audio_graph2_link_c2c()
827 c2c_conf->channels_min = in audio_graph2_link_c2c()
828 c2c_conf->channels_max = 2; /* update ME */ in audio_graph2_link_c2c()
830 dai_link->c2c_params = c2c_conf; in audio_graph2_link_c2c()
831 dai_link->num_c2c_params = 1; in audio_graph2_link_c2c()
863 of_node_put(ports); in audio_graph2_link_c2c()
879 int ret = -EINVAL; in graph_link()
883 if (hooks && hooks->custom_normal) in graph_link()
884 func = hooks->custom_normal; in graph_link()
889 if (hooks && hooks->custom_dpcm) in graph_link()
890 func = hooks->custom_dpcm; in graph_link()
895 if (hooks && hooks->custom_c2c) in graph_link()
896 func = hooks->custom_c2c; in graph_link()
913 li->link++; in graph_link()
924 * ports { in graph_counter()
935 return of_graph_get_endpoint_count(of_get_parent(lnk)) - 1; in graph_counter()
959 * simple-card.c :: simple_count_noml() in graph_count_normal()
961 li->num[li->link].cpus = in graph_count_normal()
962 li->num[li->link].platforms = graph_counter(cpu_port); in graph_count_normal()
964 li->num[li->link].codecs = graph_counter(codec_port); in graph_count_normal()
981 * // Front-End in graph_count_dpcm()
982 * ports@0 { in graph_count_dpcm()
986 * // Back-End in graph_count_dpcm()
987 * ports@1 { in graph_count_dpcm()
998 * simple-card.c :: simple_count_noml() in graph_count_dpcm()
1000 li->num[li->link].cpus = graph_counter(rport); /* FE */ in graph_count_dpcm()
1001 li->num[li->link].platforms = graph_counter(rport); in graph_count_dpcm()
1003 li->num[li->link].codecs = graph_counter(rport); /* BE */ in graph_count_dpcm()
1016 struct device_node *ports = of_get_parent(lnk); in graph_count_c2c() local
1018 struct device_node *port1 = of_get_next_child(ports, lnk); in graph_count_c2c()
1028 * ports { in graph_count_c2c()
1037 * simple-card.c :: simple_count_noml() in graph_count_c2c()
1039 li->num[li->link].cpus = in graph_count_c2c()
1040 li->num[li->link].platforms = graph_counter(codec0); in graph_count_c2c()
1042 li->num[li->link].codecs = graph_counter(codec1); in graph_count_c2c()
1044 of_node_put(ports); in graph_count_c2c()
1062 int ret = -EINVAL; in graph_count()
1064 if (li->link >= SNDRV_MAX_LINKS) { in graph_count()
1092 li->link++; in graph_count()
1108 struct device_node *node = dev->of_node; in graph_for_each_link()
1136 return -ENOMEM; in audio_graph2_parse_of()
1138 card->probe = asoc_graph_card_probe; in audio_graph2_parse_of()
1139 card->owner = THIS_MODULE; in audio_graph2_parse_of()
1140 card->dev = dev; in audio_graph2_parse_of()
1142 if ((hooks) && (hooks)->hook_pre) { in audio_graph2_parse_of()
1143 ret = (hooks)->hook_pre(priv); in audio_graph2_parse_of()
1149 if (!li->link) in audio_graph2_parse_of()
1150 ret = -EINVAL; in audio_graph2_parse_of()
1158 priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW); in audio_graph2_parse_of()
1159 if (IS_ERR(priv->pa_gpio)) { in audio_graph2_parse_of()
1160 ret = PTR_ERR(priv->pa_gpio); in audio_graph2_parse_of()
1184 if ((hooks) && (hooks)->hook_post) { in audio_graph2_parse_of()
1185 ret = (hooks)->hook_post(priv); in audio_graph2_parse_of()
1206 struct device *dev = &pdev->dev; in graph_probe()
1211 return -ENOMEM; in graph_probe()
1217 { .compatible = "audio-graph-card2", },
1224 .name = "asoc-audio-graph-card2",
1233 MODULE_ALIAS("platform:asoc-audio-graph-card2");