1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/power/supply/charger-manager.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Charger Manager
8
9maintainers:
10  - Sebastian Reichel <sre@kernel.org>
11
12description: |
13  Binding for the legacy charger manager driver.
14  Please do not use for new products.
15
16properties:
17  compatible:
18    const: charger-manager
19
20  cm-chargers:
21    description: name of chargers
22    $ref: /schemas/types.yaml#/definitions/string-array
23
24  cm-num-chargers:
25    $ref: /schemas/types.yaml#/definitions/uint32
26    deprecated: true
27
28  cm-fuel-gauge:
29    description: name of battery fuel gauge
30    $ref: /schemas/types.yaml#/definitions/string
31
32  cm-name:
33    description: name of the charger manager
34    default: battery
35    $ref: /schemas/types.yaml#/definitions/string
36
37  cm-poll-mode:
38    description: polling mode
39    $ref: /schemas/types.yaml#/definitions/uint32
40    default: 0
41    enum:
42      - 0 # disabled
43      - 1 # always
44      - 2 # when external power is connected
45      - 3 # when charging
46
47  cm-poll-interval:
48    description: polling interval (in ms)
49    $ref: /schemas/types.yaml#/definitions/uint32
50
51  cm-battery-stat:
52    description: battery status
53    enum:
54      - 0 # battery always present
55      - 1 # no battery
56      - 2 # check presence via fuel gauge
57      - 3 # check presence via charger
58
59  cm-fullbatt-vchkdrop-volt:
60    description: voltage drop before restarting charging in uV
61    $ref: /schemas/types.yaml#/definitions/uint32
62
63  cm-fullbatt-vchkdrop-ms:
64    deprecated: true
65
66  cm-fullbatt-voltage:
67    description: voltage of full battery in uV
68    $ref: /schemas/types.yaml#/definitions/uint32
69
70  cm-fullbatt-soc:
71    description: state of charge to consider as full battery in %
72    $ref: /schemas/types.yaml#/definitions/uint32
73
74  cm-fullbatt-capacity:
75    description: capcity to consider as full battery in uAh
76    $ref: /schemas/types.yaml#/definitions/uint32
77
78  cm-thermal-zone:
79    description: name of external thermometer's thermal zone
80    $ref: /schemas/types.yaml#/definitions/string
81
82  cm-discharging-max:
83    description: limits of discharging duration in ms
84    $ref: /schemas/types.yaml#/definitions/uint32
85
86  cm-charging-max:
87    description: limits of charging duration in ms
88    $ref: /schemas/types.yaml#/definitions/uint32
89
90  cm-battery-cold:
91    description: critical cold temperature of battery for charging in deci-degree celsius
92    $ref: /schemas/types.yaml#/definitions/uint32
93
94  cm-battery-cold-in-minus:
95    description: if set cm-battery-cold temperature is in minus degrees
96    type: boolean
97
98  cm-battery-hot:
99    description: critical hot temperature of battery for charging in deci-degree celsius
100    $ref: /schemas/types.yaml#/definitions/uint32
101
102  cm-battery-temp-diff:
103    description: temperature difference to allow recharging in deci-degree celsius
104    $ref: /schemas/types.yaml#/definitions/uint32
105
106patternProperties:
107  "-supply$":
108    description: regulator consumer, named according to cm-regulator-name
109    $ref: /schemas/types.yaml#/definitions/phandle
110
111  "^regulator[@-][0-9]$":
112    type: object
113    properties:
114      cm-regulator-name:
115        description: name of charger regulator
116        $ref: /schemas/types.yaml#/definitions/string
117
118    required:
119      - cm-regulator-name
120
121    additionalProperties: false
122
123    patternProperties:
124      "^cable[@-][0-9]$":
125        type: object
126        properties:
127          cm-cable-name:
128            description: name of charger cable
129            enum:
130              - USB
131              - USB-HOST
132              - SDP
133              - DCP
134              - CDP
135              - ACA
136              - FAST-CHARGER
137              - SLOW-CHARGER
138              - WPT
139              - PD
140              - DOCK
141              - JIG
142              - MECHANICAL
143
144          cm-cable-extcon:
145            description: name of extcon dev
146            $ref: /schemas/types.yaml#/definitions/string
147
148          cm-cable-min:
149            description: minimum current of cable in uA
150            $ref: /schemas/types.yaml#/definitions/uint32
151
152          cm-cable-max:
153            description: maximum current of cable in uA
154            $ref: /schemas/types.yaml#/definitions/uint32
155
156        required:
157          - cm-cable-name
158          - cm-cable-extcon
159
160        additionalProperties: false
161
162required:
163  - compatible
164  - cm-chargers
165  - cm-fuel-gauge
166
167additionalProperties: false
168
169examples:
170  - |
171    charger-manager {
172        compatible = "charger-manager";
173        chg-reg-supply = <&charger_regulator>;
174
175        cm-name = "battery";
176        /* Always polling ON : 30s */
177        cm-poll-mode = <1>;
178        cm-poll-interval = <30000>;
179
180        cm-fullbatt-vchkdrop-volt = <150000>;
181        cm-fullbatt-soc = <100>;
182
183        cm-battery-stat = <3>;
184
185        cm-chargers = "charger0", "charger1", "charger2";
186
187        cm-fuel-gauge = "fuelgauge0";
188
189        cm-thermal-zone = "thermal_zone.1";
190        /* in deci centigrade */
191        cm-battery-cold = <50>;
192        cm-battery-cold-in-minus;
193        cm-battery-hot = <800>;
194        cm-battery-temp-diff = <100>;
195
196        /* Allow charging for 5hr */
197        cm-charging-max = <18000000>;
198        /* Allow discharging for 2hr */
199        cm-discharging-max = <7200000>;
200
201        regulator-0 {
202            cm-regulator-name = "chg-reg";
203            cable-0 {
204                cm-cable-name = "USB";
205                cm-cable-extcon = "extcon-dev.0";
206                cm-cable-min = <475000>;
207                cm-cable-max = <500000>;
208            };
209            cable-1 {
210                cm-cable-name = "SDP";
211                cm-cable-extcon = "extcon-dev.0";
212                cm-cable-min = <650000>;
213                cm-cable-max = <675000>;
214            };
215        };
216    };
217