1// SPDX-License-Identifier: GPL-2.0 2/* 3 * audio-graph-card2-custom-sample2.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-sample2.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-2 { 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-2"; 54 55 /* for [DPCM] */ 56 /* BE FE */ 57 routing = "TC DAI0 Playback", "DAI0 Playback", 58 "TC DAI0 Playback", "DAI1 Playback", 59 "DAI0 Capture", "TC DAI0 Capture", 60 "DAI1 Capture", "TC DAI0 Capture", 61 /* for [DPCM-Multi] */ 62 /* BE FE */ 63 "TC DAI1 Playback", "DAI2 Playback", 64 "TC DAI2 Playback", "DAI2 Playback", 65 "TC DAI1 Playback", "DAI3 Playback", 66 "TC DAI2 Playback", "DAI3 Playback", 67 "DAI2 Capture", "TC DAI1 Capture", 68 "DAI2 Capture", "TC DAI2 Capture", 69 "DAI3 Capture", "TC DAI1 Capture", 70 "DAI3 Capture", "TC DAI2 Capture", 71 /* for [Codec2Codec] */ 72 "TC OUT", "TC DAI4 Playback", 73 "TC DAI3 Capture", "TC IN", 74 /* for [Codec2Codec-Multi] */ 75 "TC OUT", "TC DAI7 Playback", 76 "TC DAI5 Capture", "TC IN", 77 "TC OUT", "TC DAI8 Playback", 78 "TC DAI6 Capture", "TC IN"; 79 80 /* 81 * @ : used at links 82 */ 83 links = < 84 /* 85 * [DPCM] 86 * 87 * cpu20/cpu21 are converting rate to 44.1kHz 88 * 89 * FE BE 90 * <feA> **** <beA> 91 * cpu2_0 <----@---* *------@---> codec2_0 (44.1kHz) 92 * cpu2_1 <----@---* * 93 * <feB> **** 94 */ 95 &feA &feB &beA /* both FE / BE */ 96 97 /* 98 * [DPCM-Multi] 99 * 100 * FE BE 101 * <feC> **** <beB> +-+ 102 * cpu2_2 <----@---* *------@---> | | -> codec2_1 103 * cpu2_3 <----@---* * | | -> codec2_2 104 * <feD> **** +-+ 105 */ 106 &feC &feD &beB /* both FE / BE*/ 107 108 /* 109 * [Codec2Codec] 110 * 111 * <c2c> 112 * +-@-> codec2_3 113 * | 114 * +---> codec2_4 115 */ 116 &c2c /* CPU side only */ 117 118 /* 119 * [Codec2Codec-Multi] 120 * 121 * --NOTE-- 122 * Multi connect N:M is not supported by ASoC. 123 * 124 * <c2c_m> +-+ 125 * +---@-->| |-> codec2_5 126 * | | |-> codec2_6 127 * | +-+ 128 * | +-+ 129 * +------>| |-> codec2_7 130 * | |-> codec2_8 131 * +-+ 132 */ 133 &c2c_m /* CPU side only */ 134 >; 135 136 multi { 137 #address-cells = <1>; 138 #size-cells = <0>; 139 140 /* 141 * [DPCM-Multi]::BE 142 * 143 * FE BE 144 * <feC> **** <beB> +---+ 145 * cpu2_2 <----@---* *------@---> |x a| -> codec2_1 146 * cpu2_3 <----@---* * | b| -> codec2_2 147 * <feD> **** +---+ 148 */ 149 ports@2 { 150 reg = <2>; 151 #address-cells = <1>; 152 #size-cells = <0>; 153 port@0 { reg = <0>; mbe_x_ep: endpoint { remote-endpoint = <&beB_ep>; };};/* (x) to pair */ 154 port@1 { reg = <1>; mbe_a_ep: endpoint { remote-endpoint = <&codec2_1_ep>; };};/* (a) Multi Element */ 155 port@2 { reg = <2>; mbe_b_ep: endpoint { remote-endpoint = <&codec2_2_ep>; };};/* (b) Multi Element */ 156 }; 157 158 /* 159 * [Codec2Codec-Multi]::CPU 160 * 161 * <c2c_m> c2cmf +---+ 162 * +---@---------->|X A|-> codec2_5 163 * | | B|-> codec2_6 164 * | +---+ 165 * | c2cmb +---+ 166 * +-------------->|x a|-> codec2_7 167 * | b|-> codec2_8 168 * +---+ 169 */ 170 ports@3 { 171 reg = <3>; 172 #address-cells = <1>; 173 #size-cells = <0>; 174 port@0 { reg = <0>; mc2c0X_ep: endpoint { remote-endpoint = <&c2cmf_ep>; };};/* (X) to pair */ 175 port@1 { reg = <1>; mc2c0A_ep: endpoint { remote-endpoint = <&codec2_5_ep>; };};/* (A) Multi Element */ 176 port@2 { reg = <2>; mc2c0B_ep: endpoint { remote-endpoint = <&codec2_6_ep>; };};/* (B) Multi Element */ 177 }; 178 179 /* 180 * [Codec2Codec-Multi]::Codec 181 * 182 * <c2c_m> c2cmf +---+ 183 * +---@---------->|X A|-> codec2_5 184 * | | B|-> codec2_6 185 * | +---+ 186 * | c2cmb +---+ 187 * +-------------->|x a|-> codec2_7 188 * | b|-> codec2_8 189 * +---+ 190 */ 191 ports@4 { 192 reg = <4>; 193 #address-cells = <1>; 194 #size-cells = <0>; 195 port@0 { reg = <0>; mc2c1x_ep: endpoint { remote-endpoint = <&c2cmb_ep>; };};/* (x) to pair */ 196 port@1 { reg = <1>; mc2c1a_ep: endpoint { remote-endpoint = <&codec2_7_ep>; };};/* (a) Multi Element */ 197 port@2 { reg = <2>; mc2c1b_ep: endpoint { remote-endpoint = <&codec2_8_ep>; };};/* (b) Multi Element */ 198 }; 199 }; 200 201 dpcm { 202 #address-cells = <1>; 203 #size-cells = <0>; 204 205 /* FE part */ 206 ports@0 { 207 reg = <0>; 208 209 #address-cells = <1>; 210 #size-cells = <0>; 211 /* 212 * [DPCM]::FE 213 * 214 * FE BE 215 * <feA> **** <beA> 216 * cpu2_0 <----@---* *------@---> codec2_0 (44.1kHz) 217 * cpu2_1 <----@---* * 218 * <feB> **** 219 */ 220 feA: port@0 { reg = <0>; feA_ep: endpoint { remote-endpoint = <&cpu2_0_ep>; }; }; 221 feB: port@1 { reg = <1>; feB_ep: endpoint { remote-endpoint = <&cpu2_1_ep>; }; }; 222 223 /* 224 * [DPCM-Multi]::FE 225 * 226 * FE BE 227 * <feC> **** <beB> +-+ 228 * cpu2_2 <----@---* *------@---> | | -> codec2_1 229 * cpu2_3 <----@---* * | | -> codec2_2 230 * <feD> **** +-+ 231 */ 232 feC: port@2 { reg = <2>; feC_ep: endpoint { remote-endpoint = <&cpu2_2_ep>; }; }; 233 feD: port@3 { reg = <3>; feD_ep: endpoint { remote-endpoint = <&cpu2_3_ep>; }; }; 234 }; 235 236 /* BE part */ 237 ports@1 { 238 reg = <1>; 239 240 #address-cells = <1>; 241 #size-cells = <0>; 242 /* 243 * [DPCM]::BE 244 * 245 * FE BE 246 * <feA> **** <beA> 247 * cpu2_0 <----@---* *------@---> codec2_0 (44.1kHz) 248 * cpu2_1 <----@---* * 249 * <feB> **** 250 */ 251 beA: port@0 { reg = <0>; beA_ep: endpoint { remote-endpoint = <&codec2_0_ep>; }; }; 252 253 /* 254 * [DPCM-Multi]::BE 255 * 256 * FE BE 257 * <feC> **** <beB> +-------+ 258 * cpu2_2 <----@---* *------@---> |mbe_x | -> codec2_1 259 * cpu2_3 <----@---* * | | -> codec2_2 260 * <feD> **** +-------+ 261 */ 262 beB: port@1 { reg = <1>; beB_ep: endpoint { remote-endpoint = <&mbe_x_ep>; }; }; 263 }; 264 }; 265 266 codec2codec { 267 #address-cells = <1>; 268 #size-cells = <0>; 269 /* 270 * [Codec2Codec] 271 * 272 * <c2c> 273 * +-@--> codec2_3 274 * | 275 * +----> codec2_4 276 */ 277 ports@0 { 278 reg = <0>; 279 280 #address-cells = <1>; 281 #size-cells = <0>; 282 283 /* use default settings */ 284 c2c: port@0 { reg = <0>; c2cf_ep: endpoint { remote-endpoint = <&codec2_3_ep>; }; }; 285 port@1 { reg = <1>; c2cb_ep: endpoint { remote-endpoint = <&codec2_4_ep>; }; }; 286 }; 287 288 /* 289 * [Codec2Codec-Multi] 290 * 291 * <c2c_m> c2cmf +--------+ 292 * +---@---------->|mc2c0X |-> codec2_5 293 * | | |-> codec2_6 294 * | +--------+ 295 * | c2cmb +--------+ 296 * +-------------->|mc2c1x |-> codec2_7 297 * | |-> codec2_8 298 * +--------+ 299 */ 300 ports@1 { 301 reg = <1>; 302 303 #address-cells = <1>; 304 #size-cells = <0>; 305 306 /* use original settings */ 307 rate = <48000>; 308 c2c_m: port@0 { reg = <0>; c2cmf_ep: endpoint { remote-endpoint = <&mc2c0X_ep>; }; }; 309 port@1 { reg = <1>; c2cmb_ep: endpoint { remote-endpoint = <&mc2c1x_ep>; }; }; 310 }; 311 }; 312 }; 313 314 test_cpu_2 { 315 /* 316 * update compatible to indicate more detail behaviour 317 * if you want. see test-compatible for more detail. 318 * 319 * ex) 320 * - compatible = "test-cpu"; 321 * + compatible = "test-cpu-verbose"; 322 */ 323 compatible = "test-cpu"; 324 ports { 325 #address-cells = <1>; 326 #size-cells = <0>; 327 328 bitclock-master; 329 frame-master; 330 331 /* [DPCM]::FE */ 332 port@0 { reg = <0>; cpu2_0_ep: endpoint { remote-endpoint = <&feA_ep>; };}; 333 port@1 { reg = <1>; cpu2_1_ep: endpoint { remote-endpoint = <&feB_ep>; };}; 334 /* [DPCM-Multi]::FE */ 335 port@2 { reg = <2>; cpu2_2_ep: endpoint { remote-endpoint = <&feC_ep>; };}; 336 port@3 { reg = <3>; cpu2_3_ep: endpoint { remote-endpoint = <&feD_ep>; };}; 337 }; 338 }; 339 340 test_codec_2 { 341 /* 342 * update compatible to indicate more detail behaviour 343 * if you want. see test-compatible for more detail. 344 * 345 * ex) 346 * - compatible = "test-codec"; 347 * + compatible = "test-codec-verbose"; 348 */ 349 compatible = "test-codec"; 350 ports { 351 #address-cells = <1>; 352 #size-cells = <0>; 353 354 /* 355 * prefix can be added to *component*, 356 * see audio-graph-card2::routing 357 */ 358 prefix = "TC"; 359 360 /* [DPCM]::BE */ 361 port@0 { 362 convert-rate = <44100>; 363 reg = <0>; codec2_0_ep: endpoint { remote-endpoint = <&beA_ep>; }; 364 }; 365 /* [DPCM-Multi]::BE */ 366 port@1 { reg = <1>; codec2_1_ep: endpoint { remote-endpoint = <&mbe_a_ep>; };}; 367 port@2 { reg = <2>; codec2_2_ep: endpoint { remote-endpoint = <&mbe_b_ep>; };}; 368 /* [Codec2Codec] */ 369 port@3 { bitclock-master; 370 frame-master; 371 reg = <3>; codec2_3_ep: endpoint { remote-endpoint = <&c2cf_ep>; };}; 372 port@4 { reg = <4>; codec2_4_ep: endpoint { remote-endpoint = <&c2cb_ep>; };}; 373 /* [Codec2Codec-Multi] */ 374 port@5 { bitclock-master; 375 frame-master; 376 reg = <5>; codec2_5_ep: endpoint { remote-endpoint = <&mc2c0A_ep>; };}; 377 port@6 { reg = <6>; codec2_6_ep: endpoint { remote-endpoint = <&mc2c0B_ep>; };}; 378 port@7 { reg = <7>; codec2_7_ep: endpoint { remote-endpoint = <&mc2c1a_ep>; };}; 379 port@8 { reg = <8>; codec2_8_ep: endpoint { remote-endpoint = <&mc2c1b_ep>; };}; 380 }; 381 }; 382}; 383