xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/power/supply/battery.yaml (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*4882a593Smuzhiyun%YAML 1.2
3*4882a593Smuzhiyun---
4*4882a593Smuzhiyun$id: http://devicetree.org/schemas/power/supply/battery.yaml#
5*4882a593Smuzhiyun$schema: http://devicetree.org/meta-schemas/core.yaml#
6*4882a593Smuzhiyun
7*4882a593Smuzhiyuntitle: Battery Characteristics
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunmaintainers:
10*4882a593Smuzhiyun  - Sebastian Reichel <sre@kernel.org>
11*4882a593Smuzhiyun
12*4882a593Smuzhiyundescription: |
13*4882a593Smuzhiyun  The devicetree battery node provides static battery characteristics.
14*4882a593Smuzhiyun  In smart batteries, these are typically stored in non-volatile memory
15*4882a593Smuzhiyun  on a fuel gauge chip. The battery node should be used where there is
16*4882a593Smuzhiyun  no appropriate non-volatile memory, or it is unprogrammed/incorrect.
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun  Upstream dts files should not include battery nodes, unless the battery
19*4882a593Smuzhiyun  represented cannot easily be replaced in the system by one of a
20*4882a593Smuzhiyun  different type. This prevents unpredictable, potentially harmful,
21*4882a593Smuzhiyun  behavior should a replacement that changes the battery type occur
22*4882a593Smuzhiyun  without a corresponding update to the dtb.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun  Battery properties are named, where possible, for the corresponding elements
25*4882a593Smuzhiyun  in enum power_supply_property, defined in include/linux/power_supply.h
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun  Batteries must be referenced by chargers and/or fuel-gauges using a phandle.
28*4882a593Smuzhiyun  The phandle's property should be named "monitored-battery".
29*4882a593Smuzhiyun
30*4882a593Smuzhiyunproperties:
31*4882a593Smuzhiyun  compatible:
32*4882a593Smuzhiyun    const: simple-battery
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun  over-voltage-threshold-microvolt:
35*4882a593Smuzhiyun    description: battery over-voltage limit
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun  re-charge-voltage-microvolt:
38*4882a593Smuzhiyun    description: limit to automatically start charging again
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun  voltage-min-design-microvolt:
41*4882a593Smuzhiyun    description: drained battery voltage
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun  voltage-max-design-microvolt:
44*4882a593Smuzhiyun    description: fully charged battery voltage
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun  energy-full-design-microwatt-hours:
47*4882a593Smuzhiyun    description: battery design energy
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun  charge-full-design-microamp-hours:
50*4882a593Smuzhiyun    description: battery design capacity
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun  trickle-charge-current-microamp:
53*4882a593Smuzhiyun    description: current for trickle-charge phase
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun  precharge-current-microamp:
56*4882a593Smuzhiyun    description: current for pre-charge phase
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun  precharge-upper-limit-microvolt:
59*4882a593Smuzhiyun    description: limit when to change to constant charging
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun  charge-term-current-microamp:
62*4882a593Smuzhiyun    description: current for charge termination phase
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun  constant-charge-current-max-microamp:
65*4882a593Smuzhiyun    description: maximum constant input current
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun  constant-charge-voltage-max-microvolt:
68*4882a593Smuzhiyun    description: maximum constant input voltage
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun  factory-internal-resistance-micro-ohms:
71*4882a593Smuzhiyun    description: battery factory internal resistance
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun  resistance-temp-table:
74*4882a593Smuzhiyun    description: |
75*4882a593Smuzhiyun      An array providing the temperature in degree Celsius
76*4882a593Smuzhiyun      and corresponding battery internal resistance percent, which is used to
77*4882a593Smuzhiyun      look up the resistance percent according to current temperature to get an
78*4882a593Smuzhiyun      accurate batterty internal resistance in different temperatures.
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun  ocv-capacity-celsius:
81*4882a593Smuzhiyun    description: |
82*4882a593Smuzhiyun      An array containing the temperature in degree Celsius,
83*4882a593Smuzhiyun      for each of the battery capacity lookup table.
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun  operating-range-celsius:
86*4882a593Smuzhiyun    $ref: /schemas/types.yaml#/definitions/uint32-array
87*4882a593Smuzhiyun    description: operating temperature range of a battery
88*4882a593Smuzhiyun    items:
89*4882a593Smuzhiyun      - description: minimum temperature at which battery can operate
90*4882a593Smuzhiyun      - description: maximum temperature at which battery can operate
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun  ambient-celsius:
93*4882a593Smuzhiyun    $ref: /schemas/types.yaml#/definitions/uint32-array
94*4882a593Smuzhiyun    description: safe range of ambient temperature
95*4882a593Smuzhiyun    items:
96*4882a593Smuzhiyun      - description: alert when ambient temperature is lower than this value
97*4882a593Smuzhiyun      - description: alert when ambient temperature is higher than this value
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun  alert-celsius:
100*4882a593Smuzhiyun    $ref: /schemas/types.yaml#/definitions/uint32-array
101*4882a593Smuzhiyun    description: safe range of battery temperature
102*4882a593Smuzhiyun    items:
103*4882a593Smuzhiyun      - description: alert when battery temperature is lower than this value
104*4882a593Smuzhiyun      - description: alert when battery temperature is higher than this value
105*4882a593Smuzhiyun
106*4882a593Smuzhiyunrequired:
107*4882a593Smuzhiyun  - compatible
108*4882a593Smuzhiyun
109*4882a593SmuzhiyunpatternProperties:
110*4882a593Smuzhiyun  '^ocv-capacity-table-[0-9]+$':
111*4882a593Smuzhiyun    $ref: /schemas/types.yaml#/definitions/uint32-matrix
112*4882a593Smuzhiyun    description: |
113*4882a593Smuzhiyun      An array providing the open circuit voltage (OCV)
114*4882a593Smuzhiyun      of the battery and corresponding battery capacity percent, which is used
115*4882a593Smuzhiyun      to look up battery capacity according to current OCV value. And the open
116*4882a593Smuzhiyun      circuit voltage unit is microvolt.
117*4882a593Smuzhiyun    maxItems: 100
118*4882a593Smuzhiyun    items:
119*4882a593Smuzhiyun      items:
120*4882a593Smuzhiyun        - description: open circuit voltage (OCV) in microvolts
121*4882a593Smuzhiyun        - description: battery capacity percent
122*4882a593Smuzhiyun          maximum: 100
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunadditionalProperties: false
125*4882a593Smuzhiyun
126*4882a593Smuzhiyunexamples:
127*4882a593Smuzhiyun  - |
128*4882a593Smuzhiyun    power {
129*4882a593Smuzhiyun      #address-cells = <1>;
130*4882a593Smuzhiyun      #size-cells = <0>;
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun      battery: battery {
133*4882a593Smuzhiyun        compatible = "simple-battery";
134*4882a593Smuzhiyun        over-voltage-threshold-microvolt = <4500000>;
135*4882a593Smuzhiyun        re-charge-voltage-microvolt = <250000>;
136*4882a593Smuzhiyun        voltage-min-design-microvolt = <3200000>;
137*4882a593Smuzhiyun        voltage-max-design-microvolt = <4200000>;
138*4882a593Smuzhiyun        energy-full-design-microwatt-hours = <5290000>;
139*4882a593Smuzhiyun        charge-full-design-microamp-hours = <1430000>;
140*4882a593Smuzhiyun        precharge-current-microamp = <256000>;
141*4882a593Smuzhiyun        precharge-upper-limit-microvolt = <2500000>;
142*4882a593Smuzhiyun        charge-term-current-microamp = <128000>;
143*4882a593Smuzhiyun        constant-charge-current-max-microamp = <900000>;
144*4882a593Smuzhiyun        constant-charge-voltage-max-microvolt = <4200000>;
145*4882a593Smuzhiyun        factory-internal-resistance-micro-ohms = <250000>;
146*4882a593Smuzhiyun        ocv-capacity-celsius = <(-10) 0 10>;
147*4882a593Smuzhiyun        /* table for -10 degree Celsius */
148*4882a593Smuzhiyun        ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>;
149*4882a593Smuzhiyun        /* table for 0 degree Celsius */
150*4882a593Smuzhiyun        ocv-capacity-table-1 = <4200000 100>, <4185000 95>, <4113000 90>;
151*4882a593Smuzhiyun        /* table for 10 degree Celsius */
152*4882a593Smuzhiyun        ocv-capacity-table-2 = <4250000 100>, <4200000 95>, <4185000 90>;
153*4882a593Smuzhiyun        resistance-temp-table = <20 100>, <10 90>, <0 80>, <(-10) 60>;
154*4882a593Smuzhiyun        operating-range-celsius = <(-30) 50>;
155*4882a593Smuzhiyun        ambient-celsius = <(-5) 50>;
156*4882a593Smuzhiyun        alert-celsius = <0 40>;
157*4882a593Smuzhiyun      };
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun      charger@11 {
160*4882a593Smuzhiyun        reg = <0x11>;
161*4882a593Smuzhiyun        monitored-battery = <&battery>;
162*4882a593Smuzhiyun      };
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun      fuel-gauge@22 {
165*4882a593Smuzhiyun        reg = <0x22>;
166*4882a593Smuzhiyun        monitored-battery = <&battery>;
167*4882a593Smuzhiyun      };
168*4882a593Smuzhiyun    };
169