xref: /linux/Documentation/devicetree/bindings/sound/nuvoton,nau8825.yaml (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/nuvoton,nau8825.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: NAU8825 audio CODEC
8
9maintainers:
10  - John Hsu <KCHSU0@nuvoton.com>
11
12allOf:
13  - $ref: dai-common.yaml#
14
15properties:
16  compatible:
17    enum:
18      - nuvoton,nau8825
19
20  reg:
21    maxItems: 1
22
23  interrupts:
24    maxItems: 1
25
26  nuvoton,jkdet-enable:
27    description:
28      Enable jack detection via JKDET pin.
29    type: boolean
30
31  nuvoton,jkdet-pull-enable:
32    description:
33      Enable JKDET pin pull.
34      If set - pin pull enabled, otherwise pin in high impedance state.
35    type: boolean
36
37  nuvoton,jkdet-pull-up:
38    description:
39      Pull-up JKDET pin.
40      If set then JKDET pin is pull up, otherwise pull down.
41    type: boolean
42
43  nuvoton,jkdet-polarity:
44    $ref: /schemas/types.yaml#/definitions/uint32
45    description:
46      JKDET pin polarity.
47    enum:
48      - 0 # active high
49      - 1 # active low
50    default: 1
51
52  nuvoton,vref-impedance:
53    $ref: /schemas/types.yaml#/definitions/uint32
54    description:
55      VREF Impedance selection.
56    enum:
57      - 0 # Open
58      - 1 # 25 kOhm
59      - 2 # 125 kOhm
60      - 3 # 2.5 kOhm
61    default: 2
62
63  nuvoton,micbias-voltage:
64    $ref: /schemas/types.yaml#/definitions/uint32
65    description:
66      Micbias voltage level.
67    enum:
68      - 0 # VDDA
69      - 1 # VDDA
70      - 2 # VDDA * 1.1
71      - 3 # VDDA * 1.2
72      - 4 # VDDA * 1.3
73      - 5 # VDDA * 1.4
74      - 6 # VDDA * 1.53
75      - 7 # VDDA * 1.53
76    default: 6
77
78  nuvoton,sar-threshold-num:
79    $ref: /schemas/types.yaml#/definitions/uint32
80    description:
81      Number of buttons supported.
82    minimum: 1
83    maximum: 4
84    default: 4
85
86  nuvoton,sar-threshold:
87    $ref: /schemas/types.yaml#/definitions/uint32-array
88    description:
89      Impedance threshold for each button. Array that contains up to 8 buttons
90      configuration. SAR value is calculated as
91      SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R) where MICBIAS is
92      configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by
93      'nuvoton,sar-voltage', R - button impedance.
94      Refer datasheet section 10.2 for more information about threshold
95      calculation.
96    minItems: 1
97    maxItems: 4
98    items:
99      minimum: 0
100      maximum: 255
101
102  nuvoton,sar-hysteresis:
103    $ref: /schemas/types.yaml#/definitions/uint32
104    description:
105      Button impedance measurement hysteresis.
106    default: 0
107
108  nuvoton,sar-voltage:
109    $ref: /schemas/types.yaml#/definitions/uint32
110    description:
111      Reference voltage for button impedance measurement.
112    enum:
113      - 0 # VDDA
114      - 1 # VDDA
115      - 2 # VDDA * 1.1
116      - 3 # VDDA * 1.2
117      - 4 # VDDA * 1.3
118      - 5 # VDDA * 1.4
119      - 6 # VDDA * 1.53
120      - 7 # VDDA * 1.53
121    default: 6
122
123  nuvoton,sar-compare-time:
124    $ref: /schemas/types.yaml#/definitions/uint32
125    description:
126      SAR compare time.
127    enum:
128      - 0 # 500 ns
129      - 1 # 1 us
130      - 2 # 2 us
131      - 3 # 4 us
132    default: 1
133
134  nuvoton,sar-sampling-time:
135    $ref: /schemas/types.yaml#/definitions/uint32
136    description:
137      SAR sampling time.
138    enum:
139      - 0 # 2 us
140      - 1 # 4 us
141      - 2 # 8 us
142      - 3 # 16 us
143    default: 1
144
145  nuvoton,short-key-debounce:
146    $ref: /schemas/types.yaml#/definitions/uint32
147    description:
148      Button short key press debounce time.
149    enum:
150      - 0 # 30 ms
151      - 1 # 50 ms
152      - 2 # 100 ms
153      - 3 # 30 ms
154    default: 3
155
156  nuvoton,jack-insert-debounce:
157    $ref: /schemas/types.yaml#/definitions/uint32
158    description:
159      number from 0 to 7 that sets debounce time to 2^(n+2) ms.
160    maximum: 7
161    default: 7
162
163  nuvoton,jack-eject-debounce:
164    $ref: /schemas/types.yaml#/definitions/uint32
165    description:
166      number from 0 to 7 that sets debounce time to 2^(n+2) ms
167    maximum: 7
168    default: 0
169
170  nuvoton,crosstalk-enable:
171    description:
172      make crosstalk function enable if set.
173    type: boolean
174
175  nuvoton,adcout-drive-strong:
176    description:
177      make the drive strength of ADCOUT IO PIN strong if set.
178      Otherwise, the drive keeps normal strength.
179    type: boolean
180
181  nuvoton,adc-delay-ms:
182    description:
183      Delay (in ms) to make input path stable and avoid pop noise.
184      The default value is 125 and range between 125 to 500 ms.
185    minimum: 125
186    maximum: 500
187    default: 125
188
189  clocks:
190    maxItems: 1
191
192  clock-names:
193    items:
194      - const: mclk
195
196  '#sound-dai-cells':
197    const: 0
198
199required:
200  - compatible
201  - reg
202
203unevaluatedProperties: false
204
205examples:
206  - |
207    #include <dt-bindings/gpio/gpio.h>
208    #include <dt-bindings/interrupt-controller/irq.h>
209    i2c {
210        #address-cells = <1>;
211        #size-cells = <0>;
212        codec@1a {
213            #sound-dai-cells = <0>;
214            compatible = "nuvoton,nau8825";
215            reg = <0x1a>;
216            interrupt-parent = <&gpio>;
217            interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
218            nuvoton,jkdet-enable;
219            nuvoton,jkdet-pull-enable;
220            nuvoton,jkdet-pull-up;
221            nuvoton,jkdet-polarity = <GPIO_ACTIVE_LOW>;
222            nuvoton,vref-impedance = <2>;
223            nuvoton,micbias-voltage = <6>;
224            // Setup 4 buttons impedance according to Android specification
225            nuvoton,sar-threshold-num = <4>;
226            nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>;
227            nuvoton,sar-hysteresis = <1>;
228            nuvoton,sar-voltage = <0>;
229            nuvoton,sar-compare-time = <0>;
230            nuvoton,sar-sampling-time = <0>;
231            nuvoton,short-key-debounce = <2>;
232            nuvoton,jack-insert-debounce = <7>;
233            nuvoton,jack-eject-debounce = <7>;
234            nuvoton,crosstalk-enable;
235
236            clock-names = "mclk";
237            clocks = <&tegra_pmc 1>;
238        };
239    };
240