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      0 = Internal Boost
89      1 = External Boost
90    $ref: /schemas/types.yaml#/definitions/uint32
91    minimum: 0
92    maximum: 1
93
94  cirrus,gpio1-polarity-invert:
95    description:
96      Boolean which specifies whether the GPIO1
97      level is inverted. If this property is not present the level is not inverted.
98    type: boolean
99
100  cirrus,gpio1-output-enable:
101    description:
102      Boolean which specifies whether the GPIO1 pin
103      is configured as an output. If this property is not present the
104      pin will be configured as an input.
105    type: boolean
106
107  cirrus,gpio1-src-select:
108    description:
109      Configures the function of the GPIO1 pin.
110      Note that the options are different from the GPIO2 pin
111      0 = High Impedance (Default)
112      1 = GPIO
113      2 = Sync
114      3 = MCLK input
115    $ref: /schemas/types.yaml#/definitions/uint32
116    minimum: 0
117    maximum: 3
118
119  cirrus,gpio2-polarity-invert:
120    description:
121      Boolean which specifies whether the GPIO2
122      level is inverted. If this property is not present the level is not inverted.
123    type: boolean
124
125  cirrus,gpio2-output-enable:
126    description:
127      Boolean which specifies whether the GPIO2 pin
128      is configured as an output. If this property is not present the
129      pin will be configured as an input.
130    type: boolean
131
132  cirrus,gpio2-src-select:
133    description:
134      Configures the function of the GPIO2 pin.
135      Note that the options are different from the GPIO1 pin.
136      0 = High Impedance (Default)
137      1 = GPIO
138      2 = Open Drain INTB
139      3 = MCLK input
140      4 = Push-pull INTB (active low)
141      5 = Push-pull INT (active high)
142    $ref: /schemas/types.yaml#/definitions/uint32
143    minimum: 0
144    maximum: 5
145
146required:
147  - compatible
148  - reg
149  - "#sound-dai-cells"
150
151allOf:
152  - $ref: dai-common.yaml#
153  - if:
154      properties:
155        cirrus,boost-type:
156          const: 0
157    then:
158      required:
159        - cirrus,boost-peak-milliamp
160        - cirrus,boost-ind-nanohenry
161        - cirrus,boost-cap-microfarad
162    else:
163      if:
164        properties:
165          cirrus,boost-type:
166            const: 1
167      then:
168        required:
169          - cirrus,gpio1-output-enable
170          - cirrus,gpio1-src-select
171        properties:
172          cirrus,boost-peak-milliamp: false
173          cirrus,boost-ind-nanohenry: false
174          cirrus,boost-cap-microfarad: false
175          cirrus,gpio1-src-select:
176            enum: [1]
177
178unevaluatedProperties: false
179
180examples:
181  - |
182    #include <dt-bindings/gpio/gpio.h>
183
184    spi {
185        #address-cells = <1>;
186        #size-cells = <0>;
187
188        cs35l41: speaker-amp@2 {
189            #sound-dai-cells = <1>;
190            compatible = "cirrus,cs35l41";
191            reg = <2>;
192            VA-supply = <&dummy_vreg>;
193            VP-supply = <&dummy_vreg>;
194            reset-gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
195
196            cirrus,boost-type = <0>;
197            cirrus,boost-peak-milliamp = <4500>;
198            cirrus,boost-ind-nanohenry = <1000>;
199            cirrus,boost-cap-microfarad = <15>;
200        };
201    };
202