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