summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/sound/cirrus,cs42l43.yaml
blob: 7f9d8c7a635a6ffc1cb4ad3a7987929d28391488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/cirrus,cs42l43.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Cirrus Logic CS42L43 Audio CODEC

maintainers:
  - patches@opensource.cirrus.com

description: |
  The CS42L43 is an audio CODEC with integrated MIPI SoundWire interface
  (Version 1.2.1 compliant), I2C, SPI, and I2S/TDM interfaces designed
  for portable applications. It provides a high dynamic range, stereo
  DAC for headphone output, two integrated Class D amplifiers for
  loudspeakers, and two ADCs for wired headset microphone input or
  stereo line input. PDM inputs are provided for digital microphones.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - cirrus,cs42l43

  reg:
    maxItems: 1

  vdd-p-supply:
    description:
      Power supply for the high voltage interface.

  vdd-a-supply:
    description:
      Power supply for internal analog circuits.

  vdd-d-supply:
    description:
      Power supply for internal digital circuits. Can be internally supplied.

  vdd-io-supply:
    description:
      Power supply for external interface and internal digital logic.

  vdd-cp-supply:
    description:
      Power supply for the amplifier 3 and 4 charge pump.

  vdd-amp-supply:
    description:
      Power supply for amplifier 1 and 2.

  reset-gpios:
    maxItems: 1

  interrupt-controller: true

  "#interrupt-cells":
    const: 2

  interrupts:
    maxItems: 1

  "#sound-dai-cells":
    const: 1

  clocks:
    items:
      - description: Synchronous audio clock provided on mclk_in.

  clock-names:
    const: mclk

  cirrus,bias-low:
    type: boolean
    description:
      Select a 1.8V headset micbias rather than 2.8V.

  cirrus,bias-sense-microamp:
    description:
      Current at which the headset micbias sense clamp will engage, 0 to
      disable.
    enum: [ 0, 14, 24, 43, 52, 61, 71, 90, 99 ]
    default: 14

  cirrus,bias-ramp-ms:
    description:
      Time in milliseconds the hardware allows for the headset micbias to
      ramp up.
    enum: [ 10, 40, 90, 170 ]
    default: 170

  cirrus,detect-us:
    description:
      Time in microseconds the type detection will run for. Long values will
      cause more audible effects, but give more accurate detection.
    enum: [ 20, 100, 1000, 10000, 50000, 75000, 100000, 200000 ]
    default: 1000

  cirrus,button-automute:
    type: boolean
    description:
      Enable the hardware automuting of decimator 1 when a headset button is
      pressed.

  cirrus,buttons-ohms:
    description:
      Impedance in Ohms for each headset button, these should be listed in
      ascending order.
    minItems: 1
    maxItems: 6

  cirrus,tip-debounce-ms:
    description:
      Software debounce on tip sense triggering in milliseconds.
    default: 0

  cirrus,tip-invert:
    type: boolean
    description:
      Indicates tip detect polarity, inverted implies open-circuit whilst the
      jack is inserted.

  cirrus,tip-disable-pullup:
    type: boolean
    description:
      Indicates if the internal pullup on the tip detect should be disabled.

  cirrus,tip-fall-db-ms:
    description:
      Time in milliseconds a falling edge on the tip detect should be hardware
      debounced for. Note the falling edge is considered after the invert.
    enum: [ 0, 125, 250, 500, 750, 1000, 1250, 1500 ]
    default: 500

  cirrus,tip-rise-db-ms:
    description:
      Time in milliseconds a rising edge on the tip detect should be hardware
      debounced for. Note the rising edge is considered after the invert.
    enum: [ 0, 125, 250, 500, 750, 1000, 1250, 1500 ]
    default: 500

  cirrus,use-ring-sense:
    type: boolean
    description:
      Indicates if the ring sense should be used.

  cirrus,ring-invert:
    type: boolean
    description:
      Indicates ring detect polarity, inverted implies open-circuit whilst the
      jack is inserted.

  cirrus,ring-disable-pullup:
    type: boolean
    description:
      Indicates if the internal pullup on the ring detect should be disabled.

  cirrus,ring-fall-db-ms:
    description:
      Time in milliseconds a falling edge on the ring detect should be hardware
      debounced for. Note the falling edge is considered after the invert.
    enum: [ 0, 125, 250, 500, 750, 1000, 1250, 1500 ]
    default: 500

  cirrus,ring-rise-db-ms:
    description:
      Time in milliseconds a rising edge on the ring detect should be hardware
      debounced for. Note the rising edge is considered after the invert.
    enum: [ 0, 125, 250, 500, 750, 1000, 1250, 1500 ]
    default: 500

  pinctrl:
    type: object
    $ref: /schemas/pinctrl/pinctrl.yaml#
    additionalProperties: false

    properties:
      gpio-controller: true

      "#gpio-cells":
        const: 2

      gpio-ranges:
        items:
          - description: A phandle to the CODEC pinctrl node
            minimum: 0
          - const: 0
          - const: 0
          - const: 3

    patternProperties:
      "-state$":
        oneOf:
          - $ref: "#/$defs/cirrus-cs42l43-state"
          - patternProperties:
              "-pins$":
                $ref: "#/$defs/cirrus-cs42l43-state"
            additionalProperties: false

  spi:
    type: object
    $ref: /schemas/spi/spi-controller.yaml#
    unevaluatedProperties: false

$defs:
  cirrus-cs42l43-state:
    type: object

    allOf:
      - $ref: /schemas/pinctrl/pincfg-node.yaml#
      - $ref: /schemas/pinctrl/pinmux-node.yaml#

    oneOf:
      - required: [ groups ]
      - required: [ pins ]

    additionalProperties: false

    properties:
      groups:
        enum: [ gpio1, gpio2, gpio3, asp, pdmout2, pdmout1, i2c, spi ]

      pins:
        enum: [ gpio1, gpio2, gpio3,
                asp_dout, asp_fsync, asp_bclk,
                pdmout2_clk, pdmout2_data, pdmout1_clk, pdmout1_data,
                i2c_sda, i2c_scl,
                spi_miso, spi_sck, spi_ssb ]

      function:
        enum: [ gpio, spdif, irq, mic-shutter, spk-shutter ]

      drive-strength:
        description: Set drive strength in mA
        enum: [ 1, 2, 4, 8, 9, 10, 12, 16 ]

      input-debounce:
        description: Set input debounce in uS
        enum: [ 0, 85 ]

required:
  - compatible
  - reg
  - vdd-p-supply
  - vdd-a-supply
  - vdd-io-supply
  - vdd-cp-supply

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>

    i2c {
        #address-cells = <1>;
        #size-cells = <0>;

        cs42l43: codec@1a {
            compatible = "cirrus,cs42l43";
            reg = <0x1a>;

            vdd-p-supply = <&vdd5v0>;
            vdd-a-supply = <&vdd1v8>;
            vdd-io-supply = <&vdd1v8>;
            vdd-cp-supply = <&vdd1v8>;
            vdd-amp-supply = <&vdd5v0>;

            reset-gpios = <&gpio 0>;

            interrupt-controller;
            #interrupt-cells = <2>;
            interrupt-parent = <&gpio>;
            interrupts = <56 IRQ_TYPE_LEVEL_LOW>;

            #sound-dai-cells = <1>;

            clocks = <&clks 0>;
            clock-names = "mclk";

            cs42l43_pins: pinctrl {
                gpio-controller;
                #gpio-cells = <2>;
                gpio-ranges = <&cs42l43_pins 0 0 3>;

                pinctrl-names = "default";
                pinctrl-0 = <&pinsettings>;

                pinsettings: default-state {
                    shutter-pins {
                        groups = "gpio3";
                        function = "mic-shutter";
                    };
                };
            };

            spi {
                #address-cells = <1>;
                #size-cells = <0>;

                cs-gpios = <&cs42l43_pins 1 0>;

                sensor@0 {
                    compatible = "bosch,bme680";
                    reg = <0>;
                    spi-max-frequency = <1400000>;
                };
            };
        };
    };