xref: /linux/Documentation/devicetree/bindings/power/supply/battery.yaml (revision 1fd1dc41724319406b0aff221a352a400b0ddfc5)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/power/supply/battery.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Battery Characteristics
8
9maintainers:
10  - Sebastian Reichel <sre@kernel.org>
11
12description: |
13  The devicetree battery node provides static battery characteristics.
14  In smart batteries, these are typically stored in non-volatile memory
15  on a fuel gauge chip. The battery node should be used where there is
16  no appropriate non-volatile memory, or it is unprogrammed/incorrect.
17
18  Upstream dts files should not include battery nodes, unless the battery
19  represented cannot easily be replaced in the system by one of a
20  different type. This prevents unpredictable, potentially harmful,
21  behavior should a replacement that changes the battery type occur
22  without a corresponding update to the dtb.
23
24  Battery properties are named, where possible, for the corresponding elements
25  in enum power_supply_property, defined in include/linux/power_supply.h
26
27  Batteries must be referenced by chargers and/or fuel-gauges using a phandle.
28  The phandle's property should be named "monitored-battery".
29
30properties:
31  compatible:
32    const: simple-battery
33
34  device-chemistry:
35    description: This describes the chemical technology of the battery.
36    oneOf:
37      - const: nickel-cadmium
38      - const: nickel-metal-hydride
39      - const: lithium-ion
40        description: This is a blanket type for all lithium-ion batteries,
41          including those below. If possible, a precise compatible string
42          from below should be used, but sometimes it is unknown which specific
43          lithium ion battery is employed and this wide compatible can be used.
44      - const: lithium-ion-polymer
45      - const: lithium-ion-iron-phosphate
46      - const: lithium-ion-manganese-oxide
47
48  over-voltage-threshold-microvolt:
49    description: battery over-voltage limit
50
51  re-charge-voltage-microvolt:
52    description: limit to automatically start charging again
53
54  voltage-min-design-microvolt:
55    description: drained battery voltage
56
57  voltage-max-design-microvolt:
58    description: fully charged battery voltage
59
60  energy-full-design-microwatt-hours:
61    description: battery design energy
62
63  charge-full-design-microamp-hours:
64    description: battery design capacity
65
66  trickle-charge-current-microamp:
67    description: current for trickle-charge phase.
68      Please note that the trickle-charging here, refers "wake-up" or
69      "pre-pre" -charging, for very empty batteries. Similar term is also
70      used for "maintenance" or "top-off" -charging of batteries (like
71      NiMh bq24400) - that is different and not controlled by this
72      property.
73
74  tricklecharge-upper-limit-microvolt:
75    description: limit when to change to precharge from trickle charge
76      Trickle-charging here refers "wake-up" or "pre-pre" -charging.
77
78  precharge-current-microamp:
79    description: current for pre-charge phase
80
81  precharge-upper-limit-microvolt:
82    description: limit when to change to constant charging
83
84  charge-term-current-microamp:
85    description: current for charge termination phase
86
87  constant-charge-current-max-microamp:
88    description: maximum constant input current
89
90  constant-charge-voltage-max-microvolt:
91    description: maximum constant input voltage
92
93  factory-internal-resistance-micro-ohms:
94    description: battery factory internal resistance
95
96  resistance-temp-table:
97    $ref: /schemas/types.yaml#/definitions/uint32-matrix
98    items:
99      items:
100        - description: the temperature in degree Celsius
101        - description: battery internal resistance percent
102    description: |
103      A table providing the temperature in degree Celsius
104      and corresponding battery internal resistance percent, which is used to
105      look up the resistance percent according to current temperature to get an
106      accurate batterty internal resistance in different temperatures.
107
108  ocv-capacity-celsius:
109    description: |
110      An array containing the temperature in degree Celsius,
111      for each of the battery capacity lookup table.
112
113  operating-range-celsius:
114    description: operating temperature range of a battery
115    items:
116      - description: minimum temperature at which battery can operate
117      - description: maximum temperature at which battery can operate
118
119  ambient-celsius:
120    description: safe range of ambient temperature
121    items:
122      - description: alert when ambient temperature is lower than this value
123      - description: alert when ambient temperature is higher than this value
124
125  alert-celsius:
126    description: safe range of battery temperature
127    items:
128      - description: alert when battery temperature is lower than this value
129      - description: alert when battery temperature is higher than this value
130
131  # The volt-drop* -properties describe voltage-drop for a battery, described
132  # as VDROP in:
133  # https://patentimages.storage.googleapis.com/6c/f5/17/c1d901c220f6a9/US20150032394A1.pdf
134  volt-drop-thresh-microvolt:
135    description: Threshold for starting the VDR correction
136    maximum: 48000000
137
138  volt-drop-soc-bp:
139    description: Table of capacity values matching the values in VDR tables.
140      The value should be given as basis points, 1/100 of a percent.
141
142  volt-drop-temperatures-millicelsius:
143    description: An array containing the temperature in milli celsius, for each
144      of the VDR lookup table.
145
146required:
147  - compatible
148
149patternProperties:
150  '^ocv-capacity-table-[0-9]+$':
151    $ref: /schemas/types.yaml#/definitions/uint32-matrix
152    description: |
153      An array providing the open circuit voltage (OCV)
154      of the battery and corresponding battery capacity percent, which is used
155      to look up battery capacity according to current OCV value. And the open
156      circuit voltage unit is microvolt.
157    maxItems: 100
158    items:
159      items:
160        - description: open circuit voltage (OCV) in microvolts
161        - description: battery capacity percent
162          maximum: 100
163
164  '^volt-drop-[0-9]-microvolt':
165    description: Table of the voltage drop rate (VDR) values. Each entry in the
166      table should match a capacity value in the volt-drop-soc table.
167      Furthermore, the values should be obtained for the temperature given in
168      volt-drop-temperatures-millicelsius table at index matching the
169      number in this table's name.
170
171additionalProperties: false
172
173examples:
174  - |
175    power {
176      #address-cells = <1>;
177      #size-cells = <0>;
178
179      battery: battery {
180        compatible = "simple-battery";
181        over-voltage-threshold-microvolt = <4500000>;
182        re-charge-voltage-microvolt = <250000>;
183        voltage-min-design-microvolt = <3200000>;
184        voltage-max-design-microvolt = <4200000>;
185        energy-full-design-microwatt-hours = <5290000>;
186        charge-full-design-microamp-hours = <1430000>;
187        precharge-current-microamp = <256000>;
188        precharge-upper-limit-microvolt = <2500000>;
189        charge-term-current-microamp = <128000>;
190        constant-charge-current-max-microamp = <900000>;
191        constant-charge-voltage-max-microvolt = <4200000>;
192        factory-internal-resistance-micro-ohms = <250000>;
193        ocv-capacity-celsius = <(-10) 0 10>;
194        /* table for -10 degree Celsius */
195        ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>;
196        /* table for 0 degree Celsius */
197        ocv-capacity-table-1 = <4200000 100>, <4185000 95>, <4113000 90>;
198        /* table for 10 degree Celsius */
199        ocv-capacity-table-2 = <4250000 100>, <4200000 95>, <4185000 90>;
200        resistance-temp-table = <20 100>, <10 90>, <0 80>, <(-10) 60>;
201        operating-range-celsius = <(-30) 50>;
202        ambient-celsius = <(-5) 50>;
203        alert-celsius = <0 40>;
204      };
205
206      charger@11 {
207        reg = <0x11>;
208        monitored-battery = <&battery>;
209      };
210
211      fuel-gauge@22 {
212        reg = <0x22>;
213        monitored-battery = <&battery>;
214      };
215    };
216