|
| 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 | + |
| 7 | +title: Battery Characteristics |
| 8 | + |
| 9 | +maintainers: |
| 10 | + - Sebastian Reichel <[email protected]> |
| 11 | + |
| 12 | +description: | |
| 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 | +
|
| 30 | +properties: |
| 31 | + compatible: |
| 32 | + const: simple-battery |
| 33 | + |
| 34 | + over-voltage-threshold-microvolt: |
| 35 | + description: battery over-voltage limit |
| 36 | + |
| 37 | + re-charge-voltage-microvolt: |
| 38 | + description: limit to automatically start charging again |
| 39 | + |
| 40 | + voltage-min-design-microvolt: |
| 41 | + description: drained battery voltage |
| 42 | + |
| 43 | + voltage-max-design-microvolt: |
| 44 | + description: fully charged battery voltage |
| 45 | + |
| 46 | + energy-full-design-microwatt-hours: |
| 47 | + description: battery design energy |
| 48 | + |
| 49 | + charge-full-design-microamp-hours: |
| 50 | + description: battery design capacity |
| 51 | + |
| 52 | + trickle-charge-current-microamp: |
| 53 | + description: current for trickle-charge phase |
| 54 | + |
| 55 | + precharge-current-microamp: |
| 56 | + description: current for pre-charge phase |
| 57 | + |
| 58 | + precharge-upper-limit-microvolt: |
| 59 | + description: limit when to change to constant charging |
| 60 | + |
| 61 | + charge-term-current-microamp: |
| 62 | + description: current for charge termination phase |
| 63 | + |
| 64 | + constant-charge-current-max-microamp: |
| 65 | + description: maximum constant input current |
| 66 | + |
| 67 | + constant-charge-voltage-max-microvolt: |
| 68 | + description: maximum constant input voltage |
| 69 | + |
| 70 | + factory-internal-resistance-micro-ohms: |
| 71 | + description: battery factory internal resistance |
| 72 | + |
| 73 | + resistance-temp-table: |
| 74 | + description: | |
| 75 | + An array providing the temperature in degree Celsius |
| 76 | + and corresponding battery internal resistance percent, which is used to |
| 77 | + look up the resistance percent according to current temperature to get an |
| 78 | + accurate batterty internal resistance in different temperatures. |
| 79 | +
|
| 80 | + ocv-capacity-celsius: |
| 81 | + description: | |
| 82 | + An array containing the temperature in degree Celsius, |
| 83 | + for each of the battery capacity lookup table. |
| 84 | +
|
| 85 | +required: |
| 86 | + - compatible |
| 87 | + |
| 88 | +patternProperties: |
| 89 | + '^ocv-capacity-table-[0-9]+$': |
| 90 | + $ref: /schemas/types.yaml#/definitions/uint32-matrix |
| 91 | + description: | |
| 92 | + An array providing the open circuit voltage (OCV) |
| 93 | + of the battery and corresponding battery capacity percent, which is used |
| 94 | + to look up battery capacity according to current OCV value. And the open |
| 95 | + circuit voltage unit is microvolt. |
| 96 | + maxItems: 100 |
| 97 | + items: |
| 98 | + items: |
| 99 | + - description: open circuit voltage (OCV) in microvolts |
| 100 | + - description: battery capacity percent |
| 101 | + maximum: 100 |
| 102 | + |
| 103 | +additionalProperties: false |
| 104 | + |
| 105 | +examples: |
| 106 | + - | |
| 107 | + power { |
| 108 | + #address-cells = <1>; |
| 109 | + #size-cells = <0>; |
| 110 | +
|
| 111 | + battery: battery { |
| 112 | + compatible = "simple-battery"; |
| 113 | + over-voltage-threshold-microvolt = <4500000>; |
| 114 | + re-charge-voltage-microvolt = <250000>; |
| 115 | + voltage-min-design-microvolt = <3200000>; |
| 116 | + voltage-max-design-microvolt = <4200000>; |
| 117 | + energy-full-design-microwatt-hours = <5290000>; |
| 118 | + charge-full-design-microamp-hours = <1430000>; |
| 119 | + precharge-current-microamp = <256000>; |
| 120 | + precharge-upper-limit-microvolt = <2500000>; |
| 121 | + charge-term-current-microamp = <128000>; |
| 122 | + constant-charge-current-max-microamp = <900000>; |
| 123 | + constant-charge-voltage-max-microvolt = <4200000>; |
| 124 | + factory-internal-resistance-micro-ohms = <250000>; |
| 125 | + ocv-capacity-celsius = <(-10) 0 10>; |
| 126 | + /* table for -10 degree Celsius */ |
| 127 | + ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>; |
| 128 | + /* table for 0 degree Celsius */ |
| 129 | + ocv-capacity-table-1 = <4200000 100>, <4185000 95>, <4113000 90>; |
| 130 | + /* table for 10 degree Celsius */ |
| 131 | + ocv-capacity-table-2 = <4250000 100>, <4200000 95>, <4185000 90>; |
| 132 | + resistance-temp-table = <20 100>, <10 90>, <0 80>, <(-10) 60>; |
| 133 | + }; |
| 134 | +
|
| 135 | + charger@11 { |
| 136 | + reg = <0x11>; |
| 137 | + monitored-battery = <&battery>; |
| 138 | + }; |
| 139 | +
|
| 140 | + fuel-gauge@22 { |
| 141 | + reg = <0x22>; |
| 142 | + monitored-battery = <&battery>; |
| 143 | + }; |
| 144 | + }; |
0 commit comments