1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/cirrus,cs42l42.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Cirrus Logic CS42L42 audio CODEC
8
9maintainers:
10  - patches@opensource.cirrus.com
11
12description:
13  The CS42L42 is a low-power audio codec designed for portable applications.
14  It provides a high-dynamic range, stereo DAC for audio playback and a mono
15  high-dynamic-range ADC for audio capture. There is an integrated headset
16  detection block.
17
18properties:
19  compatible:
20    enum:
21      - cirrus,cs42l42
22
23  reg:
24    description:
25      The I2C address of the CS42L42.
26    maxItems: 1
27
28  VP-supply:
29    description:
30      VP power supply.
31
32  VCP-supply:
33    description:
34      Charge pump power supply.
35
36  VD_FILT-supply:
37    description:
38      FILT+ power supply.
39
40  VL-supply:
41    description:
42      Logic power supply.
43
44  VA-supply:
45    description:
46      Analog power supply.
47
48  reset-gpios:
49    description:
50      This pin will be asserted and then deasserted to reset the
51      CS42L42 before communication starts.
52    maxItems: 1
53
54  interrupts:
55    description:
56      Interrupt for CS42L42 IRQ line.
57    maxItems: 1
58
59  cirrus,ts-inv:
60    description: |
61      Sets the behaviour of the jack plug detect switch.
62
63      0 - (Default) Shorted to tip when unplugged, open when plugged.
64      This is "inverted tip sense (ITS)" in the datasheet.
65
66      1 - Open when unplugged, shorted to tip when plugged.
67      This is "normal tip sense (TS)" in the datasheet.
68
69      The CS42L42_TS_INV_* defines are available for this.
70    $ref: "/schemas/types.yaml#/definitions/uint32"
71    minimum: 0
72    maximum: 1
73
74  cirrus,ts-dbnc-rise:
75    description: |
76      Debounce the rising edge of TIP_SENSE_PLUG. With no
77      debounce, the tip sense pin might be noisy on a plug event.
78
79      0 - 0ms
80      1 - 125ms
81      2 - 250ms
82      3 - 500ms
83      4 - 750ms
84      5 - 1s (Default)
85      6 - 1.25s
86      7 - 1.5s
87
88      The CS42L42_TS_DBNCE_* defines are available for this.
89    $ref: "/schemas/types.yaml#/definitions/uint32"
90    minimum: 0
91    maximum: 7
92
93  cirrus,ts-dbnc-fall:
94    description: |
95      Debounce the falling edge of TIP_SENSE_UNPLUG. With no
96      debounce, the tip sense pin might be noisy on an unplug event.
97
98      0 - 0ms
99      1 - 125ms
100      2 - 250ms
101      3 - 500ms
102      4 - 750ms
103      5 - 1s (Default)
104      6 - 1.25s
105      7 - 1.5s
106
107      The CS42L42_TS_DBNCE_* defines are available for this.
108    $ref: "/schemas/types.yaml#/definitions/uint32"
109    minimum: 0
110    maximum: 7
111
112  cirrus,btn-det-init-dbnce:
113    description: |
114      This sets how long to wait after enabling button detection
115      interrupts before servicing button interrupts, to allow the
116      HS bias time to settle. Value is in milliseconds.
117      There may be erroneous button interrupts if this debounce time
118      is too short.
119
120      0ms - 200ms,
121      Default = 100ms
122    $ref: "/schemas/types.yaml#/definitions/uint32"
123    minimum: 0
124    maximum: 200
125
126  cirrus,btn-det-event-dbnce:
127    description: |
128      This sets how long to wait after receiving a button press
129      interrupt before processing it. Allows time for the button
130      press to make a clean connection with the bias resistors.
131      Value is in milliseconds.
132
133      0ms - 20ms,
134      Default = 10ms
135    $ref: "/schemas/types.yaml#/definitions/uint32"
136    minimum: 0
137    maximum: 20
138
139  cirrus,bias-lvls:
140    description: |
141      For a level-detect headset button scheme, each button will bias
142      the mic pin to a certain voltage. To determine which button was
143      pressed, the voltage is compared to sequential, decreasing
144      voltages, until the compared voltage < bias voltage.
145      For different hardware setups, a designer might want to tweak this.
146      This is an array of descending values for the comparator voltage,
147      given as percent of the HSBIAS voltage.
148
149      Array of 4 values, each 0-63
150      < x1 x2 x3 x4 >
151      Default = < 15 8 4 1 >
152    $ref: /schemas/types.yaml#/definitions/uint32-array
153    minItems: 4
154    maxItems: 4
155    items:
156      minimum: 0
157      maximum: 63
158
159  cirrus,hs-bias-ramp-rate:
160    description: |
161      If present this sets the rate that the HS bias should rise and fall.
162      The actual rise and fall times depend on external hardware (the
163      datasheet gives several rise and fall time examples).
164
165      0 - Fast rise time; slow, load-dependent fall time
166      1 - Fast
167      2 - Slow (default)
168      3 - Slowest
169
170      The CS42L42_HSBIAS_RAMP_* defines are available for this.
171    $ref: "/schemas/types.yaml#/definitions/uint32"
172    minimum: 0
173    maximum: 3
174
175  cirrus,hs-bias-sense-disable:
176    description: |
177      If present the HSBIAS sense is disabled. Configures HSBIAS output
178      current sense through the external 2.21-k resistor. HSBIAS_SENSE
179      is a hardware feature to reduce the potential pop noise when the
180      headset plug is removed slowly. But on some platforms ESD voltage
181      will affect it causing plug detection to fail, especially with CTIA
182      headset type. For different hardware setups, a designer might want
183      to tweak default behavior.
184    type: boolean
185
186required:
187  - compatible
188  - reg
189  - VP-supply
190  - VCP-supply
191  - VD_FILT-supply
192  - VL-supply
193  - VA-supply
194
195additionalProperties: false
196
197examples:
198  - |
199    #include <dt-bindings/sound/cs42l42.h>
200    i2c {
201      #address-cells = <1>;
202      #size-cells = <0>;
203
204      cs42l42: cs42l42@48 {
205          compatible = "cirrus,cs42l42";
206          reg = <0x48>;
207          VA-supply = <&dummy_vreg>;
208          VP-supply = <&dummy_vreg>;
209          VCP-supply = <&dummy_vreg>;
210          VD_FILT-supply = <&dummy_vreg>;
211          VL-supply = <&dummy_vreg>;
212
213          reset-gpios = <&axi_gpio_0 1 0>;
214          interrupt-parent = <&gpio0>;
215          interrupts = <55 8>;
216
217          cirrus,ts-inv = <CS42L42_TS_INV_DIS>;
218          cirrus,ts-dbnc-rise = <CS42L42_TS_DBNCE_1000>;
219          cirrus,ts-dbnc-fall = <CS42L42_TS_DBNCE_0>;
220          cirrus,btn-det-init-dbnce = <100>;
221          cirrus,btn-det-event-dbnce = <10>;
222          cirrus,bias-lvls = <0x0F 0x08 0x04 0x01>;
223          cirrus,hs-bias-ramp-rate = <CS42L42_HSBIAS_RAMP_SLOW>;
224      };
225    };
226