1// SPDX-License-Identifier: GPL-2.0 2/* 3 * audio-graph-card2-custom-sample1.dtsi 4 * 5 * Copyright (C) 2020 Renesas Electronics Corp. 6 * Copyright (C) 2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 7 * 8 * This sample indicates how to use audio-graph-card2 and its 9 * custom driver. "audio-graph-card2-custom-sample" is the custome driver 10 * which is using audio-graph-card2. 11 * 12 * You can easily use this sample by adding below line on your DT file, 13 * and add new CONFIG to your .config. 14 * 15 * #include "../../../../../sound/soc/generic/audio-graph-card2-custom-sample1.dtsi" 16 * 17 * CONFIG_SND_AUDIO_GRAPH_CARD2 18 * CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE 19 * CONFIG_SND_TEST_COMPONENT 20 * 21 * 22 * You can indicate more detail each device behavior as debug if you modify 23 * "compatible" on each test-component. see below 24 * 25 * test_cpu { 26 * - compatible = "test-cpu"; 27 * + compatible = "test-cpu-verbose"; 28 * ... 29 * }; 30 * 31 * test_codec { 32 * - compatible = "test-codec"; 33 * + compatible = "test-codec-verbose"; 34 * ... 35 * }; 36 * 37 * 38 * Below sample doesn't use "format" property, 39 * because test-component driver (test-cpu/test-codec) is supporting 40 * snd_soc_dai_ops :: .auto_selectable_formats. 41 * see 42 * snd_soc_runtime_get_dai_fmt() 43 * linux/sound/soc/generic/test-component.c :: test_dai_formats 44 */ 45/ { 46 audio-graph-card2-custom-sample-1 { 47 /* 48 * You can use audio-graph-card2 directly by using 49 * 50 * compatible = "audio-graph-card2"; 51 */ 52 compatible = "audio-graph-card2-custom-sample"; 53 label = "card2-custom-sample-1"; 54 55 /* 56 * @ : used at links 57 */ 58 links = < 59 /* 60 * 61 * [Normal] 62 * 63 * <cpu1_0> 64 * cpu1_0 <-@-----> codec1_0 65 */ 66 &cpu1_0 /* CPU side only */ 67 68 /* 69 * [Semi-Multi] 70 * 71 * CPU:Codec = 1:N 72 * 73 * <sm> +-+ 74 * cpu1_1 <--@---->| |-> codec1_1 75 * | |-> codec1_2 76 * +-+ 77 */ 78 &sm /* CPU side only */ 79 80 /* 81 * [Multi-CPU/Codec-A] 82 * 83 * +-+ <mcpuA> +-+ 84 * cpu1_2 <-| |<---@------>| |-> codec1_3 85 * cpu1_3 <-| | | |-> codec1_4 86 * +-+ +-+ 87 */ 88 &mcpuA /* CPU side only */ 89 90 /* 91 * [Multi-CPU/Codec-B] 92 * 93 * +-+ <mcpuB> +-+ 94 * | |<---@------>| | 95 * | | | | 96 * cpu1_4 <-| |<---------->| |-> codec1_5 97 * cpu1_5 <-| |<---+------>| |-> codec1_6 98 * +-+ \----->| |-> codec1_7 99 * +-+ 100 */ 101 &mcpuB /* CPU side only */ 102 103 /* 104 * [Multi-CPU/Codec-C] 105 * 106 * +-+ <mcpuC> +-+ 107 * | |<---@------>| | 108 * | | | | 109 * cpu1_6 <-| |<---------->| |-> codec1_8 110 * cpu1_7 <-| |<-----+---->| |-> codec1_9 111 * cpu1_8 <-| |<----/ +-+ 112 * +-+ 113 */ 114 &mcpuC /* CPU side only */ 115 >; 116 117 multi { 118 #address-cells = <1>; 119 #size-cells = <0>; 120 121 /* 122 * [Semi-Multi] 123 * 124 * <sm> +---+ 125 * cpu1_1 <---@--->|X A|-> codec1_1 126 * | B|-> codec1_2 127 * +---+ 128 */ 129 ports@0 { 130 reg = <0>; 131 #address-cells = <1>; 132 #size-cells = <0>; 133 port@0 { reg = <0>; smcodec_ep: endpoint { remote-endpoint = <&cpu1_1_ep>; };};/* (X) to pair */ 134 port@1 { reg = <1>; smcodec_A_ep: endpoint { remote-endpoint = <&codec1_1_ep>; };};/* (A) Multi Element */ 135 port@2 { reg = <2>; smcodec_B_ep: endpoint { remote-endpoint = <&codec1_2_ep>; };};/* (B) Multi Element */ 136 }; 137 138 /* 139 * [Multi-CPU-A] 140 * 141 * +---+ <mcpuA> +---+ 142 * cpu1_2 <-|A X|<---@---->|x a|-> codec1_3 143 * cpu1_3 <-|B | | b|-> codec1_4 144 * +---+ +---+ 145 */ 146 ports@1 { 147 reg = <1>; 148 #address-cells = <1>; 149 #size-cells = <0>; 150 mcpuA: port@0 { reg = <0>; mcpu_A_ep: endpoint { remote-endpoint = <&mcodec_A_ep>; };}; /* (X) to pair */ 151 port@1 { reg = <1>; mcpu_AA_ep: endpoint { remote-endpoint = <&cpu1_2_ep>; };}; /* (A) Multi Element */ 152 port@2 { reg = <2>; mcpu_AB_ep: endpoint { remote-endpoint = <&cpu1_3_ep>; };}; /* (B) Multi Element */ 153 }; 154 155 /* 156 * [Multi-Codec-A] 157 * 158 * +---+ <mcpuA> +---+ 159 * cpu1_2 <-|A X|<-@------>|x a|-> codec1_3 160 * cpu1_3 <-|B | | b|-> codec1_4 161 * +---+ +---+ 162 */ 163 ports@2 { 164 reg = <2>; 165 #address-cells = <1>; 166 #size-cells = <0>; 167 port@0 { reg = <0>; mcodec_A_ep: endpoint { remote-endpoint = <&mcpu_A_ep>; };}; /* (x) to pair */ 168 port@1 { reg = <1>; mcodec_Aa_ep: endpoint { remote-endpoint = <&codec1_3_ep>; };}; /* (a) Multi Element */ 169 port@2 { reg = <2>; mcodec_Ab_ep: endpoint { remote-endpoint = <&codec1_4_ep>; };}; /* (b) Multi Element */ 170 }; 171 172 /* 173 * [Multi-CPU-B] 174 * 175 * +---+ <mcpuB> +---+ 176 * | X|<---@---->|x | 177 * | | | | 178 * cpu1_4 <-|A 1|<-------->|3 a|-> codec1_5 179 * cpu1_5 <-|B 2|<---+---->|4 b|-> codec1_6 180 * +---+ \--->|5 c|-> codec1_7 181 * +---+ 182 */ 183 ports@3 { 184 reg = <3>; 185 #address-cells = <1>; 186 #size-cells = <0>; 187 mcpuB: port@0 { 188 reg = <0>; 189 mcpu_BX_ep: endpoint { remote-endpoint = <&mcodec_Bx_ep>; }; /* (X) to pair */ 190 }; 191 port@1 { 192 #address-cells = <1>; 193 #size-cells = <0>; 194 reg = <1>; 195 mcpu_BA_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu1_4_ep>; }; /* (A) Multi Element */ 196 mcpu_B1_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec_B3_ep>; }; /* (1) connected Codec */ 197 }; 198 port@2 { 199 #address-cells = <1>; 200 #size-cells = <0>; 201 reg = <2>; 202 mcpu_BB_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu1_5_ep>; }; /* (B) Multi Element */ 203 mcpu_B2_0_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec_B4_ep>; }; /* (2) connected Codec */ 204 mcpu_B2_1_ep: endpoint@2 { reg = <2>; remote-endpoint = <&mcodec_B5_ep>; }; /* (2) connected Codec */ 205 }; 206 }; 207 208 /* 209 * [Multi-Codec-B] 210 * 211 * +---+ <mcpuB> +---+ 212 * | X|<-@------>|x | 213 * | | | | 214 * cpu1_4 <-|A 1|<-------->|3 a|-> codec1_5 215 * cpu1_5 <-|B 2|<---+---->|4 b|-> codec1_6 216 * +---+ \--->|5 c|-> codec1_7 217 * +---+ 218 */ 219 ports@4 { 220 reg = <4>; 221 #address-cells = <1>; 222 #size-cells = <0>; 223 port@0 { 224 reg = <0>; 225 mcodec_Bx_ep: endpoint { remote-endpoint = <&mcpu_BX_ep>; }; /* (x) to pair */ 226 }; 227 port@1 { 228 #address-cells = <1>; 229 #size-cells = <0>; 230 reg = <1>; 231 mcodec_Ba_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec1_5_ep>;}; /* (a) Multi Element */ 232 mcodec_B3_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu_B1_ep>; }; /* (3) connected CPU */ 233 }; 234 port@2 { 235 #address-cells = <1>; 236 #size-cells = <0>; 237 reg = <2>; 238 mcodec_Bb_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec1_6_ep>; }; /* (b) Multi Element */ 239 mcodec_B4_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu_B2_0_ep>;}; /* (4) connected CPU */ 240 }; 241 port@3 { 242 #address-cells = <1>; 243 #size-cells = <0>; 244 reg = <3>; 245 mcodec_Bc_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec1_7_ep>; }; /* (c) Multi Element */ 246 mcodec_B5_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu_B2_1_ep>;}; /* (5) connected CPU */ 247 }; 248 }; 249 250 /* 251 * [Multi-CPU-C] 252 * 253 * +---+ <mcpuC> +---+ 254 * | X|<-@------>|x | 255 * | | | | 256 * cpu1_6 <-|A 1|<-------->|4 a|-> codec1_8 257 * cpu1_7 <-|B 2|<-----+-->|5 b|-> codec1_9 258 * cpu1_8 <-|C 3|<----/ +---+ 259 * +---+ 260 */ 261 ports@5 { 262 reg = <5>; 263 #address-cells = <1>; 264 #size-cells = <0>; 265 mcpuC: port@0 { 266 reg = <0>; 267 mcpu_CX_ep: endpoint { remote-endpoint = <&mcodec_Cx_ep>; }; /* (X) to pair */ 268 }; 269 port@1 { 270 #address-cells = <1>; 271 #size-cells = <0>; 272 reg = <1>; 273 mcpu_CA_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu1_6_ep>; }; /* (A) Multi Element */ 274 mcpu_C1_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec_C4_ep>; }; /* (1) connected Codec */ 275 }; 276 port@2 { 277 #address-cells = <1>; 278 #size-cells = <0>; 279 reg = <2>; 280 mcpu_CB_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu1_7_ep>; }; /* (B) Multi Element */ 281 mcpu_C2_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec_C5_0_ep>; }; /* (2) connected Codec */ 282 }; 283 port@3 { 284 #address-cells = <1>; 285 #size-cells = <0>; 286 reg = <3>; 287 mcpu_CC_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu1_8_ep>; }; /* (C) Multi Element */ 288 mcpu_C3_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec_C5_1_ep>; }; /* (3) connected Codec */ 289 }; 290 }; 291 292 /* 293 * [Multi-Codec-C] 294 * 295 * +---+ <mcpuC> +---+ 296 * | X|<-@------>|x | 297 * | | | | 298 * cpu1_6 <-|A 1|<-------->|4 a|-> codec1_8 299 * cpu1_7 <-|B 2|<-----+-->|5 b|-> codec1_9 300 * cpu1_8 <-|C 3|<----/ +---+ 301 * +---+ 302 */ 303 ports@6 { 304 reg = <6>; 305 #address-cells = <1>; 306 #size-cells = <0>; 307 port@0 { 308 reg = <0>; 309 mcodec_Cx_ep: endpoint { remote-endpoint = <&mcpu_CX_ep>; }; /* (x) to pair */ 310 }; 311 port@1 { 312 #address-cells = <1>; 313 #size-cells = <0>; 314 reg = <1>; 315 mcodec_Ca_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec1_8_ep>;}; /* (a) Multi Element */ 316 mcodec_C4_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu_C1_ep>; }; /* (4) connected CPU */ 317 }; 318 port@2 { 319 #address-cells = <1>; 320 #size-cells = <0>; 321 reg = <2>; 322 mcodec_Cb_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec1_9_ep>;}; /* (b) Multi Element */ 323 mcodec_C5_0_ep: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu_C2_ep>; }; /* (5) connected CPU */ 324 mcodec_C5_1_ep: endpoint@2 { reg = <2>; remote-endpoint = <&mcpu_C3_ep>; }; /* (5) connected CPU */ 325 }; 326 }; 327 }; 328 }; 329 330 test_cpu_1 { 331 /* 332 * update compatible to indicate more detail behaviour 333 * if you want. see test-compatible for more detail. 334 * 335 * ex) 336 * - compatible = "test-cpu"; 337 * + compatible = "test-cpu-verbose"; 338 */ 339 compatible = "test-cpu"; 340 ports { 341 #address-cells = <1>; 342 #size-cells = <0>; 343 344 bitclock-master; 345 frame-master; 346 347 /* [Normal] */ 348 cpu1_0: port@0 { reg = <0>; cpu1_0_ep: endpoint { remote-endpoint = <&codec1_0_ep>;}; }; 349 /* [Semi-Multi] */ 350 sm: port@1 { reg = <1>; cpu1_1_ep: endpoint { remote-endpoint = <&smcodec_ep>; }; }; 351 /* [Multi-CPU-A] */ 352 port@2 { reg = <2>; cpu1_2_ep: endpoint { remote-endpoint = <&mcpu_AA_ep>; }; }; 353 port@3 { reg = <3>; cpu1_3_ep: endpoint { remote-endpoint = <&mcpu_AB_ep>; }; }; 354 /* [Multi-CPU-B] */ 355 port@4 { reg = <4>; cpu1_4_ep: endpoint { remote-endpoint = <&mcpu_BA_ep>; }; }; 356 port@5 { reg = <5>; cpu1_5_ep: endpoint { remote-endpoint = <&mcpu_BB_ep>; }; }; 357 /* [Multi-CPU-C] */ 358 port@6 { reg = <6>; cpu1_6_ep: endpoint { remote-endpoint = <&mcpu_CA_ep>; }; }; 359 port@7 { reg = <7>; cpu1_7_ep: endpoint { remote-endpoint = <&mcpu_CB_ep>; }; }; 360 port@8 { reg = <8>; cpu1_8_ep: endpoint { remote-endpoint = <&mcpu_CC_ep>; }; }; 361 }; 362 }; 363 364 test_codec_1 { 365 /* 366 * update compatible to indicate more detail behaviour 367 * if you want. see test-compatible for more detail. 368 * 369 * ex) 370 * - compatible = "test-codec"; 371 * + compatible = "test-codec-verbose"; 372 */ 373 compatible = "test-codec"; 374 375 ports { 376 #address-cells = <1>; 377 #size-cells = <0>; 378 379 /* [Normal] */ 380 port@0 { reg = <0>; codec1_0_ep: endpoint { remote-endpoint = <&cpu1_0_ep>; }; }; 381 /* [Semi-Multi] */ 382 port@1 { reg = <1>; codec1_1_ep: endpoint { remote-endpoint = <&smcodec_A_ep>; }; }; 383 port@2 { reg = <2>; codec1_2_ep: endpoint { remote-endpoint = <&smcodec_B_ep>; }; }; 384 /* [Multi-Codec-0] */ 385 port@3 { reg = <3>; codec1_3_ep: endpoint { remote-endpoint = <&mcodec_Aa_ep>; }; }; 386 port@4 { reg = <4>; codec1_4_ep: endpoint { remote-endpoint = <&mcodec_Ab_ep>; }; }; 387 /* [Multi-Codec-1] */ 388 port@5 { reg = <5>; codec1_5_ep: endpoint { remote-endpoint = <&mcodec_Ba_ep>; }; }; 389 port@6 { reg = <6>; codec1_6_ep: endpoint { remote-endpoint = <&mcodec_Bb_ep>; }; }; 390 port@7 { reg = <7>; codec1_7_ep: endpoint { remote-endpoint = <&mcodec_Bc_ep>; }; }; 391 /* [Multi-Codec-2] */ 392 port@8 { reg = <8>; codec1_8_ep: endpoint { remote-endpoint = <&mcodec_Ca_ep>; }; }; 393 port@9 { reg = <9>; codec1_9_ep: endpoint { remote-endpoint = <&mcodec_Cb_ep>; }; }; 394 }; 395 }; 396}; 397