1*fac71e4eSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*fac71e4eSEmmanuel Vadot%YAML 1.2
3*fac71e4eSEmmanuel Vadot---
4*fac71e4eSEmmanuel Vadot$id: http://devicetree.org/schemas/power/supply/adc-battery.yaml#
5*fac71e4eSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*fac71e4eSEmmanuel Vadot
7*fac71e4eSEmmanuel Vadottitle: ADC battery
8*fac71e4eSEmmanuel Vadot
9*fac71e4eSEmmanuel Vadotmaintainers:
10*fac71e4eSEmmanuel Vadot  - Sebastian Reichel <sre@kernel.org>
11*fac71e4eSEmmanuel Vadot
12*fac71e4eSEmmanuel Vadotdescription:
13*fac71e4eSEmmanuel Vadot  Basic battery capacity meter, which only reports basic battery data
14*fac71e4eSEmmanuel Vadot  via ADC channels and optionally indicate that the battery is full by
15*fac71e4eSEmmanuel Vadot  polling a GPIO line.
16*fac71e4eSEmmanuel Vadot
17*fac71e4eSEmmanuel Vadot  The voltage is expected to be measured between the battery terminals
18*fac71e4eSEmmanuel Vadot  and mandatory. The optional current/power channel is expected to
19*fac71e4eSEmmanuel Vadot  monitor the current/power flowing out of the battery. Last but not
20*fac71e4eSEmmanuel Vadot  least the temperature channel is supposed to measure the battery
21*fac71e4eSEmmanuel Vadot  temperature.
22*fac71e4eSEmmanuel Vadot
23*fac71e4eSEmmanuel VadotallOf:
24*fac71e4eSEmmanuel Vadot  - $ref: power-supply.yaml#
25*fac71e4eSEmmanuel Vadot
26*fac71e4eSEmmanuel Vadotproperties:
27*fac71e4eSEmmanuel Vadot  compatible:
28*fac71e4eSEmmanuel Vadot    const: adc-battery
29*fac71e4eSEmmanuel Vadot
30*fac71e4eSEmmanuel Vadot  charged-gpios:
31*fac71e4eSEmmanuel Vadot    description:
32*fac71e4eSEmmanuel Vadot      GPIO which signals that the battery is fully charged. The GPIO is
33*fac71e4eSEmmanuel Vadot      often provided by charger ICs, that are not software controllable.
34*fac71e4eSEmmanuel Vadot    maxItems: 1
35*fac71e4eSEmmanuel Vadot
36*fac71e4eSEmmanuel Vadot  io-channels:
37*fac71e4eSEmmanuel Vadot    minItems: 1
38*fac71e4eSEmmanuel Vadot    maxItems: 4
39*fac71e4eSEmmanuel Vadot
40*fac71e4eSEmmanuel Vadot  io-channel-names:
41*fac71e4eSEmmanuel Vadot    minItems: 1
42*fac71e4eSEmmanuel Vadot    items:
43*fac71e4eSEmmanuel Vadot      - const: voltage
44*fac71e4eSEmmanuel Vadot      - enum: [ current, power, temperature ]
45*fac71e4eSEmmanuel Vadot      - enum: [ power, temperature ]
46*fac71e4eSEmmanuel Vadot      - const: temperature
47*fac71e4eSEmmanuel Vadot
48*fac71e4eSEmmanuel Vadot  monitored-battery: true
49*fac71e4eSEmmanuel Vadot
50*fac71e4eSEmmanuel Vadotrequired:
51*fac71e4eSEmmanuel Vadot  - compatible
52*fac71e4eSEmmanuel Vadot  - io-channels
53*fac71e4eSEmmanuel Vadot  - io-channel-names
54*fac71e4eSEmmanuel Vadot  - monitored-battery
55*fac71e4eSEmmanuel Vadot
56*fac71e4eSEmmanuel VadotunevaluatedProperties: false
57*fac71e4eSEmmanuel Vadot
58*fac71e4eSEmmanuel Vadotexamples:
59*fac71e4eSEmmanuel Vadot  - |
60*fac71e4eSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
61*fac71e4eSEmmanuel Vadot
62*fac71e4eSEmmanuel Vadot    fuel-gauge {
63*fac71e4eSEmmanuel Vadot        compatible = "adc-battery";
64*fac71e4eSEmmanuel Vadot        charged-gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
65*fac71e4eSEmmanuel Vadot        io-channels = <&adc 13>, <&adc 37>;
66*fac71e4eSEmmanuel Vadot        io-channel-names = "voltage", "current";
67*fac71e4eSEmmanuel Vadot
68*fac71e4eSEmmanuel Vadot        power-supplies = <&charger>;
69*fac71e4eSEmmanuel Vadot        monitored-battery = <&battery>;
70*fac71e4eSEmmanuel Vadot    };
71