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