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