simple battery chargers only communicating through GPIOs

Schema identifier ($id): "http://devicetree.org/schemas/power/supply/gpio-charger.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

Maintainers (maintainers): "Sebastian Reichel <sre@kernel.org>"

This binding is for all chargers, which are working more or less autonomously, only providing some status GPIOs and possibly some GPIOs for limited control over the charging process.

Properties and child nodes (properties) #

compatible — required here #

Exact value (const): "gpio-charger"

charger-type — not listed as required here #

Allowed values (enum): "unknown", "battery", "ups", "mains", "usb-sdp", "usb-dcp", "usb-cdp", "usb-aca"

Type of the charger, e.g. "mains" for a wall charger.

gpios — not listed as required here #

Maximum number of items (maxItems): 1

GPIO indicating the charger presence

charge-status-gpios — not listed as required here #

Maximum number of items (maxItems): 1

GPIO indicating the charging status

charge-current-limit-gpios — not listed as required here #

Minimum number of items (minItems): 1

Maximum number of items (maxItems): 32

GPIOs used for current limiting

charge-current-limit-mapping — not listed as required here #

List of tuples with current in uA and a GPIO bitmap (in this order). The tuples must be provided in descending order of the current limit.

Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32-matrix

Array item rules (items) #

Array item rules (items)

Item 1

Current limit in uA

Item 2

Encoded GPIO setting. Bit 0 represents last GPIO from the charge-current-limit-gpios property. Bit 1 second to last GPIO and so on.

charge-current-limit-default-microamp — not listed as required here #

Default charge current limit. Must be listed in charge-current-limit-mapping.

Required in this object (required): "compatible"

At least one of these rules must match (anyOf) #

Rule 1 #

Required in this object (required): "gpios"

Rule 2 #

Required in this object (required): "charge-status-gpios"

Rule 3 #

Required in this object (required): "charge-current-limit-gpios"

Property dependencies (dependencies) #

charge-current-limit-gpios — applies when this property is present #

Also requires: "charge-current-limit-mapping"

charge-current-limit-mapping — applies when this property is present #

Also requires: "charge-current-limit-gpios"

charge-current-limit-default-microamp — applies when this property is present #

Also requires: "charge-current-limit-mapping"

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Examples (examples) #

#include <dt-bindings/gpio/gpio.h>

charger {
  compatible = "gpio-charger";
  charger-type = "usb-sdp";

  gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
  charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;

  charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>,
                               <&gpioA 12 GPIO_ACTIVE_HIGH>;
  charge-current-limit-mapping = <2500000 0x00>, // 2.5 A => both GPIOs low
                                 <700000 0x01>, // 700 mA => GPIO A.12 high
                                 <0 0x02>; // 0 mA => GPIO A.11 high
  charge-current-limit-default-microamp = <700000>;
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: GPL-2.0

Line 27: USB standard downstream port

Line 28: USB dedicated charging port

Line 29: USB charging downstream port

Line 30: USB accessory charger adapter

Edit this page