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,cs35l41.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Cirrus Logic CS35L41 Speaker Amplifier
8
9maintainers:
10  - david.rhodes@cirrus.com
11
12description: |
13  CS35L41 is a boosted mono Class D amplifier with DSP
14  speaker protection and equalization
15
16properties:
17  compatible:
18    enum:
19      - cirrus,cs35l40
20      - cirrus,cs35l41
21
22  reg:
23    maxItems: 1
24
25  interrupts:
26    maxItems: 1
27
28  '#sound-dai-cells':
29    description:
30      The first cell indicating the audio interface.
31    const: 1
32
33  reset-gpios:
34    maxItems: 1
35
36  VA-supply:
37    description: voltage regulator phandle for the VA supply
38
39  VP-supply:
40    description: voltage regulator phandle for the VP supply
41
42  cirrus,boost-peak-milliamp:
43    description:
44      Boost-converter peak current limit in mA.
45      Configures the peak current by monitoring the current through the boost FET.
46      Range starts at 1600 mA and goes to a maximum of 4500 mA with increments
47      of 50 mA. See section 4.3.6 of the datasheet for details.
48    $ref: /schemas/types.yaml#/definitions/uint32
49    minimum: 1600
50    maximum: 4500
51    default: 4500
52
53  cirrus,boost-ind-nanohenry:
54    description:
55      Boost inductor value, expressed in nH. Valid
56      values include 1000, 1200, 1500 and 2200.
57    $ref: /schemas/types.yaml#/definitions/uint32
58    minimum: 1000
59    maximum: 2200
60
61  cirrus,boost-cap-microfarad:
62    description:
63      Total equivalent boost capacitance on the VBST
64      and VAMP pins, derated at 11 volts DC. The value must be rounded to the
65      nearest integer and expressed in uF.
66    $ref: /schemas/types.yaml#/definitions/uint32
67
68  cirrus,asp-sdout-hiz:
69    description:
70      Audio serial port SDOUT Hi-Z control. Sets the Hi-Z
71      configuration for SDOUT pin of amplifier.
72      0 = Logic 0 during unused slots, and while all transmit channels disabled
73      1 = Hi-Z during unused slots but logic 0 while all transmit channels disabled
74      2 = (Default) Logic 0 during unused slots, but Hi-Z while all transmit channels disabled
75      3 = Hi-Z during unused slots and while all transmit channels disabled
76    $ref: /schemas/types.yaml#/definitions/uint32
77    minimum: 0
78    maximum: 3
79    default: 2
80
81  cirrus,boost-type:
82    description:
83      Configures the type of Boost being used.
84      Internal boost requires boost-peak-milliamp, boost-ind-nanohenry and
85      boost-cap-microfarad.
86      External Boost must have GPIO1 as GPIO output. GPIO1 will be set high to
87      enable boost voltage.
88      Shared boost allows two amplifiers to share a single boost circuit by
89      communicating on the MDSYNC bus. The active amplifier controls the boost
90      circuit using combined data from both amplifiers. GPIO1 should be
91      configured for Sync when shared boost is used. Shared boost is not
92      compatible with External boost. Active amplifier requires
93      boost-peak-milliamp, boost-ind-nanohenry and boost-cap-microfarad.
94      0 = Internal Boost
95      1 = External Boost
96      2 = Shared Boost Active
97      3 = Shared Boost Passive
98    $ref: /schemas/types.yaml#/definitions/uint32
99    minimum: 0
100    maximum: 3
101
102  cirrus,gpio1-polarity-invert:
103    description:
104      Boolean which specifies whether the GPIO1
105      level is inverted. If this property is not present the level is not inverted.
106    type: boolean
107
108  cirrus,gpio1-output-enable:
109    description:
110      Boolean which specifies whether the GPIO1 pin
111      is configured as an output. If this property is not present the
112      pin will be configured as an input.
113    type: boolean
114
115  cirrus,gpio1-src-select:
116    description:
117      Configures the function of the GPIO1 pin.
118      Note that the options are different from the GPIO2 pin
119      0 = High Impedance (Default)
120      1 = GPIO
121      2 = Sync
122      3 = MCLK input
123    $ref: /schemas/types.yaml#/definitions/uint32
124    minimum: 0
125    maximum: 3
126
127  cirrus,gpio2-polarity-invert:
128    description:
129      Boolean which specifies whether the GPIO2
130      level is inverted. If this property is not present the level is not inverted.
131    type: boolean
132
133  cirrus,gpio2-output-enable:
134    description:
135      Boolean which specifies whether the GPIO2 pin
136      is configured as an output. If this property is not present the
137      pin will be configured as an input.
138    type: boolean
139
140  cirrus,gpio2-src-select:
141    description:
142      Configures the function of the GPIO2 pin.
143      Note that the options are different from the GPIO1 pin.
144      0 = High Impedance (Default)
145      1 = GPIO
146      2 = Open Drain INTB
147      3 = MCLK input
148      4 = Push-pull INTB (active low)
149      5 = Push-pull INT (active high)
150    $ref: /schemas/types.yaml#/definitions/uint32
151    minimum: 0
152    maximum: 5
153
154required:
155  - compatible
156  - reg
157  - "#sound-dai-cells"
158
159allOf:
160  - $ref: dai-common.yaml#
161  - if:
162      properties:
163        cirrus,boost-type:
164          const: 0
165    then:
166      required:
167        - cirrus,boost-peak-milliamp
168        - cirrus,boost-ind-nanohenry
169        - cirrus,boost-cap-microfarad
170    else:
171      if:
172        properties:
173          cirrus,boost-type:
174            const: 1
175      then:
176        required:
177          - cirrus,gpio1-output-enable
178          - cirrus,gpio1-src-select
179        properties:
180          cirrus,boost-peak-milliamp: false
181          cirrus,boost-ind-nanohenry: false
182          cirrus,boost-cap-microfarad: false
183          cirrus,gpio1-src-select:
184            enum: [1]
185
186unevaluatedProperties: false
187
188examples:
189  - |
190    #include <dt-bindings/gpio/gpio.h>
191
192    spi {
193        #address-cells = <1>;
194        #size-cells = <0>;
195
196        cs35l41: speaker-amp@2 {
197            #sound-dai-cells = <1>;
198            compatible = "cirrus,cs35l41";
199            reg = <2>;
200            VA-supply = <&dummy_vreg>;
201            VP-supply = <&dummy_vreg>;
202            reset-gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
203
204            cirrus,boost-type = <0>;
205            cirrus,boost-peak-milliamp = <4500>;
206            cirrus,boost-ind-nanohenry = <1000>;
207            cirrus,boost-cap-microfarad = <15>;
208        };
209    };
210