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