xref: /freebsd/sys/contrib/device-tree/Bindings/sound/nuvoton,nau8824.yaml (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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,nau8824.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: NAU8824 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,nau8824
19
20  reg:
21    maxItems: 1
22
23  '#sound-dai-cells':
24    const: 0
25
26  interrupts:
27    maxItems: 1
28
29  nuvoton,jkdet-polarity:
30    $ref: /schemas/types.yaml#/definitions/uint32
31    description:
32      JKDET pin polarity.
33    enum:
34      - 0 # active high
35      - 1 # active low
36    default: 1
37
38  nuvoton,vref-impedance:
39    $ref: /schemas/types.yaml#/definitions/uint32
40    description:
41      VREF Impedance selection.
42    enum:
43      - 0 # Open
44      - 1 # 25 kOhm
45      - 2 # 125 kOhm
46      - 3 # 2.5 kOhm
47    default: 2
48
49  nuvoton,micbias-voltage:
50    $ref: /schemas/types.yaml#/definitions/uint32
51    description:
52      Micbias voltage level.
53    enum:
54      - 0 # VDDA
55      - 1 # VDDA
56      - 2 # VDDA * 1.1
57      - 3 # VDDA * 1.2
58      - 4 # VDDA * 1.3
59      - 5 # VDDA * 1.4
60      - 6 # VDDA * 1.53
61      - 7 # VDDA * 1.53
62    default: 6
63
64  nuvoton,sar-threshold-num:
65    $ref: /schemas/types.yaml#/definitions/uint32
66    description:
67      Number of buttons supported.
68    minimum: 1
69    maximum: 8
70    default: 4
71
72  nuvoton,sar-threshold:
73    $ref: /schemas/types.yaml#/definitions/uint32-array
74    description:
75      Impedance threshold for each button. Array that contains up to 8 buttons
76      configuration. SAR value is calculated as
77      SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R) where MICBIAS is
78      configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by
79      'nuvoton,sar-voltage', R - button impedance.
80      Refer datasheet section 10.2 for more information about threshold
81      calculation.
82    minItems: 1
83    maxItems: 8
84    items:
85      minimum: 0
86      maximum: 255
87
88  nuvoton,sar-hysteresis:
89    $ref: /schemas/types.yaml#/definitions/uint32
90    description:
91      Button impedance measurement hysteresis.
92    default: 0
93
94  nuvoton,sar-voltage:
95    $ref: /schemas/types.yaml#/definitions/uint32
96    description:
97      Reference voltage for button impedance measurement.
98    enum:
99      - 0 # VDDA
100      - 1 # VDDA
101      - 2 # VDDA * 1.1
102      - 3 # VDDA * 1.2
103      - 4 # VDDA * 1.3
104      - 5 # VDDA * 1.4
105      - 6 # VDDA * 1.53
106      - 7 # VDDA * 1.53
107    default: 6
108
109  nuvoton,sar-compare-time:
110    $ref: /schemas/types.yaml#/definitions/uint32
111    description:
112      SAR compare time.
113    enum:
114      - 0 # 500ns
115      - 1 # 1us
116      - 2 # 2us
117      - 3 # 4us
118    default: 1
119
120  nuvoton,sar-sampling-time:
121    $ref: /schemas/types.yaml#/definitions/uint32
122    description:
123      SAR sampling time.
124    enum:
125      - 0 # 2us
126      - 1 # 4us
127      - 2 # 8us
128      - 3 # 16us
129    default: 1
130
131  nuvoton,short-key-debounce:
132    $ref: /schemas/types.yaml#/definitions/uint32
133    description:
134      Button short key press debounce time.
135    enum:
136      - 0 # 30 ms
137      - 1 # 50 ms
138      - 2 # 100 ms
139    default: 0
140
141  nuvoton,jack-eject-debounce:
142    $ref: /schemas/types.yaml#/definitions/uint32
143    description:
144      Jack ejection debounce time.
145    enum:
146      - 0 # 0 ms
147      - 1 # 1 ms
148      - 2 # 10 ms
149    default: 1
150
151required:
152  - compatible
153  - reg
154
155unevaluatedProperties: false
156
157examples:
158  - |
159    #include <dt-bindings/gpio/gpio.h>
160    #include <dt-bindings/interrupt-controller/irq.h>
161    i2c {
162        #address-cells = <1>;
163        #size-cells = <0>;
164        codec@1a {
165            #sound-dai-cells = <0>;
166            compatible = "nuvoton,nau8824";
167            reg = <0x1a>;
168            interrupt-parent = <&gpio>;
169            interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
170            nuvoton,vref-impedance = <2>;
171            nuvoton,micbias-voltage = <6>;
172            nuvoton,sar-threshold-num = <4>;
173            // Setup 4 buttons impedance according to Android specification
174            nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>;
175            nuvoton,sar-hysteresis = <0>;
176            nuvoton,sar-voltage = <6>;
177            nuvoton,sar-compare-time = <1>;
178            nuvoton,sar-sampling-time = <1>;
179            nuvoton,short-key-debounce = <0>;
180            nuvoton,jack-eject-debounce = <1>;
181        };
182    };
183