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    additionalProperties: true
138    description: |
139      WCD934x subnode for each slave devices. Bindings of each subnodes
140      depends on the specific driver providing the functionality and
141      documented in their respective bindings.
142
143    properties:
144      reg:
145        maxItems: 1
146
147    required:
148      - reg
149
150required:
151  - compatible
152  - reg
153
154allOf:
155  - if:
156      required:
157        - slim-ifc-dev
158    then:
159      required:
160        - reset-gpios
161        - slim-ifc-dev
162        - interrupt-controller
163        - clock-frequency
164        - clock-output-names
165        - qcom,micbias1-microvolt
166        - qcom,micbias2-microvolt
167        - qcom,micbias3-microvolt
168        - qcom,micbias4-microvolt
169        - "#interrupt-cells"
170        - "#clock-cells"
171        - "#sound-dai-cells"
172        - "#address-cells"
173        - "#size-cells"
174      oneOf:
175        - required:
176            - interrupts-extended
177        - required:
178            - interrupts
179    else:
180      properties:
181        reset-gpios: false
182        slim-ifc-dev: false
183        interrupts: false
184        interrupt-controller: false
185        clock-frequency: false
186        clock-output-names: false
187        qcom,micbias1-microvolt: false
188        qcom,micbias2-microvolt: false
189        qcom,micbias3-microvolt: false
190        qcom,micbias4-microvolt: false
191        "#interrupt-cells": false
192        "#clock-cells": false
193        "#sound-dai-cells": false
194        "#address-cells": false
195        "#size-cells": false
196
197additionalProperties: false
198
199examples:
200  - |
201    codec@1,0{
202        compatible = "slim217,250";
203        reg  = <1 0>;
204        reset-gpios = <&tlmm 64 0>;
205        slim-ifc-dev  = <&wcd9340_ifd>;
206        #sound-dai-cells = <1>;
207        interrupt-parent = <&tlmm>;
208        interrupts = <54 4>;
209        interrupt-controller;
210        #interrupt-cells = <1>;
211        #clock-cells = <0>;
212        clock-frequency = <9600000>;
213        clock-output-names = "mclk";
214        qcom,micbias1-microvolt = <1800000>;
215        qcom,micbias2-microvolt = <1800000>;
216        qcom,micbias3-microvolt = <1800000>;
217        qcom,micbias4-microvolt = <1800000>;
218        qcom,hphl-jack-type-normally-closed;
219        qcom,ground-jack-type-normally-closed;
220        qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>;
221        qcom,mbhc-headset-vthreshold-microvolt = <1700000>;
222        qcom,mbhc-headphone-vthreshold-microvolt = <50000>;
223        clock-names = "extclk";
224        clocks = <&rpmhcc 2>;
225
226        #address-cells = <1>;
227        #size-cells = <1>;
228
229        gpio@42 {
230            compatible = "qcom,wcd9340-gpio";
231            reg = <0x42 0x2>;
232            gpio-controller;
233            #gpio-cells = <2>;
234        };
235    };
236
237...
238