1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/amlogic,axg-sound-card.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Amlogic AXG sound card
8
9maintainers:
10  - Jerome Brunet <jbrunet@baylibre.com>
11
12allOf:
13  - $ref: sound-card-common.yaml#
14
15properties:
16  compatible:
17    const: amlogic,axg-sound-card
18
19  audio-aux-devs:
20    $ref: /schemas/types.yaml#/definitions/phandle-array
21    description: list of auxiliary devices
22
23  audio-widgets:
24    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
25    description:
26      A list off component DAPM widget. Each entry is a pair of strings,
27      the first being the widget type, the second being the widget name
28
29patternProperties:
30  "^dai-link-[0-9]+$":
31    type: object
32    additionalProperties: false
33    description:
34      Container for dai-link level properties and the CODEC sub-nodes.
35      There should be at least one (and probably more) subnode of this type
36
37    properties:
38      dai-format:
39        $ref: /schemas/types.yaml#/definitions/string
40        enum: [ i2s, left-j, dsp_a ]
41
42      dai-tdm-slot-num:
43        $ref: /schemas/types.yaml#/definitions/uint32
44        description:
45          Number of slots in use. If omitted, slot number is set to
46          accommodate the largest mask provided.
47        maximum: 32
48
49      dai-tdm-slot-width:
50        $ref: /schemas/types.yaml#/definitions/uint32
51        description: Width in bits for each slot
52        enum: [ 8, 16, 20, 24, 32 ]
53        default: 32
54
55      mclk-fs:
56        $ref: /schemas/types.yaml#/definitions/uint32
57        description:
58          Multiplication factor between the frame rate and master clock
59          rate
60
61      sound-dai:
62        maxItems: 1
63        description: phandle of the CPU DAI
64
65    patternProperties:
66      "^dai-tdm-slot-(t|r)x-mask-[0-3]$":
67        $ref: /schemas/types.yaml#/definitions/uint32-array
68        minItems: 1
69        maxItems: 32
70        description:
71          Transmit and receive cpu slot masks of each TDM lane
72          When omitted, mask is assumed to have to no slots. A valid
73          interface must have at least one slot, so at least one these
74          mask should be provided with an enabled slot.
75
76      "^codec(-[0-9]+)?$":
77        type: object
78        additionalProperties: false
79        description:
80          dai-link representing backend links should have at least one subnode.
81          One subnode for each codec of the dai-link. dai-link representing
82          frontend links have no codec, therefore have no subnodes
83
84        properties:
85          sound-dai:
86            maxItems: 1
87            description: phandle of the codec DAI
88
89        patternProperties:
90          "^dai-tdm-slot-(t|r)x-mask$":
91            $ref: /schemas/types.yaml#/definitions/uint32-array
92            minItems: 1
93            maxItems: 32
94            description: Transmit and receive codec slot masks
95
96        required:
97          - sound-dai
98
99    required:
100      - sound-dai
101
102required:
103  - dai-link-0
104
105unevaluatedProperties: false
106
107examples:
108  - |
109    sound {
110        compatible = "amlogic,axg-sound-card";
111        model = "AXG-S420";
112        audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
113        audio-widgets = "Line", "Lineout",
114                        "Line", "Linein",
115                        "Speaker", "Speaker1 Left",
116                        "Speaker", "Speaker1 Right",
117                        "Speaker", "Speaker2 Left",
118                        "Speaker", "Speaker2 Right";
119        audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
120                        "SPDIFOUT IN 0", "FRDDR_A OUT 3",
121                        "TDM_C Playback", "TDMOUT_C OUT",
122                        "TDMIN_A IN 2", "TDM_C Capture",
123                        "TDMIN_A IN 5", "TDM_C Loopback",
124                        "TODDR_A IN 0", "TDMIN_A OUT",
125                        "Lineout", "Lineout AOUTL",
126                        "Lineout", "Lineout AOUTR",
127                        "Speaker1 Left", "SPK1 OUT_A",
128                        "Speaker2 Left", "SPK2 OUT_A",
129                        "Speaker1 Right", "SPK1 OUT_B",
130                        "Speaker2 Right", "SPK2 OUT_B",
131                        "Linein AINL", "Linein",
132                        "Linein AINR", "Linein";
133
134        dai-link-0 {
135            sound-dai = <&frddr_a>;
136        };
137
138        dai-link-1 {
139            sound-dai = <&toddr_a>;
140        };
141
142        dai-link-2 {
143            sound-dai = <&tdmif_c>;
144            dai-format = "i2s";
145            dai-tdm-slot-tx-mask-2 = <1 1>;
146            dai-tdm-slot-tx-mask-3 = <1 1>;
147            dai-tdm-slot-rx-mask-1 = <1 1>;
148            mclk-fs = <256>;
149
150            codec-0 {
151                sound-dai = <&lineout>;
152            };
153
154            codec-1 {
155                sound-dai = <&speaker_amp1>;
156            };
157
158            codec-2 {
159                sound-dai = <&speaker_amp2>;
160            };
161
162            codec-3 {
163                sound-dai = <&linein>;
164            };
165        };
166
167        dai-link-3 {
168            sound-dai = <&spdifout>;
169
170            codec {
171                sound-dai = <&spdif_dit>;
172            };
173        };
174    };
175