Lines Matching +full:li +full:-

1 // SPDX-License-Identifier: GPL-2.0
8 // based on ${LINUX}/sound/soc/generic/audio-graph-card.c
28 bitclock-master;
30 frame-master;
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";
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>; }; };
219 bitclock-master;
220 frame-master;
221 codec0_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; };
222 port@1 { codec1_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; };
264 fw_devlink_purge_absent_suppliers(&np->fwnode); in __graph_get_type()
270 fw_devlink_purge_absent_suppliers(&np->fwnode); in __graph_get_type()
276 fw_devlink_purge_absent_suppliers(&np->fwnode); in __graph_get_type()
305 str = "DPCM Front-End"; in graph_get_type()
307 str = "DPCM Back-End"; in graph_get_type()
376 struct asoc_simple_data *adata = &props->adata; in graph_parse_convert()
394 of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
395 of_property_read_u32(port, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
396 of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); in graph_parse_mclk_fs()
405 struct link_info *li, in __graph_parse_node() argument
409 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in __graph_parse_node()
410 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in __graph_parse_node()
444 if (!dai_link->name) { in __graph_parse_node()
450 if (dai_link->num_cpus > 1) in __graph_parse_node()
452 if (dai_link->num_codecs > 1) in __graph_parse_node()
459 asoc_simple_set_dailink_name(dev, dai_link, "%s%s-%s%s", in __graph_parse_node()
460 cpus->dai_name, cpu_multi, in __graph_parse_node()
461 codecs->dai_name, codec_multi); in __graph_parse_node()
466 cpus->of_node, cpus->dai_name, cpu_multi); in __graph_parse_node()
469 codecs->of_node, codecs->dai_name, codec_multi); in __graph_parse_node()
474 asoc_simple_set_dailink_name(dev, dai_link, "c2c.%s%s-%s%s", in __graph_parse_node()
475 cpus->dai_name, cpu_multi, in __graph_parse_node()
476 codecs->dai_name, codec_multi); in __graph_parse_node()
485 * if DPCM-BE case in __graph_parse_node()
494 snd_soc_of_parse_node_prefix(rports, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
495 snd_soc_of_parse_node_prefix(rport, cconf, codecs->of_node, "prefix"); in __graph_parse_node()
515 struct link_info *li, int is_cpu) in graph_parse_node() argument
531 li, is_cpu, idx); in graph_parse_node()
539 ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); in graph_parse_node()
573 * if (A) or (B) or (C) has bitclock-master / frame-master flag. in graph_parse_daifmt()
587 * This function is called by (C) -> (B) -> (A) order. in graph_parse_daifmt()
598 struct link_info *li, in graph_link_init() argument
601 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in graph_link_init()
643 dai_link->dai_fmt = daifmt | daiclk; in graph_link_init()
644 dai_link->init = asoc_simple_dai_init; in graph_link_init()
645 dai_link->ops = &graph_ops; in graph_link_init()
646 if (priv->ops) in graph_link_init()
647 dai_link->ops = priv->ops; in graph_link_init()
652 struct link_info *li) in audio_graph2_link_normal() argument
664 ret = graph_parse_node(priv, GRAPH_NORMAL, codec_port, li, 0); in audio_graph2_link_normal()
671 ret = graph_parse_node(priv, GRAPH_NORMAL, cpu_port, li, 1); in audio_graph2_link_normal()
675 graph_link_init(priv, cpu_port, li, 1); in audio_graph2_link_normal()
686 struct link_info *li) in audio_graph2_link_dpcm() argument
691 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_dpcm()
692 struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); in audio_graph2_link_dpcm()
699 * // Front-End in audio_graph2_link_dpcm()
704 * // Back-End in audio_graph2_link_dpcm()
721 dai_link->dynamic = 1; in audio_graph2_link_dpcm()
722 dai_link->dpcm_merged_format = 1; in audio_graph2_link_dpcm()
724 ret = graph_parse_node(priv, GRAPH_DPCM, rport, li, 1); in audio_graph2_link_dpcm()
730 * // Front-End in audio_graph2_link_dpcm()
734 * // Back-End in audio_graph2_link_dpcm()
754 dai_link->no_pcm = 1; in audio_graph2_link_dpcm()
755 dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; in audio_graph2_link_dpcm()
757 ret = graph_parse_node(priv, GRAPH_DPCM, rport, li, 0); in audio_graph2_link_dpcm()
767 graph_link_init(priv, rport, li, is_cpu); in audio_graph2_link_dpcm()
779 struct link_info *li) in audio_graph2_link_c2c() argument
781 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); in audio_graph2_link_c2c()
786 int ret = -EINVAL; in audio_graph2_link_c2c()
826 c2c_conf->formats = SNDRV_PCM_FMTBIT_S32_LE; /* update ME */ in audio_graph2_link_c2c()
827 c2c_conf->rates = SNDRV_PCM_RATE_8000_384000; in audio_graph2_link_c2c()
828 c2c_conf->rate_min = in audio_graph2_link_c2c()
829 c2c_conf->rate_max = val; in audio_graph2_link_c2c()
830 c2c_conf->channels_min = in audio_graph2_link_c2c()
831 c2c_conf->channels_max = 2; /* update ME */ in audio_graph2_link_c2c()
833 dai_link->c2c_params = c2c_conf; in audio_graph2_link_c2c()
834 dai_link->num_c2c_params = 1; in audio_graph2_link_c2c()
848 ret = graph_parse_node(priv, GRAPH_C2C, codec1_port, li, 0); in audio_graph2_link_c2c()
855 ret = graph_parse_node(priv, GRAPH_C2C, codec0_port, li, 1); in audio_graph2_link_c2c()
859 graph_link_init(priv, codec0_port, li, 1); in audio_graph2_link_c2c()
878 struct link_info *li) in graph_link() argument
882 int ret = -EINVAL; in graph_link()
886 if (hooks && hooks->custom_normal) in graph_link()
887 func = hooks->custom_normal; in graph_link()
892 if (hooks && hooks->custom_dpcm) in graph_link()
893 func = hooks->custom_dpcm; in graph_link()
898 if (hooks && hooks->custom_c2c) in graph_link()
899 func = hooks->custom_c2c; in graph_link()
912 ret = func(priv, lnk, li); in graph_link()
916 li->link++; in graph_link()
938 return of_graph_get_endpoint_count(of_get_parent(lnk)) - 1; in graph_counter()
948 struct link_info *li) in graph_count_normal() argument
962 * simple-card.c :: simple_count_noml() in graph_count_normal()
964 li->num[li->link].cpus = in graph_count_normal()
965 li->num[li->link].platforms = graph_counter(cpu_port); in graph_count_normal()
967 li->num[li->link].codecs = graph_counter(codec_port); in graph_count_normal()
977 struct link_info *li) in graph_count_dpcm() argument
984 * // Front-End in graph_count_dpcm()
989 * // Back-End in graph_count_dpcm()
1001 * simple-card.c :: simple_count_noml() in graph_count_dpcm()
1003 li->num[li->link].cpus = graph_counter(rport); /* FE */ in graph_count_dpcm()
1004 li->num[li->link].platforms = graph_counter(rport); in graph_count_dpcm()
1006 li->num[li->link].codecs = graph_counter(rport); /* BE */ in graph_count_dpcm()
1017 struct link_info *li) in graph_count_c2c() argument
1040 * simple-card.c :: simple_count_noml() in graph_count_c2c()
1042 li->num[li->link].cpus = in graph_count_c2c()
1043 li->num[li->link].platforms = graph_counter(codec0); in graph_count_c2c()
1045 li->num[li->link].codecs = graph_counter(codec1); in graph_count_c2c()
1061 struct link_info *li) in graph_count() argument
1065 int ret = -EINVAL; in graph_count()
1067 if (li->link >= SNDRV_MAX_LINKS) { in graph_count()
1091 ret = func(priv, lnk, li); in graph_count()
1095 li->link++; in graph_count()
1102 struct link_info *li, in graph_for_each_link() argument
1107 struct link_info *li)) in graph_for_each_link()
1111 struct device_node *node = dev->of_node; in graph_for_each_link()
1122 ret = func(priv, hooks, gtype, lnk, li); in graph_for_each_link()
1134 struct link_info *li; in audio_graph2_parse_of() local
1137 li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL); in audio_graph2_parse_of()
1138 if (!li) in audio_graph2_parse_of()
1139 return -ENOMEM; in audio_graph2_parse_of()
1141 card->probe = asoc_graph_card_probe; in audio_graph2_parse_of()
1142 card->owner = THIS_MODULE; in audio_graph2_parse_of()
1143 card->dev = dev; in audio_graph2_parse_of()
1145 if ((hooks) && (hooks)->hook_pre) { in audio_graph2_parse_of()
1146 ret = (hooks)->hook_pre(priv); in audio_graph2_parse_of()
1151 ret = graph_for_each_link(priv, hooks, li, graph_count); in audio_graph2_parse_of()
1152 if (!li->link) in audio_graph2_parse_of()
1153 ret = -EINVAL; in audio_graph2_parse_of()
1157 ret = asoc_simple_init_priv(priv, li); in audio_graph2_parse_of()
1161 priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW); in audio_graph2_parse_of()
1162 if (IS_ERR(priv->pa_gpio)) { in audio_graph2_parse_of()
1163 ret = PTR_ERR(priv->pa_gpio); in audio_graph2_parse_of()
1176 memset(li, 0, sizeof(*li)); in audio_graph2_parse_of()
1177 ret = graph_for_each_link(priv, hooks, li, graph_link); in audio_graph2_parse_of()
1187 if ((hooks) && (hooks)->hook_post) { in audio_graph2_parse_of()
1188 ret = (hooks)->hook_post(priv); in audio_graph2_parse_of()
1197 devm_kfree(dev, li); in audio_graph2_parse_of()
1209 struct device *dev = &pdev->dev; in graph_probe()
1214 return -ENOMEM; in graph_probe()
1220 { .compatible = "audio-graph-card2", },
1227 .name = "asoc-audio-graph-card2",
1236 MODULE_ALIAS("platform:asoc-audio-graph-card2");