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