Documentation / devicetree / bindings / power / supply / charger-manager.yaml


Based on kernel version 6.8. Page generated on 2024-03-11 21:26 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/charger-manager.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Charger Manager

maintainers:
  - Sebastian Reichel <sre@kernel.org>

description: |
  Binding for the legacy charger manager driver.
  Please do not use for new products.

properties:
  compatible:
    const: charger-manager

  cm-chargers:
    description: name of chargers
    $ref: /schemas/types.yaml#/definitions/string-array

  cm-num-chargers:
    $ref: /schemas/types.yaml#/definitions/uint32
    deprecated: true

  cm-fuel-gauge:
    description: name of battery fuel gauge
    $ref: /schemas/types.yaml#/definitions/string

  cm-name:
    description: name of the charger manager
    default: battery
    $ref: /schemas/types.yaml#/definitions/string

  cm-poll-mode:
    description: polling mode
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 0
    enum:
      - 0 # disabled
      - 1 # always
      - 2 # when external power is connected
      - 3 # when charging

  cm-poll-interval:
    description: polling interval (in ms)
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-battery-stat:
    description: battery status
    $ref: /schemas/types.yaml#/definitions/uint32
    enum:
      - 0 # battery always present
      - 1 # no battery
      - 2 # check presence via fuel gauge
      - 3 # check presence via charger

  cm-fullbatt-vchkdrop-volt:
    description: voltage drop before restarting charging in uV
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-fullbatt-vchkdrop-ms:
    deprecated: true

  cm-fullbatt-voltage:
    description: voltage of full battery in uV
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-fullbatt-soc:
    description: state of charge to consider as full battery in %
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-fullbatt-capacity:
    description: capcity to consider as full battery in uAh
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-thermal-zone:
    description: name of external thermometer's thermal zone
    $ref: /schemas/types.yaml#/definitions/string

  cm-discharging-max:
    description: limits of discharging duration in ms
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-charging-max:
    description: limits of charging duration in ms
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-battery-cold:
    description: critical cold temperature of battery for charging in deci-degree celsius
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-battery-cold-in-minus:
    description: if set cm-battery-cold temperature is in minus degrees
    type: boolean

  cm-battery-hot:
    description: critical hot temperature of battery for charging in deci-degree celsius
    $ref: /schemas/types.yaml#/definitions/uint32

  cm-battery-temp-diff:
    description: temperature difference to allow recharging in deci-degree celsius
    $ref: /schemas/types.yaml#/definitions/uint32

patternProperties:
  "-supply$":
    description: regulator consumer, named according to cm-regulator-name
    $ref: /schemas/types.yaml#/definitions/phandle
 
  "^regulator[@-][0-9]$":
    type: object
    properties:
      cm-regulator-name:
        description: name of charger regulator
        $ref: /schemas/types.yaml#/definitions/string

    required:
      - cm-regulator-name

    additionalProperties: false

    patternProperties:
      "^cable[@-][0-9]$":
        type: object
        properties:
          cm-cable-name:
            description: name of charger cable
            enum:
              - USB
              - USB-HOST
              - SDP
              - DCP
              - CDP
              - ACA
              - FAST-CHARGER
              - SLOW-CHARGER
              - WPT
              - PD
              - DOCK
              - JIG
              - MECHANICAL

          cm-cable-extcon:
            description: name of extcon dev
            $ref: /schemas/types.yaml#/definitions/string

          cm-cable-min:
            description: minimum current of cable in uA
            $ref: /schemas/types.yaml#/definitions/uint32

          cm-cable-max:
            description: maximum current of cable in uA
            $ref: /schemas/types.yaml#/definitions/uint32

        required:
          - cm-cable-name
          - cm-cable-extcon

        additionalProperties: false

required:
  - compatible
  - cm-chargers
  - cm-fuel-gauge

additionalProperties: false

examples:
  - |
    charger-manager {
        compatible = "charger-manager";
        chg-reg-supply = <&charger_regulator>;
 
        cm-name = "battery";
        /* Always polling ON : 30s */
        cm-poll-mode = <1>;
        cm-poll-interval = <30000>;
 
        cm-fullbatt-vchkdrop-volt = <150000>;
        cm-fullbatt-soc = <100>;
 
        cm-battery-stat = <3>;
 
        cm-chargers = "charger0", "charger1", "charger2";
 
        cm-fuel-gauge = "fuelgauge0";
 
        cm-thermal-zone = "thermal_zone.1";
        /* in deci centigrade */
        cm-battery-cold = <50>;
        cm-battery-cold-in-minus;
        cm-battery-hot = <800>;
        cm-battery-temp-diff = <100>;
 
        /* Allow charging for 5hr */
        cm-charging-max = <18000000>;
        /* Allow discharging for 2hr */
        cm-discharging-max = <7200000>;
 
        regulator-0 {
            cm-regulator-name = "chg-reg";
            cable-0 {
                cm-cable-name = "USB";
                cm-cable-extcon = "extcon-dev.0";
                cm-cable-min = <475000>;
                cm-cable-max = <500000>;
            };
            cable-1 {
                cm-cable-name = "SDP";
                cm-cable-extcon = "extcon-dev.0";
                cm-cable-min = <650000>;
                cm-cable-max = <675000>;
            };
        };
    };