Lines Matching +full:multi +full:- +full:port

1 // SPDX-License-Identifier: GPL-2.0
8 // based on ${LINUX}/sound/soc/generic/audio-graph-card.c
27 port@0 {
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";
74 cpu: port {
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";
101 multi {
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>; }; };
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>; }; };
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>; }; };
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
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
166 be0: port@0 { be0_ep: endpoint { remote-endpoint = <&dai0_ep>; }; };
167 be1: port@1 { be1_ep: endpoint { remote-endpoint = <&dai1_ep>; }; };
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>; }; };
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";
211 c2c: port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
212 port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
218 port@0 {
219 bitclock-master;
220 frame-master;
221 codec0_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; };
222 port@1 { codec1_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; };
236 #define GRAPH_NODENAME_MULTI "multi"
240 #define port_to_endpoint(port) of_get_child_by_name(port, "endpoint") argument
250 * => lnk: port@0 { ... }; in __graph_get_type()
251 * port@1 { ... }; in __graph_get_type()
302 str = "DPCM Front-End"; in graph_get_type()
304 str = "DPCM Back-End"; in graph_get_type()
324 static struct device_node *graph_get_next_multi_ep(struct device_node **port) in graph_get_next_multi_ep() argument
326 struct device_node *ports = of_get_parent(*port); in graph_get_next_multi_ep()
331 * multi { in graph_get_next_multi_ep()
333 * => lnk: port@0 { ... }; in graph_get_next_multi_ep()
334 * port@1 { ep { ... = rep0 } }; in graph_get_next_multi_ep()
335 * port@2 { ep { ... = rep1 } }; in graph_get_next_multi_ep()
341 * port@0 { rep0 }; in graph_get_next_multi_ep()
342 * port@1 { rep1 }; in graph_get_next_multi_ep()
346 *port = of_get_next_child(ports, *port); in graph_get_next_multi_ep()
347 if (!*port) in graph_get_next_multi_ep()
349 } while (!of_node_name_eq(*port, "port")); in graph_get_next_multi_ep()
351 if (*port) { in graph_get_next_multi_ep()
352 ep = port_to_endpoint(*port); in graph_get_next_multi_ep()
371 struct device_node *port = of_get_parent(ep); in graph_parse_convert() local
372 struct device_node *ports = of_get_parent(port); in graph_parse_convert()
373 struct asoc_simple_data *adata = &props->adata; in graph_parse_convert()
377 asoc_simple_parse_convert(port, NULL, adata); in graph_parse_convert()
380 of_node_put(port); in graph_parse_convert()
387 struct device_node *port = of_get_parent(ep); in graph_parse_mclk_fs() local
388 struct device_node *ports = of_get_parent(port); 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()
395 of_node_put(port); 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()
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()
511 struct device_node *port, in graph_parse_node() argument
517 if (graph_lnk_is_multi(port)) { in graph_parse_node()
520 of_node_get(port); in graph_parse_node()
523 ep = graph_get_next_multi_ep(&port); in graph_parse_node()
535 ep = port_to_endpoint(port); in graph_parse_node()
556 * port { 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()
594 struct device_node *port, in graph_link_init() argument
598 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
604 if (graph_lnk_is_multi(port)) { in graph_link_init()
605 of_node_get(port); in graph_link_init()
606 ep = graph_get_next_multi_ep(&port); in graph_link_init()
607 port = of_get_parent(ep); in graph_link_init()
609 ep = port_to_endpoint(port); in graph_link_init()
612 ports = of_get_parent(port); in graph_link_init()
617 * port { in graph_link_init()
627 graph_parse_daifmt(port, &daifmt, &bit_frame); /* (B) */ 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()
698 * => lnk: port@0 { ep: { ... = rep }; }; in audio_graph2_link_dpcm()
701 * // Back-End in audio_graph2_link_dpcm()
709 * rport: port@0 { rep: { ... = ep } }; 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()
731 * // Back-End in audio_graph2_link_dpcm()
733 * => lnk: port@0 { ep: { ... = rep; }; }; in audio_graph2_link_dpcm()
740 * rport: port@0 { rep: { ... = ep; }; }; 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()
783 int ret = -EINVAL; in audio_graph2_link_c2c()
789 * => lnk: port@0 { c2c0_ep: { ... = codec0_ep; }; }; in audio_graph2_link_c2c()
790 * port@1 { c2c1_ep: { ... = codec1_ep; }; }; in audio_graph2_link_c2c()
796 * port@0 { codec0_ep: ... }; }; in audio_graph2_link_c2c()
797 * port@1 { codec1_ep: ... }; }; 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()
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()
921 * Multi CPU / Codec in graph_counter()
923 * multi { in graph_counter()
925 * => lnk: port@0 { ... }; in graph_counter()
926 * port@1 { ... }; in graph_counter()
927 * port@2 { ... }; in graph_counter()
935 return of_graph_get_endpoint_count(of_get_parent(lnk)) - 1; in graph_counter()
953 * => lnk: port { endpoint { .. }; }; in graph_count_normal()
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()
983 * => lnk: port@0 { endpoint { ... }; }; in graph_count_dpcm()
986 * // Back-End in graph_count_dpcm()
988 * => lnk: port@0 { endpoint { ... }; }; 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()
1029 * => lnk: port@0 { endpoint { ... }; }; in graph_count_c2c()
1030 * port@1 { endpoint { ... }; }; 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()
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()
1113 /* loop for all listed CPU port */ 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");