selftests/bpf: Make test_varlen work with 32-bit user-space arch
[platform/kernel/linux-starfive.git] / Documentation / devicetree / bindings / power / supply / battery.txt
1 Battery Characteristics
2
3 The devicetree battery node provides static battery characteristics.
4 In smart batteries, these are typically stored in non-volatile memory
5 on a fuel gauge chip. The battery node should be used where there is
6 no appropriate non-volatile memory, or it is unprogrammed/incorrect.
7
8 Upstream dts files should not include battery nodes, unless the battery
9 represented cannot easily be replaced in the system by one of a
10 different type. This prevents unpredictable, potentially harmful,
11 behavior should a replacement that changes the battery type occur
12 without a corresponding update to the dtb.
13
14 Please note that not all charger drivers respect all of the properties.
15
16 Required Properties:
17  - compatible: Must be "simple-battery"
18
19 Optional Properties:
20  - over-voltage-threshold-microvolt: battery over-voltage limit
21  - re-charge-voltage-microvolt: limit to automatically start charging again
22  - voltage-min-design-microvolt: drained battery voltage
23  - voltage-max-design-microvolt: fully charged battery voltage
24  - energy-full-design-microwatt-hours: battery design energy
25  - charge-full-design-microamp-hours: battery design capacity
26  - trickle-charge-current-microamp: current for trickle-charge phase
27  - precharge-current-microamp: current for pre-charge phase
28  - precharge-upper-limit-microvolt: limit when to change to constant charging
29  - charge-term-current-microamp: current for charge termination phase
30  - constant-charge-current-max-microamp: maximum constant input current
31  - constant-charge-voltage-max-microvolt: maximum constant input voltage
32  - factory-internal-resistance-micro-ohms: battery factory internal resistance
33  - ocv-capacity-table-0: An array providing the open circuit voltage (OCV)
34    of the battery and corresponding battery capacity percent, which is used
35    to look up battery capacity according to current OCV value. And the open
36    circuit voltage unit is microvolt.
37  - ocv-capacity-table-1: Same as ocv-capacity-table-0
38  ......
39  - ocv-capacity-table-n: Same as ocv-capacity-table-0
40  - ocv-capacity-celsius: An array containing the temperature in degree Celsius,
41    for each of the battery capacity lookup table. The first temperature value
42    specifies the OCV table 0, and the second temperature value specifies the
43    OCV table 1, and so on.
44  - resistance-temp-table: An array providing the temperature in degree Celsius
45    and corresponding battery internal resistance percent, which is used to look
46    up the resistance percent according to current temperature to get a accurate
47    batterty internal resistance in different temperatures.
48
49 Battery properties are named, where possible, for the corresponding
50 elements in enum power_supply_property, defined in
51 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/power_supply.h
52
53 Batteries must be referenced by chargers and/or fuel-gauges
54 using a phandle. The phandle's property should be named
55 "monitored-battery".
56
57 Example:
58
59         bat: battery {
60                 compatible = "simple-battery";
61                 voltage-min-design-microvolt = <3200000>;
62                 voltage-max-design-microvolt = <4200000>;
63                 energy-full-design-microwatt-hours = <5290000>;
64                 charge-full-design-microamp-hours = <1430000>;
65                 precharge-current-microamp = <256000>;
66                 charge-term-current-microamp = <128000>;
67                 constant-charge-current-max-microamp = <900000>;
68                 constant-charge-voltage-max-microvolt = <4200000>;
69                 factory-internal-resistance-micro-ohms = <250000>;
70                 ocv-capacity-celsius = <(-10) 0 10>;
71                 ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>, ...;
72                 ocv-capacity-table-1 = <4200000 100>, <4185000 95>, <4113000 90>, ...;
73                 ocv-capacity-table-2 = <4250000 100>, <4200000 95>, <4185000 90>, ...;
74                 resistance-temp-table = <20 100>, <10 90>, <0 80>, <(-10) 60>;
75         };
76
77         charger: charger@11 {
78                 ....
79                 monitored-battery = <&bat>;
80                 ...
81         };
82
83         fuel_gauge: fuel-gauge@22 {
84                 ....
85                 monitored-battery = <&bat>;
86                 ...
87         };