1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/qcom,wcd934x.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm WCD9340/WCD9341 Audio Codec
8
9maintainers:
10  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
11
12description: |
13  Qualcomm WCD9340/WCD9341 Codec is a standalone Hi-Fi audio codec IC.
14  It has in-built Soundwire controller, pin controller, interrupt mux and
15  supports both I2S/I2C and SLIMbus audio interfaces.
16
17properties:
18  compatible:
19    const: slim217,250
20
21  reg:
22    maxItems: 1
23
24  interrupts:
25    maxItems: 1
26
27  reset-gpios:
28    description: GPIO spec for reset line to use
29    maxItems: 1
30
31  slim-ifc-dev:
32    description: IFC device interface
33    $ref: /schemas/types.yaml#/definitions/phandle
34
35  clocks:
36    maxItems: 1
37
38  clock-names:
39    const: extclk
40
41  vdd-buck-supply:
42    description: A reference to the 1.8V buck supply
43
44  vdd-buck-sido-supply:
45    description: A reference to the 1.8V SIDO buck supply
46
47  vdd-rx-supply:
48    description: A reference to the 1.8V rx supply
49
50  vdd-tx-supply:
51    description: A reference to the 1.8V tx supply
52
53  vdd-vbat-supply:
54    description: A reference to the vbat supply
55
56  vdd-io-supply:
57    description: A reference to the 1.8V I/O supply
58
59  vdd-micbias-supply:
60    description: A reference to the micbias supply
61
62  qcom,micbias1-microvolt:
63    description: micbias1 voltage
64    minimum: 1800000
65    maximum: 2850000
66
67  qcom,micbias2-microvolt:
68    description: micbias2 voltage
69    minimum: 1800000
70    maximum: 2850000
71
72  qcom,micbias3-microvolt:
73    description: micbias3 voltage
74    minimum: 1800000
75    maximum: 2850000
76
77  qcom,micbias4-microvolt:
78    description: micbias4 voltage
79    minimum: 1800000
80    maximum: 2850000
81
82  qcom,hphl-jack-type-normally-closed:
83    description: Indicates that HPHL jack switch type is normally closed
84    type: boolean
85
86  qcom,ground-jack-type-normally-closed:
87    description: Indicates that Headset Ground switch type is normally closed
88    type: boolean
89
90  qcom,mbhc-headset-vthreshold-microvolt:
91    description: Voltage threshold value for headset detection
92    minimum: 0
93    maximum: 2850000
94
95  qcom,mbhc-headphone-vthreshold-microvolt:
96    description: Voltage threshold value for headphone detection
97    minimum: 0
98    maximum: 2850000
99
100  qcom,mbhc-buttons-vthreshold-microvolt:
101    description:
102      Array of 8 Voltage threshold values corresponding to headset
103      button0 - button7
104    minItems: 8
105    maxItems: 8
106
107  clock-output-names:
108    const: mclk
109
110  clock-frequency:
111    description: Clock frequency of output clk in Hz
112
113  interrupt-controller: true
114
115  '#interrupt-cells':
116    const: 1
117
118  '#clock-cells':
119    const: 0
120
121  '#sound-dai-cells':
122    const: 1
123
124  "#address-cells":
125    const: 1
126
127  "#size-cells":
128    const: 1
129
130  gpio@42:
131    type: object
132    $ref: /schemas/gpio/qcom,wcd934x-gpio.yaml#
133
134patternProperties:
135  "^.*@[0-9a-f]+$":
136    type: object
137    description: |
138      WCD934x subnode for each slave devices. Bindings of each subnodes
139      depends on the specific driver providing the functionality and
140      documented in their respective bindings.
141
142    properties:
143      reg:
144        maxItems: 1
145
146    required:
147      - reg
148
149required:
150  - compatible
151  - reg
152
153allOf:
154  - if:
155      required:
156        - slim-ifc-dev
157    then:
158      required:
159        - reset-gpios
160        - slim-ifc-dev
161        - interrupt-controller
162        - clock-frequency
163        - clock-output-names
164        - qcom,micbias1-microvolt
165        - qcom,micbias2-microvolt
166        - qcom,micbias3-microvolt
167        - qcom,micbias4-microvolt
168        - "#interrupt-cells"
169        - "#clock-cells"
170        - "#sound-dai-cells"
171        - "#address-cells"
172        - "#size-cells"
173      oneOf:
174        - required:
175            - interrupts-extended
176        - required:
177            - interrupts
178    else:
179      properties:
180        reset-gpios: false
181        slim-ifc-dev: false
182        interrupts: false
183        interrupt-controller: false
184        clock-frequency: false
185        clock-output-names: false
186        qcom,micbias1-microvolt: false
187        qcom,micbias2-microvolt: false
188        qcom,micbias3-microvolt: false
189        qcom,micbias4-microvolt: false
190        "#interrupt-cells": false
191        "#clock-cells": false
192        "#sound-dai-cells": false
193        "#address-cells": false
194        "#size-cells": false
195
196additionalProperties: false
197
198examples:
199  - |
200    codec@1,0{
201        compatible = "slim217,250";
202        reg  = <1 0>;
203        reset-gpios = <&tlmm 64 0>;
204        slim-ifc-dev  = <&wcd9340_ifd>;
205        #sound-dai-cells = <1>;
206        interrupt-parent = <&tlmm>;
207        interrupts = <54 4>;
208        interrupt-controller;
209        #interrupt-cells = <1>;
210        #clock-cells = <0>;
211        clock-frequency = <9600000>;
212        clock-output-names = "mclk";
213        qcom,micbias1-microvolt = <1800000>;
214        qcom,micbias2-microvolt = <1800000>;
215        qcom,micbias3-microvolt = <1800000>;
216        qcom,micbias4-microvolt = <1800000>;
217        qcom,hphl-jack-type-normally-closed;
218        qcom,ground-jack-type-normally-closed;
219        qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>;
220        qcom,mbhc-headset-vthreshold-microvolt = <1700000>;
221        qcom,mbhc-headphone-vthreshold-microvolt = <50000>;
222        clock-names = "extclk";
223        clocks = <&rpmhcc 2>;
224
225        #address-cells = <1>;
226        #size-cells = <1>;
227
228        gpio@42 {
229            compatible = "qcom,wcd9340-gpio";
230            reg = <0x42 0x2>;
231            gpio-controller;
232            #gpio-cells = <2>;
233        };
234    };
235
236...
237