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