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