ADC battery

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

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

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

Basic battery capacity meter, which only reports basic battery data via ADC channels and optionally indicate that the battery is full by polling a GPIO line. The voltage is expected to be measured between the battery terminals and mandatory. The optional current/power channel is expected to monitor the current/power flowing out of the battery. Last but not least the temperature channel is supposed to measure the battery temperature.

All of these rules must match (allOf) #

Rule 1 #

Shared schema rule ($ref): power-supply.yaml#

Properties and child nodes (properties) #

compatible — required here #

Exact value (const): "adc-battery"

charged-gpios — not listed as required here #

GPIO which signals that the battery is fully charged. The GPIO is often provided by charger ICs, that are not software controllable.

Maximum number of items (maxItems): 1

io-channels — required here #

Minimum number of items (minItems): 1

Maximum number of items (maxItems): 4

io-channel-names — required here #

Minimum number of items (minItems): 1

Array item rules (items) #

Item 1

Exact value (const): "voltage"

Item 2

Allowed values (enum): "current", "power", "temperature"

Item 3

Allowed values (enum): "power", "temperature"

Item 4

Exact value (const): "temperature"

monitored-battery — required here #

true — No constraints added by this property rule.

Required in this object (required): "compatible", "io-channels", "io-channel-names", "monitored-battery"

Properties not evaluated by applicable rules (unevaluatedProperties) #

false

Not allowed by this rule.

Examples (examples) #

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

fuel-gauge {
    compatible = "adc-battery";
    charged-gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
    io-channels = <&adc 13>, <&adc 37>;
    io-channel-names = "voltage", "current";

    power-supplies = <&charger>;
    monitored-battery = <&battery>;
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

Edit this page