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,cs35l45.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Cirrus Logic CS35L45 Speaker Amplifier
8
9maintainers:
10  - Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
11  - Richard Fitzgerald <rf@opensource.cirrus.com>
12
13description: |
14  CS35L45 is a Boosted Mono Class D Amplifier with DSP
15  Speaker Protection and Adaptive Battery Management.
16
17allOf:
18  - $ref: dai-common.yaml#
19
20properties:
21  compatible:
22    enum:
23      - cirrus,cs35l45
24
25  reg:
26    maxItems: 1
27
28  '#sound-dai-cells':
29    const: 1
30
31  reset-gpios:
32    maxItems: 1
33
34  vdd-a-supply:
35    description: voltage regulator phandle for the VDD_A supply
36
37  vdd-batt-supply:
38    description: voltage regulator phandle for the VDD_BATT supply
39
40  spi-max-frequency:
41    maximum: 5000000
42
43  cirrus,asp-sdout-hiz-ctrl:
44    description:
45      Audio serial port SDOUT Hi-Z control. Sets the Hi-Z
46      configuration for SDOUT pin of amplifier. Logical OR of
47      CS35L45_ASP_TX_HIZ_xxx values.
48    $ref: /schemas/types.yaml#/definitions/uint32
49    minimum: 0
50    maximum: 3
51    default: 2
52
53patternProperties:
54  "^cirrus,gpio-ctrl[1-3]$":
55    description:
56      GPIO pins configuration.
57    type: object
58    additionalProperties: false
59    properties:
60      gpio-dir:
61        description:
62          GPIO pin direction. Valid only when 'gpio-ctrl' is 1
63            0 = Output
64            1 = Input
65        $ref: "/schemas/types.yaml#/definitions/uint32"
66        minimum: 0
67        maximum: 1
68        default: 1
69      gpio-lvl:
70        description:
71          GPIO level. Valid only when 'gpio-ctrl' is 1 and 'gpio-dir' is 0
72            0 = Low
73            1 = High
74        $ref: "/schemas/types.yaml#/definitions/uint32"
75        minimum: 0
76        maximum: 1
77        default: 0
78      gpio-op-cfg:
79        description:
80          GPIO level. Valid only when 'gpio-ctrl' is 1 and 'gpio-dir' is 0
81            0 = CMOS
82            1 = Open Drain
83        $ref: "/schemas/types.yaml#/definitions/uint32"
84        minimum: 0
85        maximum: 1
86        default: 0
87      gpio-pol:
88        description:
89          GPIO output polarity select. Valid only when 'gpio-ctrl' is 1
90          and 'gpio-dir' is 0
91            0 = Non-inverted, Active High
92            1 = Inverted, Active Low
93        $ref: "/schemas/types.yaml#/definitions/uint32"
94        minimum: 0
95        maximum: 1
96        default: 0
97      gpio-ctrl:
98        description:
99          Defines the function of the GPIO pin.
100          GPIO1
101            0 = High impedance input
102            1 = Pin acts as a GPIO, direction controlled by 'gpio-dir'
103            2 = Pin acts as MDSYNC, direction controlled by MDSYNC
104            3-7 = Reserved
105          GPIO2
106            0 = High impedance input
107            1 = Pin acts as a GPIO, direction controlled by 'gpio-dir'
108            2 = Pin acts as open drain INT
109            3 = Reserved
110            4 = Pin acts as push-pull output INT. Active low.
111            5 = Pin acts as push-pull output INT. Active high.
112            6,7 = Reserved
113          GPIO3
114            0 = High impedance input
115            1 = Pin acts as a GPIO, direction controlled by 'gpio-dir'
116            2-7 = Reserved
117        $ref: "/schemas/types.yaml#/definitions/uint32"
118        minimum: 0
119        maximum: 7
120        default: 0
121required:
122  - compatible
123  - reg
124  - "#sound-dai-cells"
125
126unevaluatedProperties: false
127
128examples:
129  - |
130    #include <dt-bindings/sound/cs35l45.h>
131    spi {
132        #address-cells = <1>;
133        #size-cells = <0>;
134
135        cs35l45: cs35l45@2 {
136          #sound-dai-cells = <1>;
137          compatible = "cirrus,cs35l45";
138          reg = <2>;
139          spi-max-frequency = <5000000>;
140          vdd-a-supply = <&dummy_vreg>;
141          vdd-batt-supply = <&dummy_vreg>;
142          reset-gpios = <&gpio 110 0>;
143          cirrus,asp-sdout-hiz-ctrl = <(CS35L45_ASP_TX_HIZ_UNUSED |
144                                        CS35L45_ASP_TX_HIZ_DISABLED)>;
145          cirrus,gpio-ctrl1 {
146             gpio-ctrl = <0x2>;
147          };
148          cirrus,gpio-ctrl2 {
149             gpio-ctrl = <0x2>;
150          };
151          cirrus,gpio-ctrl3 {
152             gpio-ctrl = <0x1>;
153             gpio-dir = <0x1>;
154          };
155        };
156    };
157