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