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