1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/dialog,da7219.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Dialog Semiconductor DA7219 Audio Codec
8
9maintainers:
10  - David Rau <David.Rau.opensource@dm.renesas.com>
11
12description:
13  The DA7219 is an ultra low-power audio codec with
14  in-built advanced accessory detection (AAD) for mobile
15  computing and accessory applications, which supports
16  sample rates up to 96 kHz at 24-bit resolution.
17
18properties:
19  compatible:
20    const: dlg,da7219
21
22  reg:
23    maxItems: 1
24
25  interrupts:
26    maxItems: 1
27
28  VDD-supply:
29    description:
30      VDD power supply for the device.
31
32  VDDMIC-supply:
33    description:
34      VDDMIC power supply for the device.
35
36  VDDIO-supply:
37    description:
38      VDDIO power supply for the device.
39
40  interrupt-names:
41    description:
42      Should be "wakeup" if interrupt is to be used to wake system,
43      otherwise "irq" should be used.
44    enum:
45      - wakeup
46      - irq
47
48  wakeup-source:
49    type: boolean
50    description:
51      Flag to indicate this device can wake system (suspend/resume).
52
53  "#clock-cells":
54    const: 1
55
56  clock-output-names:
57    minItems: 2
58    maxItems: 2
59    description:
60      Name given for DAI WCLK and BCLK outputs.
61
62  clocks:
63    maxItems: 1
64    description:
65      phandle and clock specifier for codec MCLK.
66
67  clock-names:
68    const: mclk
69
70  dlg,micbias-lvl:
71    enum: [1600, 1800, 2000, 2200, 2400, 2600]
72    description:
73      Voltage (mV) for Mic Bias.
74    $ref: /schemas/types.yaml#/definitions/uint32
75
76  dlg,mic-amp-in-sel:
77    enum: ["diff", "se_p", "se_n"]
78    description:
79      Mic input source type.
80
81      diff - Differential.
82
83      se_p - MIC_P.
84      Positive differential analog microphone input.
85
86      se_n - MIC_N.
87      Negative differential analog microphone input.
88    $ref: /schemas/types.yaml#/definitions/string
89
90  da7219_aad:
91    type: object
92    description:
93      Configuration of advanced accessory detection.
94    properties:
95      dlg,micbias-pulse-lvl:
96        enum: [2800, 2900]
97        description:
98          Mic bias higher voltage pulse level (mV).
99        $ref: /schemas/types.yaml#/definitions/uint32
100
101      dlg,micbias-pulse-time:
102        description:
103          Mic bias higher voltage pulse duration (ms).
104        $ref: /schemas/types.yaml#/definitions/uint32
105        minimum: 0
106
107      dlg,btn-cfg:
108        enum: [2, 5, 10, 50, 100, 200, 500]
109        description:
110          Periodic button press measurements for 4-pole jack (ms).
111        $ref: /schemas/types.yaml#/definitions/uint32
112
113      dlg,mic-det-thr:
114        enum: [200, 500, 750, 1000]
115        description:
116          Impedance threshold for mic detection measurement (Ohms).
117        $ref: /schemas/types.yaml#/definitions/uint32
118
119      dlg,jack-ins-deb:
120        enum: [5, 10, 20, 50, 100, 200, 500, 1000]
121        description:
122          Debounce time for jack insertion (ms).
123        $ref: /schemas/types.yaml#/definitions/uint32
124
125      dlg,jack-ins-det-pty:
126        enum: ["low", "high"]
127        description:
128          Polarity for jack insertion detection.
129        $ref: /schemas/types.yaml#/definitions/string
130
131      dlg,jack-det-rate:
132        enum: ["32_64", "64_128", "128_256", "256_512"]
133        description:
134          Jack type (3/4 pole) detection latency (ms).
135        $ref: /schemas/types.yaml#/definitions/string
136
137      dlg,jack-rem-deb:
138        enum: [1, 5, 10, 20]
139        description:
140          Debounce time for jack removal (ms).
141        $ref: /schemas/types.yaml#/definitions/uint32
142
143      dlg,a-d-btn-thr:
144        description:
145          Impedance threshold between buttons A and D.
146        $ref: /schemas/types.yaml#/definitions/uint32
147        minimum: 0
148        maximum: 255
149
150      dlg,d-b-btn-thr:
151        description:
152          Impedance threshold between buttons D and B.
153        $ref: /schemas/types.yaml#/definitions/uint32
154        minimum: 0
155        maximum: 255
156
157      dlg,b-c-btn-thr:
158        description:
159          Impedance threshold between buttons B and C.
160        $ref: /schemas/types.yaml#/definitions/uint32
161        minimum: 0
162        maximum: 255
163
164      dlg,c-mic-btn-thr:
165        description:
166          Impedance threshold between button C and Mic.
167        $ref: /schemas/types.yaml#/definitions/uint32
168        minimum: 0
169        maximum: 255
170
171      dlg,btn-avg:
172        enum: [1, 2, 4, 8]
173        description:
174          Number of 8-bit readings for averaged button measurement.
175        $ref: /schemas/types.yaml#/definitions/uint32
176
177      dlg,adc-1bit-rpt:
178        enum: [1, 2, 4, 8]
179        description:
180          Repeat count for 1-bit button measurement.
181        $ref: /schemas/types.yaml#/definitions/uint32
182
183required:
184  - compatible
185  - reg
186  - interrupts
187  - VDD-supply
188  - VDDMIC-supply
189  - VDDIO-supply
190
191additionalProperties: false
192
193examples:
194  - |
195    #include <dt-bindings/interrupt-controller/irq.h>
196    i2c {
197      #address-cells = <1>;
198      #size-cells = <0>;
199
200      codec: da7219@1a {
201          compatible = "dlg,da7219";
202          reg = <0x1a>;
203
204          interrupt-parent = <&gpio6>;
205          interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
206
207          VDD-supply = <&vdd_reg>;
208          VDDMIC-supply = <&vddmic_reg>;
209          VDDIO-supply = <&vddio_reg>;
210
211          #clock-cells = <1>;
212          clock-output-names = "da7219-dai-wclk", "da7219-dai-bclk";
213
214          clocks = <&clks 201>;
215          clock-names = "mclk";
216
217          dlg,micbias-lvl = <2600>;
218          dlg,mic-amp-in-sel = "diff";
219
220          da7219_aad {
221              dlg,btn-cfg = <50>;
222              dlg,mic-det-thr = <500>;
223              dlg,jack-ins-deb = <20>;
224              dlg,jack-ins-det-pty = "low";
225              dlg,jack-det-rate = "32_64";
226              dlg,jack-rem-deb = <1>;
227
228              dlg,a-d-btn-thr = <0xa>;
229              dlg,d-b-btn-thr = <0x16>;
230              dlg,b-c-btn-thr = <0x21>;
231              dlg,c-mic-btn-thr = <0x3E>;
232
233              dlg,btn-avg = <4>;
234              dlg,adc-1bit-rpt = <1>;
235          };
236      };
237    };
238