1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/soundwire/qcom,soundwire.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm SoundWire Controller
8
9maintainers:
10  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
11  - Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
12
13description:
14  The Qualcomm SoundWire controller along with its board specific bus parameters.
15
16properties:
17  compatible:
18    enum:
19      - qcom,soundwire-v1.3.0
20      - qcom,soundwire-v1.5.0
21      - qcom,soundwire-v1.5.1
22      - qcom,soundwire-v1.6.0
23      - qcom,soundwire-v1.7.0
24      - qcom,soundwire-v2.0.0
25
26  reg:
27    maxItems: 1
28
29  interrupts:
30    minItems: 1
31    items:
32      - description: specify the SoundWire controller core.
33      - description: specify the Soundwire controller wake IRQ.
34
35  interrupt-names:
36    minItems: 1
37    items:
38      - const: core
39      - const: wakeup
40
41  clocks:
42    items:
43      - description: iface clock
44
45  clock-names:
46    items:
47      - const: iface
48
49  resets:
50    items:
51      - description: SWR_AUDIO_CGCR RESET
52
53  reset-names:
54    items:
55      - const: swr_audio_cgcr
56
57  '#sound-dai-cells':
58    const: 1
59
60  '#address-cells':
61    const: 2
62
63  '#size-cells':
64    const: 0
65
66  wakeup-source: true
67
68  qcom,din-ports:
69    $ref: /schemas/types.yaml#/definitions/uint32
70    description: count of data in ports
71
72  qcom,dout-ports:
73    $ref: /schemas/types.yaml#/definitions/uint32
74    description: count of data out ports
75
76  qcom,ports-word-length:
77    $ref: /schemas/types.yaml#/definitions/uint8-array
78    description:
79      Size of payload channel sample.
80      Value of 0xff indicates that this option is not implemented
81      or applicable for the respective data port.
82      More info in MIPI Alliance SoundWire 1.0 Specifications.
83    minItems: 3
84    maxItems: 16
85
86  qcom,ports-sinterval-low:
87    $ref: /schemas/types.yaml#/definitions/uint8-array
88    description:
89      Sample interval (only lowest byte) of each data port.
90      Out ports followed by In ports. Used for Sample Interval calculation.
91      Value of 0xff indicates that this option is not implemented
92      or applicable for the respective data port.
93      More info in MIPI Alliance SoundWire 1.0 Specifications.
94    minItems: 3
95    maxItems: 16
96
97  qcom,ports-sinterval:
98    $ref: /schemas/types.yaml#/definitions/uint16-array
99    description:
100      Sample interval of each data port.
101      Out ports followed by In ports. Used for Sample Interval calculation.
102      Value of 0xffff indicates that this option is not implemented
103      or applicable for the respective data port.
104      More info in MIPI Alliance SoundWire 1.0 Specifications.
105    minItems: 3
106    maxItems: 16
107
108  qcom,ports-offset1:
109    $ref: /schemas/types.yaml#/definitions/uint8-array
110    description:
111      Payload transport window offset1 of each data port.
112      Out ports followed by In ports.
113      Value of 0xff indicates that this option is not implemented
114      or applicable for the respective data port.
115      More info in MIPI Alliance SoundWire 1.0 Specifications.
116    minItems: 3
117    maxItems: 16
118
119  qcom,ports-offset2:
120    $ref: /schemas/types.yaml#/definitions/uint8-array
121    description:
122      Payload transport window offset2 of each data port.
123      Out ports followed by In ports.
124      Value of 0xff indicates that this option is not implemented
125      or applicable for the respective data port.
126      More info in MIPI Alliance SoundWire 1.0 Specifications.
127    minItems: 3
128    maxItems: 16
129
130  qcom,ports-lane-control:
131    $ref: /schemas/types.yaml#/definitions/uint8-array
132    description:
133      Identify which data lane the data port uses.
134      Out ports followed by In ports.
135      Value of 0xff indicates that this option is not implemented
136      or applicable for the respective data port.
137      More info in MIPI Alliance SoundWire 1.0 Specifications.
138    minItems: 3
139    maxItems: 16
140
141  qcom,ports-block-pack-mode:
142    $ref: /schemas/types.yaml#/definitions/uint8-array
143    description:
144      Indicate the block packing mode.
145      0 to indicate Blocks are per Channel
146      1 to indicate Blocks are per Port.
147      Out ports followed by In ports.
148      Value of 0xff indicates that this option is not implemented
149      or applicable for the respective data port.
150      More info in MIPI Alliance SoundWire 1.0 Specifications.
151    minItems: 3
152    maxItems: 16
153    items:
154      oneOf:
155        - minimum: 0
156          maximum: 1
157        - const: 0xff
158
159  qcom,ports-hstart:
160    $ref: /schemas/types.yaml#/definitions/uint8-array
161    description:
162      Identifying lowerst numbered column in SoundWire Frame,
163      i.e. left edge of the Transport sub-frame for each port.
164      Out ports followed by In ports.
165      Value of 0xff indicates that this option is not implemented
166      or applicable for the respective data port.
167      More info in MIPI Alliance SoundWire 1.0 Specifications.
168    minItems: 3
169    maxItems: 16
170    items:
171      oneOf:
172        - minimum: 0
173          maximum: 15
174        - const: 0xff
175
176  qcom,ports-hstop:
177    $ref: /schemas/types.yaml#/definitions/uint8-array
178    description:
179      Identifying highest numbered column in SoundWire Frame,
180      i.e. the right edge of the Transport
181      sub-frame for each port. Out ports followed by In ports.
182      Value of 0xff indicates that this option is not implemented
183      or applicable for the respective data port.
184      More info in MIPI Alliance SoundWire 1.0 Specifications.
185    minItems: 3
186    maxItems: 16
187    items:
188      oneOf:
189        - minimum: 0
190          maximum: 15
191        - const: 0xff
192
193  qcom,ports-block-group-count:
194    $ref: /schemas/types.yaml#/definitions/uint8-array
195    description:
196      In range 1 to 4 to indicate how many sample intervals are combined
197      into a payload. Out ports followed by In ports.
198      Value of 0xff indicates that this option is not implemented
199      or applicable for the respective data port.
200      More info in MIPI Alliance SoundWire 1.0 Specifications.
201    minItems: 3
202    maxItems: 16
203    items:
204      oneOf:
205        - minimum: 0
206          maximum: 4
207        - const: 0xff
208
209  label:
210    maxItems: 1
211
212patternProperties:
213  "^.*@[0-9a-f],[0-9a-f]$":
214    type: object
215    additionalProperties: true
216    description:
217      Child nodes for a standalone audio codec or speaker amplifier IC.
218      It has RX and TX Soundwire secondary devices.
219    properties:
220      compatible:
221        pattern: "^sdw[0-9a-f]{1}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{2}$"
222
223required:
224  - compatible
225  - reg
226  - interrupts
227  - clocks
228  - clock-names
229  - '#sound-dai-cells'
230  - '#address-cells'
231  - '#size-cells'
232  - qcom,dout-ports
233  - qcom,din-ports
234  - qcom,ports-offset1
235  - qcom,ports-offset2
236
237oneOf:
238  - required:
239      - qcom,ports-sinterval-low
240  - required:
241      - qcom,ports-sinterval
242
243additionalProperties: false
244
245examples:
246  - |
247    #include <dt-bindings/interrupt-controller/arm-gic.h>
248    #include <dt-bindings/interrupt-controller/irq.h>
249    #include <dt-bindings/clock/qcom,lpassaudiocc-sc7280.h>
250
251    soundwire@3210000 {
252        compatible = "qcom,soundwire-v1.6.0";
253        reg = <0x03210000 0x2000>;
254
255        interrupts = <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>,
256                     <&pdc 130 IRQ_TYPE_LEVEL_HIGH>;
257
258        interrupt-names = "core", "wakeup";
259
260        clocks = <&lpass_rx_macro>;
261        clock-names = "iface";
262
263        qcom,din-ports = <0>;
264        qcom,dout-ports = <5>;
265
266        resets = <&lpass_audiocc LPASS_AUDIO_SWR_RX_CGCR>;
267        reset-names = "swr_audio_cgcr";
268
269        qcom,ports-word-length =        /bits/ 8 <0x01 0x07 0x04 0xff 0xff>;
270        qcom,ports-sinterval-low =      /bits/ 8 <0x03 0x3f 0x1f 0x03 0x03>;
271        qcom,ports-offset1 =            /bits/ 8 <0x00 0x00 0x0b 0x01 0x01>;
272        qcom,ports-offset2 =            /bits/ 8 <0x00 0x00 0x0b 0x00 0x00>;
273        qcom,ports-lane-control =       /bits/ 8 <0x01 0x00 0x00 0x00 0x00>;
274        qcom,ports-block-pack-mode =    /bits/ 8 <0xff 0x00 0x01 0xff 0xff>;
275        qcom,ports-hstart =             /bits/ 8 <0xff 0x03 0xff 0xff 0xff>;
276        qcom,ports-hstop =              /bits/ 8 <0xff 0x06 0xff 0xff 0xff>;
277        qcom,ports-block-group-count =  /bits/ 8 <0xff 0xff 0xff 0xff 0x00>;
278
279        #sound-dai-cells = <1>;
280        #address-cells = <2>;
281        #size-cells = <0>;
282
283        codec@0,4 {
284            compatible = "sdw20217010d00";
285            reg = <0 4>;
286            qcom,rx-port-mapping = <1 2 3 4 5>;
287        };
288    };
289