1# SPDX-License-Identifier: GPL-2.0 2%YAML 1.2 3--- 4$id: http://devicetree.org/schemas/sound/simple-card.yaml# 5$schema: http://devicetree.org/meta-schemas/core.yaml# 6 7title: Simple Audio Card Driver 8 9maintainers: 10 - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 11 12definitions: 13 14 frame-master: 15 description: Indicates dai-link frame master. 16 $ref: /schemas/types.yaml#/definitions/phandle 17 18 bitclock-master: 19 description: Indicates dai-link bit clock master 20 $ref: /schemas/types.yaml#/definitions/phandle 21 22 frame-inversion: 23 description: dai-link uses frame clock inversion 24 $ref: /schemas/types.yaml#/definitions/flag 25 26 bitclock-inversion: 27 description: dai-link uses bit clock inversion 28 $ref: /schemas/types.yaml#/definitions/flag 29 30 dai-tdm-slot-num: 31 description: see tdm-slot.txt. 32 $ref: /schemas/types.yaml#/definitions/uint32 33 34 dai-tdm-slot-width: 35 description: see tdm-slot.txt. 36 $ref: /schemas/types.yaml#/definitions/uint32 37 38 system-clock-frequency: 39 description: | 40 If a clock is specified and a multiplication factor is given with 41 mclk-fs, the clock will be set to the calculated mclk frequency 42 when the stream starts. 43 $ref: /schemas/types.yaml#/definitions/uint32 44 45 system-clock-direction-out: 46 description: | 47 specifies clock direction as 'out' on initialization. 48 It is useful for some aCPUs with fixed clocks. 49 $ref: /schemas/types.yaml#/definitions/flag 50 51 system-clock-fixed: 52 description: | 53 Specifies that the clock frequency should not be modified. 54 Implied when system-clock-frequency is specified, but can be used when 55 a clock is mapped to the device whose frequency cannot or should not be 56 changed. When mclk-fs is also specified, this restricts the device to a 57 single fixed sampling rate. 58 $ref: /schemas/types.yaml#/definitions/flag 59 60 mclk-fs: 61 description: | 62 Multiplication factor between stream rate and codec mclk. 63 When defined, mclk-fs property defined in dai-link sub nodes are ignored. 64 $ref: /schemas/types.yaml#/definitions/uint32 65 66 aux-devs: 67 description: | 68 List of phandles pointing to auxiliary devices, such 69 as amplifiers, to be added to the sound card. 70 $ref: /schemas/types.yaml#/definitions/phandle-array 71 72 convert-rate: 73 description: CPU to Codec rate convert. 74 $ref: /schemas/types.yaml#/definitions/uint32 75 76 convert-channels: 77 description: CPU to Codec rate channels. 78 $ref: /schemas/types.yaml#/definitions/uint32 79 80 prefix: 81 description: "device name prefix" 82 $ref: /schemas/types.yaml#/definitions/string 83 84 label: 85 maxItems: 1 86 87 routing: 88 description: | 89 A list of the connections between audio components. 90 Each entry is a pair of strings, the first being the 91 connection's sink, the second being the connection's source. 92 $ref: /schemas/types.yaml#/definitions/non-unique-string-array 93 94 widgets: 95 description: User specified audio sound widgets. 96 $ref: /schemas/types.yaml#/definitions/non-unique-string-array 97 98 pin-switches: 99 description: the widget names for which pin switches must be created. 100 $ref: /schemas/types.yaml#/definitions/string-array 101 102 format: 103 description: audio format. 104 items: 105 enum: 106 - i2s 107 - right_j 108 - left_j 109 - dsp_a 110 - dsp_b 111 - ac97 112 - pdm 113 - msb 114 - lsb 115 116 dai: 117 type: object 118 properties: 119 sound-dai: 120 maxItems: 1 121 122 # common properties 123 mclk-fs: 124 $ref: "#/definitions/mclk-fs" 125 prefix: 126 $ref: "#/definitions/prefix" 127 frame-inversion: 128 $ref: "#/definitions/frame-inversion" 129 bitclock-inversion: 130 $ref: "#/definitions/bitclock-inversion" 131 frame-master: 132 $ref: /schemas/types.yaml#/definitions/flag 133 bitclock-master: 134 $ref: /schemas/types.yaml#/definitions/flag 135 136 dai-tdm-slot-num: 137 $ref: "#/definitions/dai-tdm-slot-num" 138 dai-tdm-slot-width: 139 $ref: "#/definitions/dai-tdm-slot-width" 140 clocks: 141 maxItems: 1 142 system-clock-frequency: 143 $ref: "#/definitions/system-clock-frequency" 144 system-clock-direction-out: 145 $ref: "#/definitions/system-clock-direction-out" 146 system-clock-fixed: 147 $ref: "#/definitions/system-clock-fixed" 148 required: 149 - sound-dai 150 151properties: 152 compatible: 153 contains: 154 enum: 155 - simple-audio-card 156 - simple-scu-audio-card 157 158 "#address-cells": 159 const: 1 160 "#size-cells": 161 const: 0 162 163 label: 164 $ref: "#/definitions/label" 165 166 simple-audio-card,name: 167 description: User specified audio sound card name. 168 $ref: /schemas/types.yaml#/definitions/string 169 170 simple-audio-card,widgets: 171 $ref: "#/definitions/widgets" 172 simple-audio-card,routing: 173 $ref: "#/definitions/routing" 174 175 # common properties 176 simple-audio-card,frame-master: 177 $ref: "#/definitions/frame-master" 178 simple-audio-card,bitclock-master: 179 $ref: "#/definitions/bitclock-master" 180 simple-audio-card,frame-inversion: 181 $ref: "#/definitions/frame-inversion" 182 simple-audio-card,bitclock-inversion: 183 $ref: "#/definitions/bitclock-inversion" 184 simple-audio-card,format: 185 $ref: "#/definitions/format" 186 simple-audio-card,mclk-fs: 187 $ref: "#/definitions/mclk-fs" 188 simple-audio-card,aux-devs: 189 $ref: "#/definitions/aux-devs" 190 simple-audio-card,convert-rate: 191 $ref: "#/definitions/convert-rate" 192 simple-audio-card,convert-channels: 193 $ref: "#/definitions/convert-channels" 194 simple-audio-card,prefix: 195 $ref: "#/definitions/prefix" 196 simple-audio-card,pin-switches: 197 $ref: "#/definitions/pin-switches" 198 simple-audio-card,hp-det-gpio: 199 maxItems: 1 200 simple-audio-card,mic-det-gpio: 201 maxItems: 1 202 203patternProperties: 204 "^simple-audio-card,cpu(@[0-9a-f]+)?$": 205 $ref: "#/definitions/dai" 206 "^simple-audio-card,codec(@[0-9a-f]+)?$": 207 $ref: "#/definitions/dai" 208 209 "^simple-audio-card,dai-link(@[0-9a-f]+)?$": 210 description: | 211 Container for dai-link level properties and the CPU and CODEC sub-nodes. 212 This container may be omitted when the card has only one DAI link. 213 type: object 214 properties: 215 reg: 216 maxItems: 1 217 218 # common properties 219 frame-master: 220 $ref: "#/definitions/frame-master" 221 bitclock-master: 222 $ref: "#/definitions/bitclock-master" 223 frame-inversion: 224 $ref: "#/definitions/frame-inversion" 225 bitclock-inversion: 226 $ref: "#/definitions/bitclock-inversion" 227 format: 228 $ref: "#/definitions/format" 229 mclk-fs: 230 $ref: "#/definitions/mclk-fs" 231 aux-devs: 232 $ref: "#/definitions/aux-devs" 233 convert-rate: 234 $ref: "#/definitions/convert-rate" 235 convert-channels: 236 $ref: "#/definitions/convert-channels" 237 prefix: 238 $ref: "#/definitions/prefix" 239 pin-switches: 240 $ref: "#/definitions/pin-switches" 241 hp-det-gpio: 242 maxItems: 1 243 mic-det-gpio: 244 maxItems: 1 245 246 patternProperties: 247 "^cpu(@[0-9a-f]+)?": 248 $ref: "#/definitions/dai" 249 "^codec(@[0-9a-f]+)?": 250 $ref: "#/definitions/dai" 251 additionalProperties: false 252 253required: 254 - compatible 255 256additionalProperties: false 257 258examples: 259#-------------------- 260# single DAI link 261#-------------------- 262 - | 263 sound { 264 compatible = "simple-audio-card"; 265 simple-audio-card,name = "VF610-Tower-Sound-Card"; 266 simple-audio-card,format = "left_j"; 267 simple-audio-card,bitclock-master = <&dailink0_master>; 268 simple-audio-card,frame-master = <&dailink0_master>; 269 simple-audio-card,widgets = 270 "Microphone", "Microphone Jack", 271 "Headphone", "Headphone Jack", 272 "Speaker", "External Speaker"; 273 simple-audio-card,routing = 274 "MIC_IN", "Microphone Jack", 275 "Headphone Jack", "HP_OUT", 276 "External Speaker", "LINE_OUT"; 277 278 simple-audio-card,cpu { 279 sound-dai = <&sh_fsi2 0>; 280 }; 281 282 dailink0_master: simple-audio-card,codec { 283 sound-dai = <&ak4648>; 284 clocks = <&osc>; 285 }; 286 }; 287 288#-------------------- 289# Multi DAI links 290#-------------------- 291 - | 292 sound { 293 compatible = "simple-audio-card"; 294 simple-audio-card,name = "Cubox Audio"; 295 296 #address-cells = <1>; 297 #size-cells = <0>; 298 299 simple-audio-card,dai-link@0 { /* I2S - HDMI */ 300 reg = <0>; 301 format = "i2s"; 302 cpu { 303 sound-dai = <&audio0>; 304 }; 305 codec { 306 sound-dai = <&tda998x0>; 307 }; 308 }; 309 310 simple-audio-card,dai-link@1 { /* S/PDIF - HDMI */ 311 reg = <1>; 312 cpu { 313 sound-dai = <&audio1>; 314 }; 315 codec { 316 sound-dai = <&tda998x1>; 317 }; 318 }; 319 320 simple-audio-card,dai-link@2 { /* S/PDIF - S/PDIF */ 321 reg = <2>; 322 cpu { 323 sound-dai = <&audio2>; 324 }; 325 codec { 326 sound-dai = <&spdif_codec>; 327 }; 328 }; 329 }; 330 331#-------------------- 332# route audio from IMX6 SSI2 through TLV320DAC3100 codec 333# through TPA6130A2 amplifier to headphones: 334#-------------------- 335 - | 336 sound { 337 compatible = "simple-audio-card"; 338 339 simple-audio-card,widgets = 340 "Headphone", "Headphone Jack"; 341 simple-audio-card,routing = 342 "Headphone Jack", "HPLEFT", 343 "Headphone Jack", "HPRIGHT", 344 "LEFTIN", "HPL", 345 "RIGHTIN", "HPR"; 346 simple-audio-card,aux-devs = <&>; 347 simple-audio-card,cpu { 348 sound-dai = <&ssi2>; 349 }; 350 simple-audio-card,codec { 351 sound-dai = <&codec>; 352 clocks = <&clocks>; 353 }; 354 }; 355 356#-------------------- 357# Sampling Rate Conversion 358#-------------------- 359 - | 360 sound { 361 compatible = "simple-audio-card"; 362 363 simple-audio-card,name = "rsnd-ak4643"; 364 simple-audio-card,format = "left_j"; 365 simple-audio-card,bitclock-master = <&sndcodec>; 366 simple-audio-card,frame-master = <&sndcodec>; 367 368 simple-audio-card,convert-rate = <48000>; 369 370 simple-audio-card,prefix = "ak4642"; 371 simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback", 372 "DAI0 Capture", "ak4642 Capture"; 373 374 sndcpu: simple-audio-card,cpu { 375 sound-dai = <&rcar_sound>; 376 }; 377 378 sndcodec: simple-audio-card,codec { 379 sound-dai = <&ak4643>; 380 system-clock-frequency = <11289600>; 381 }; 382 }; 383 384#-------------------- 385# 2 CPU 1 Codec (Mixing) 386#-------------------- 387 - | 388 sound { 389 compatible = "simple-audio-card"; 390 #address-cells = <1>; 391 #size-cells = <0>; 392 393 simple-audio-card,name = "rsnd-ak4643"; 394 simple-audio-card,format = "left_j"; 395 simple-audio-card,bitclock-master = <&dpcmcpu>; 396 simple-audio-card,frame-master = <&dpcmcpu>; 397 398 simple-audio-card,convert-rate = <48000>; 399 simple-audio-card,convert-channels = <2>; 400 401 simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback", 402 "ak4642 Playback", "DAI1 Playback"; 403 404 dpcmcpu: simple-audio-card,cpu@0 { 405 reg = <0>; 406 sound-dai = <&rcar_sound 0>; 407 }; 408 409 simple-audio-card,cpu@1 { 410 reg = <1>; 411 sound-dai = <&rcar_sound 1>; 412 }; 413 414 simple-audio-card,codec { 415 prefix = "ak4642"; 416 sound-dai = <&ak4643>; 417 clocks = <&audio_clock>; 418 }; 419 }; 420 421#-------------------- 422# Multi DAI links with DPCM: 423# 424# CPU0 ------ ak4613 425# CPU1 ------ PCM3168A-p /* DPCM 1ch/2ch */ 426# CPU2 --/ /* DPCM 3ch/4ch */ 427# CPU3 --/ /* DPCM 5ch/6ch */ 428# CPU4 --/ /* DPCM 7ch/8ch */ 429# CPU5 ------ PCM3168A-c 430#-------------------- 431 - | 432 sound { 433 compatible = "simple-audio-card"; 434 #address-cells = <1>; 435 #size-cells = <0>; 436 437 simple-audio-card,routing = 438 "pcm3168a Playback", "DAI1 Playback", 439 "pcm3168a Playback", "DAI2 Playback", 440 "pcm3168a Playback", "DAI3 Playback", 441 "pcm3168a Playback", "DAI4 Playback"; 442 443 simple-audio-card,dai-link@0 { 444 reg = <0>; 445 format = "left_j"; 446 bitclock-master = <&sndcpu0>; 447 frame-master = <&sndcpu0>; 448 449 sndcpu0: cpu { 450 sound-dai = <&rcar_sound 0>; 451 }; 452 codec { 453 sound-dai = <&ak4613>; 454 }; 455 }; 456 457 simple-audio-card,dai-link@1 { 458 reg = <1>; 459 format = "i2s"; 460 bitclock-master = <&sndcpu1>; 461 frame-master = <&sndcpu1>; 462 463 convert-channels = <8>; /* TDM Split */ 464 465 sndcpu1: cpu0 { 466 sound-dai = <&rcar_sound 1>; 467 }; 468 cpu1 { 469 sound-dai = <&rcar_sound 2>; 470 }; 471 cpu2 { 472 sound-dai = <&rcar_sound 3>; 473 }; 474 cpu3 { 475 sound-dai = <&rcar_sound 4>; 476 }; 477 codec { 478 mclk-fs = <512>; 479 prefix = "pcm3168a"; 480 dai-tdm-slot-num = <8>; 481 sound-dai = <&pcm3168a 0>; 482 }; 483 }; 484 485 simple-audio-card,dai-link@2 { 486 reg = <2>; 487 format = "i2s"; 488 bitclock-master = <&sndcpu2>; 489 frame-master = <&sndcpu2>; 490 491 sndcpu2: cpu { 492 sound-dai = <&rcar_sound 5>; 493 }; 494 codec { 495 mclk-fs = <512>; 496 prefix = "pcm3168a"; 497 sound-dai = <&pcm3168a 1>; 498 }; 499 }; 500 }; 501