Lines Matching +full:bitclock +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
43 bitclock/frame provider as default.
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";
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>; }; };
271 fw_devlink_purge_absent_suppliers(&np->fwnode); in __graph_get_type()
277 fw_devlink_purge_absent_suppliers(&np->fwnode); in __graph_get_type()
283 fw_devlink_purge_absent_suppliers(&np->fwnode); in __graph_get_type()
312 str = "DPCM Front-End"; in graph_get_type()
314 str = "DPCM Back-End"; in graph_get_type()
384 struct simple_util_data *adata = &props->adata; in graph_parse_convert()
398 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in __graph_parse_node()
399 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in __graph_parse_node()
431 if (!dai_link->name) { in __graph_parse_node()
437 if (dai_link->num_cpus > 1) in __graph_parse_node()
439 if (dai_link->num_codecs > 1) in __graph_parse_node()
446 simple_util_set_dailink_name(dev, dai_link, "%s%s-%s%s", in __graph_parse_node()
447 cpus->dai_name, cpu_multi, in __graph_parse_node()
448 codecs->dai_name, codec_multi); in __graph_parse_node()
453 cpus->of_node, cpus->dai_name, cpu_multi); in __graph_parse_node()
456 codecs->of_node, codecs->dai_name, codec_multi); in __graph_parse_node()
461 simple_util_set_dailink_name(dev, dai_link, "c2c.%s%s-%s%s", in __graph_parse_node()
462 cpus->dai_name, cpu_multi, in __graph_parse_node()
463 codecs->dai_name, codec_multi); in __graph_parse_node()
472 * if DPCM-BE case in __graph_parse_node()
480 snd_soc_of_parse_node_prefix(rports, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
481 snd_soc_of_parse_node_prefix(rport, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
500 * +---+ +---+ in graph_parse_node_multi_nm()
501 * | X|<-@------->|x | in graph_parse_node_multi_nm()
503 * cpu0 <--|A 1|<--------->|4 a|-> codec0 in graph_parse_node_multi_nm()
504 * cpu1 <--|B 2|<-----+--->|5 b|-> codec1 in graph_parse_node_multi_nm()
505 * cpu2 <--|C 3|<----/ +---+ in graph_parse_node_multi_nm()
506 * +---+ in graph_parse_node_multi_nm()
536 int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); in graph_parse_node_multi_nm()
539 if (cpu_idx > dai_link->num_cpus) in graph_parse_node_multi_nm()
540 return -EINVAL; in graph_parse_node_multi_nm()
555 ret = -EINVAL; in graph_parse_node_multi_nm()
565 if (codec_idx > dai_link->num_codecs) in graph_parse_node_multi_nm()
569 dai_link->ch_maps[*nm_idx].cpu = cpu_idx; in graph_parse_node_multi_nm()
570 dai_link->ch_maps[*nm_idx].codec = codec_idx; in graph_parse_node_multi_nm()
590 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_parse_node_multi()
592 int ret = -ENOMEM; in graph_parse_node_multi()
594 int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); in graph_parse_node_multi()
600 if (gtype != GRAPH_DPCM && !dai_link->ch_maps && in graph_parse_node_multi()
601 dai_link->num_cpus > 1 && dai_link->num_codecs > 1 && in graph_parse_node_multi()
602 dai_link->num_cpus != dai_link->num_codecs) { in graph_parse_node_multi()
604 dai_link->ch_maps = devm_kcalloc(dev, nm_max, in graph_parse_node_multi()
606 if (!dai_link->ch_maps) in graph_parse_node_multi()
635 if (is_cpu && dai_link->ch_maps) { in graph_parse_node_multi()
642 if (is_cpu && dai_link->ch_maps && (nm_idx != nm_max)) in graph_parse_node_multi()
643 ret = -EINVAL; in graph_parse_node_multi()
703 * This function is called by (C) -> (B) -> (A) order. in graph_parse_daifmt()
730 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
731 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in graph_link_init()
779 of_property_read_u32(lnk, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
780 of_property_read_u32(ports_cpu, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
781 of_property_read_u32(ports_codec, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
782 of_property_read_u32(port_cpu, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
783 of_property_read_u32(port_codec, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
784 of_property_read_u32(ep_cpu, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
785 of_property_read_u32(ep_codec, "mclk-fs", &dai_props->mclk_fs); in graph_link_init()
796 dlc->ext_fmt = graph_parse_bitframe(ep_cpu); in graph_link_init()
803 dlc->ext_fmt = graph_parse_bitframe(ep_codec); in graph_link_init()
811 dai_link->playback_only = playback_only; in graph_link_init()
812 dai_link->capture_only = capture_only; in graph_link_init()
814 dai_link->trigger_start = trigger_start; in graph_link_init()
815 dai_link->trigger_stop = trigger_stop; in graph_link_init()
817 dai_link->dai_fmt = daifmt; in graph_link_init()
818 dai_link->init = simple_util_dai_init; in graph_link_init()
819 dai_link->ops = &graph_ops; in graph_link_init()
820 if (priv->ops) in graph_link_init()
821 dai_link->ops = priv->ops; in graph_link_init()
868 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_dpcm()
869 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in audio_graph2_link_dpcm()
878 * // Front-End in audio_graph2_link_dpcm()
883 * // Back-End in audio_graph2_link_dpcm()
900 dai_link->dynamic = 1; in audio_graph2_link_dpcm()
901 dai_link->dpcm_merged_format = 1; in audio_graph2_link_dpcm()
912 * // Front-End in audio_graph2_link_dpcm()
916 * // Back-End in audio_graph2_link_dpcm()
936 dai_link->no_pcm = 1; in audio_graph2_link_dpcm()
937 dai_link->be_hw_params_fixup = simple_util_be_hw_params_fixup; in audio_graph2_link_dpcm()
957 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_c2c()
962 int ret = -EINVAL; in audio_graph2_link_c2c()
998 c2c_conf->formats = SNDRV_PCM_FMTBIT_S32_LE; /* update ME */ in audio_graph2_link_c2c()
999 c2c_conf->rates = SNDRV_PCM_RATE_8000_384000; in audio_graph2_link_c2c()
1000 c2c_conf->rate_min = in audio_graph2_link_c2c()
1001 c2c_conf->rate_max = val; in audio_graph2_link_c2c()
1002 c2c_conf->channels_min = in audio_graph2_link_c2c()
1003 c2c_conf->channels_max = 2; /* update ME */ in audio_graph2_link_c2c()
1005 dai_link->c2c_params = c2c_conf; in audio_graph2_link_c2c()
1006 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()
1107 return of_graph_get_port_count(ports) - 1; in graph_counter()
1132 * simple-card.c :: simple_count_noml() in graph_count_normal()
1134 li->num[li->link].cpus = in graph_count_normal()
1135 li->num[li->link].platforms = graph_counter(cpu_port); in graph_count_normal()
1137 li->num[li->link].codecs = graph_counter(codec_port); in graph_count_normal()
1151 * // Front-End in graph_count_dpcm()
1156 * // Back-End in graph_count_dpcm()
1168 * simple-card.c :: simple_count_noml() in graph_count_dpcm()
1170 li->num[li->link].cpus = graph_counter(rport); /* FE */ in graph_count_dpcm()
1171 li->num[li->link].platforms = graph_counter(rport); in graph_count_dpcm()
1173 li->num[li->link].codecs = graph_counter(rport); /* BE */ in graph_count_dpcm()
1202 * simple-card.c :: simple_count_noml() in graph_count_c2c()
1204 li->num[li->link].cpus = in graph_count_c2c()
1205 li->num[li->link].platforms = graph_counter(codec0); in graph_count_c2c()
1207 li->num[li->link].codecs = graph_counter(codec1); in graph_count_c2c()
1220 int ret = -EINVAL; in graph_count()
1222 if (li->link >= SNDRV_MAX_LINKS) { in graph_count()
1250 li->link++; in graph_count()
1266 struct device_node *node = dev->of_node; in graph_for_each_link()
1293 return -ENOMEM; in audio_graph2_parse_of()
1295 card->probe = graph_util_card_probe; in audio_graph2_parse_of()
1296 card->owner = THIS_MODULE; in audio_graph2_parse_of()
1297 card->dev = dev; in audio_graph2_parse_of()
1299 if ((hooks) && (hooks)->hook_pre) { in audio_graph2_parse_of()
1300 ret = (hooks)->hook_pre(priv); in audio_graph2_parse_of()
1306 if (!li->link) in audio_graph2_parse_of()
1307 ret = -EINVAL; in audio_graph2_parse_of()
1315 priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW); in audio_graph2_parse_of()
1316 if (IS_ERR(priv->pa_gpio)) { in audio_graph2_parse_of()
1317 ret = PTR_ERR(priv->pa_gpio); in audio_graph2_parse_of()
1341 if ((hooks) && (hooks)->hook_post) { in audio_graph2_parse_of()
1342 ret = (hooks)->hook_post(priv); in audio_graph2_parse_of()
1349 ret = snd_soc_of_parse_aux_devs(card, "aux-devs"); in audio_graph2_parse_of()
1365 struct device *dev = &pdev->dev; in graph_probe()
1370 return -ENOMEM; in graph_probe()
1376 { .compatible = "audio-graph-card2", },
1383 .name = "asoc-audio-graph-card2",
1392 MODULE_ALIAS("platform:asoc-audio-graph-card2");