Lines Matching +full:multi +full:- +full:master

1 // SPDX-License-Identifier: GPL-2.0
8 // based on ${LINUX}/sound/soc/generic/audio-graph-card.c
25 bitclock-master;
27 frame-master;
37 It uses *latest* format, and *share* master settings.
39 sample0: left_j, bitclock-master, frame-master
40 sample1: i2s, bitclock-master
56 linux/sound/soc/soc-utils.c
57 linux/sound/soc/generic/test-component.c
60 Normal Audio-Graph
63 CPU <---> Codec
66 compatible = "audio-graph-card2";
72 bitclock-master;
73 frame-master;
74 cpu_ep: endpoint { remote-endpoint = <&codec_ep>; }; };
78 port { codec_ep: endpoint { remote-endpoint = <&cpu_ep>; }; };
82 Multi-CPU/Codec
88 +----+ +---+
89 CPU1 --|A X| <-@----> |x a|-- Codec1
90 CPU2 --|B | | b|-- Codec2
91 +----+ +---+
94 compatible = "audio-graph-card2";
98 multi {
100 (@) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; // (X) to pair
101 port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; // (A) Multi Element
102 port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; // (B) Multi Element
105 port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; // (x) to pair
106 port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; // (a) Multi Element
107 port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; // (b) Multi Element
114 bitclock-master;
115 frame-master;
116 port@0 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; };
117 port@1 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; };
123 port@0 { codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; };
124 port@1 { codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; };
134 PCM0 <--> * fe0 be0 * <--> DAI0: Codec Headset
135 PCM1 <--> * fe1 be1 * <--> DAI1: Codec Speakers
136 PCM2 <--> * fe2 be2 * <--> DAI2: MODEM
137 PCM3 <--> * fe3 be3 * <--> DAI3: BT
138 * be4 * <--> DAI4: DMIC
139 * be5 * <--> DAI5: FM
143 compatible = "audio-graph-card2";
150 // indicate all Front-End, Back-End
155 // Front-End
157 fe0: port@0 { fe0_ep: endpoint { remote-endpoint = <&pcm0_ep>; }; };
158 fe1: port@1 { fe1_ep: endpoint { remote-endpoint = <&pcm1_ep>; }; };
161 // Back-End
163 be0: port@0 { be0_ep: endpoint { remote-endpoint = <&dai0_ep>; }; };
164 be1: port@1 { be1_ep: endpoint { remote-endpoint = <&dai1_ep>; }; };
172 bitclock-master;
173 frame-master;
174 port@0 { pcm0_ep: endpoint { remote-endpoint = <&fe0_ep>; }; };
175 port@1 { pcm1_ep: endpoint { remote-endpoint = <&fe1_ep>; }; };
182 port@0 { dai0_ep: endpoint { remote-endpoint = <&be0_ep>; }; };
183 port@1 { dai1_ep: endpoint { remote-endpoint = <&be1_ep>; }; };
192 +--+
193 | |<-- Codec0 <- IN
194 | |--> Codec1 -> OUT
195 +--+
198 compatible = "audio-graph-card2";
208 c2c: port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
209 port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
216 bitclock-master;
217 frame-master;
218 codec0_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; };
219 port@1 { codec1_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; };
233 #define GRAPH_NODENAME_MULTI "multi"
299 str = "DPCM Front-End"; in graph_get_type()
301 str = "DPCM Back-End"; in graph_get_type()
328 * multi { in graph_get_next_multi_ep()
331 * port@1 { ep { ... = rep0 } }; // Multi Element in graph_get_next_multi_ep()
332 * port@2 { ep { ... = rep1 } }; // Multi Element in graph_get_next_multi_ep()
370 struct simple_util_data *adata = &props->adata; in graph_parse_convert()
388 of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
389 of_property_read_u32(port, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
390 of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
403 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in __graph_parse_node()
404 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in __graph_parse_node()
438 if (!dai_link->name) { in __graph_parse_node()
444 if (dai_link->num_cpus > 1) in __graph_parse_node()
446 if (dai_link->num_codecs > 1) in __graph_parse_node()
453 simple_util_set_dailink_name(dev, dai_link, "%s%s-%s%s", in __graph_parse_node()
454 cpus->dai_name, cpu_multi, in __graph_parse_node()
455 codecs->dai_name, codec_multi); in __graph_parse_node()
460 cpus->of_node, cpus->dai_name, cpu_multi); in __graph_parse_node()
463 codecs->of_node, codecs->dai_name, codec_multi); in __graph_parse_node()
468 simple_util_set_dailink_name(dev, dai_link, "c2c.%s%s-%s%s", in __graph_parse_node()
469 cpus->dai_name, cpu_multi, in __graph_parse_node()
470 codecs->dai_name, codec_multi); in __graph_parse_node()
479 * if DPCM-BE case in __graph_parse_node()
488 snd_soc_of_parse_node_prefix(rports, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
489 snd_soc_of_parse_node_prefix(rport, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
511 * +---+ +---+ in graph_parse_node_multi_nm()
512 * | X|<-@------->|x | in graph_parse_node_multi_nm()
514 * cpu0 <--|A 1|<--------->|4 a|-> codec0 in graph_parse_node_multi_nm()
515 * cpu1 <--|B 2|<-----+--->|5 b|-> codec1 in graph_parse_node_multi_nm()
516 * cpu2 <--|C 3|<----/ +---+ in graph_parse_node_multi_nm()
517 * +---+ in graph_parse_node_multi_nm()
519 * multi { in graph_parse_node_multi_nm()
522 * <mcpu_port> port@1 { mcpu0_ep { ... = cpu0_ep; }; // (A) Multi Element in graph_parse_node_multi_nm()
524 * port@2 { mcpu1_ep { ... = cpu1_ep; }; // (B) Multi Element in graph_parse_node_multi_nm()
526 * port@3 { mcpu2_ep { ... = cpu2_ep; }; // (C) Multi Element in graph_parse_node_multi_nm()
532 * <mcodec_port>port@1 { mcodec0_ep { ... = codec0_ep; }; // (a) Multi Element in graph_parse_node_multi_nm()
534 * port@2 { mcodec1_ep { ... = codec1_ep; }; // (b) Multi Element in graph_parse_node_multi_nm()
547 int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); in graph_parse_node_multi_nm()
548 int ret = -EINVAL; in graph_parse_node_multi_nm()
550 if (cpu_idx > dai_link->num_cpus) in graph_parse_node_multi_nm()
577 if (codec_idx > dai_link->num_codecs) in graph_parse_node_multi_nm()
591 dai_link->ch_maps[*nm_idx].cpu = cpu_idx; in graph_parse_node_multi_nm()
592 dai_link->ch_maps[*nm_idx].codec = codec_idx; in graph_parse_node_multi_nm()
618 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_parse_node_multi()
621 int ret = -ENOMEM; in graph_parse_node_multi()
623 int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); in graph_parse_node_multi()
629 if (gtype != GRAPH_DPCM && !dai_link->ch_maps && in graph_parse_node_multi()
630 dai_link->num_cpus > 1 && dai_link->num_codecs > 1 && in graph_parse_node_multi()
631 dai_link->num_cpus != dai_link->num_codecs) { in graph_parse_node_multi()
633 dai_link->ch_maps = devm_kcalloc(dev, nm_max, in graph_parse_node_multi()
635 if (!dai_link->ch_maps) in graph_parse_node_multi()
641 * multi { in graph_parse_node_multi()
644 * port@1 { mcpu1_ep { ... = cpu1_ep };}; // Multi Element in graph_parse_node_multi()
645 * port@2 { mcpu2_ep { ... = cpu2_ep };}; // Multi Element in graph_parse_node_multi()
665 if (is_cpu && dai_link->ch_maps) { in graph_parse_node_multi()
672 if (is_cpu && dai_link->ch_maps && (nm_idx != nm_max)) in graph_parse_node_multi()
673 ret = -EINVAL; in graph_parse_node_multi()
730 * if (A) or (B) or (C) has bitclock-master / frame-master flag. in graph_parse_daifmt()
744 * This function is called by (C) -> (B) -> (A) order. in graph_parse_daifmt()
758 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
803 dai_link->playback_only = playback_only; in graph_link_init()
804 dai_link->capture_only = capture_only; in graph_link_init()
806 dai_link->dai_fmt = daifmt | daiclk; in graph_link_init()
807 dai_link->init = simple_util_dai_init; in graph_link_init()
808 dai_link->ops = &graph_ops; in graph_link_init()
809 if (priv->ops) in graph_link_init()
810 dai_link->ops = priv->ops; in graph_link_init()
854 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_dpcm()
855 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in audio_graph2_link_dpcm()
862 * // Front-End in audio_graph2_link_dpcm()
867 * // Back-End in audio_graph2_link_dpcm()
884 dai_link->dynamic = 1; in audio_graph2_link_dpcm()
885 dai_link->dpcm_merged_format = 1; in audio_graph2_link_dpcm()
893 * // Front-End in audio_graph2_link_dpcm()
897 * // Back-End in audio_graph2_link_dpcm()
917 dai_link->no_pcm = 1; in audio_graph2_link_dpcm()
918 dai_link->be_hw_params_fixup = simple_util_be_hw_params_fixup; in audio_graph2_link_dpcm()
944 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_c2c()
949 int ret = -EINVAL; in audio_graph2_link_c2c()
989 c2c_conf->formats = SNDRV_PCM_FMTBIT_S32_LE; /* update ME */ in audio_graph2_link_c2c()
990 c2c_conf->rates = SNDRV_PCM_RATE_8000_384000; in audio_graph2_link_c2c()
991 c2c_conf->rate_min = in audio_graph2_link_c2c()
992 c2c_conf->rate_max = val; in audio_graph2_link_c2c()
993 c2c_conf->channels_min = in audio_graph2_link_c2c()
994 c2c_conf->channels_max = 2; /* update ME */ in audio_graph2_link_c2c()
996 dai_link->c2c_params = c2c_conf; in audio_graph2_link_c2c()
997 dai_link->num_c2c_params = 1; in audio_graph2_link_c2c()
1045 int ret = -EINVAL; in graph_link()
1049 if (hooks && hooks->custom_normal) in graph_link()
1050 func = hooks->custom_normal; in graph_link()
1055 if (hooks && hooks->custom_dpcm) in graph_link()
1056 func = hooks->custom_dpcm; in graph_link()
1061 if (hooks && hooks->custom_c2c) in graph_link()
1062 func = hooks->custom_c2c; in graph_link()
1079 li->link++; in graph_link()
1087 * Multi CPU / Codec in graph_counter()
1089 * multi { in graph_counter()
1092 * port@1 { ... }; // Multi Element in graph_counter()
1093 * port@2 { ... }; // Multi Element in graph_counter()
1116 return cnt - 1; in graph_counter()
1141 * simple-card.c :: simple_count_noml() in graph_count_normal()
1143 li->num[li->link].cpus = in graph_count_normal()
1144 li->num[li->link].platforms = graph_counter(cpu_port); in graph_count_normal()
1146 li->num[li->link].codecs = graph_counter(codec_port); in graph_count_normal()
1163 * // Front-End in graph_count_dpcm()
1168 * // Back-End in graph_count_dpcm()
1180 * simple-card.c :: simple_count_noml() in graph_count_dpcm()
1182 li->num[li->link].cpus = graph_counter(rport); /* FE */ in graph_count_dpcm()
1183 li->num[li->link].platforms = graph_counter(rport); in graph_count_dpcm()
1185 li->num[li->link].codecs = graph_counter(rport); /* BE */ in graph_count_dpcm()
1219 * simple-card.c :: simple_count_noml() in graph_count_c2c()
1221 li->num[li->link].cpus = in graph_count_c2c()
1222 li->num[li->link].platforms = graph_counter(codec0); in graph_count_c2c()
1224 li->num[li->link].codecs = graph_counter(codec1); in graph_count_c2c()
1244 int ret = -EINVAL; in graph_count()
1246 if (li->link >= SNDRV_MAX_LINKS) { in graph_count()
1274 li->link++; in graph_count()
1290 struct device_node *node = dev->of_node; in graph_for_each_link()
1318 return -ENOMEM; in audio_graph2_parse_of()
1320 card->probe = graph_util_card_probe; in audio_graph2_parse_of()
1321 card->owner = THIS_MODULE; in audio_graph2_parse_of()
1322 card->dev = dev; in audio_graph2_parse_of()
1324 if ((hooks) && (hooks)->hook_pre) { in audio_graph2_parse_of()
1325 ret = (hooks)->hook_pre(priv); in audio_graph2_parse_of()
1331 if (!li->link) in audio_graph2_parse_of()
1332 ret = -EINVAL; in audio_graph2_parse_of()
1340 priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW); in audio_graph2_parse_of()
1341 if (IS_ERR(priv->pa_gpio)) { in audio_graph2_parse_of()
1342 ret = PTR_ERR(priv->pa_gpio); in audio_graph2_parse_of()
1366 if ((hooks) && (hooks)->hook_post) { in audio_graph2_parse_of()
1367 ret = (hooks)->hook_post(priv); in audio_graph2_parse_of()
1388 struct device *dev = &pdev->dev; in graph_probe()
1393 return -ENOMEM; in graph_probe()
1399 { .compatible = "audio-graph-card2", },
1406 .name = "asoc-audio-graph-card2",
1415 MODULE_ALIAS("platform:asoc-audio-graph-card2");