1*3004e581SSebastian Reichel# SPDX-License-Identifier: GPL-2.0
2*3004e581SSebastian Reichel%YAML 1.2
3*3004e581SSebastian Reichel---
4*3004e581SSebastian Reichel$id: "http://devicetree.org/schemas/power/supply/lego,ev3-battery.yaml#"
5*3004e581SSebastian Reichel$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6*3004e581SSebastian Reichel
7*3004e581SSebastian Reicheltitle: LEGO MINDSTORMS EV3 Battery
8*3004e581SSebastian Reichel
9*3004e581SSebastian Reichelmaintainers:
10*3004e581SSebastian Reichel  - David Lechner <david@lechnology.com>
11*3004e581SSebastian Reichel  - Sebastian Reichel <sre@kernel.org>
12*3004e581SSebastian Reichel
13*3004e581SSebastian Reicheldescription: |
14*3004e581SSebastian Reichel  LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery.
15*3004e581SSebastian Reichel  It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is
16*3004e581SSebastian Reichel  detected by a key switch in the battery compartment.
17*3004e581SSebastian Reichel
18*3004e581SSebastian ReichelallOf:
19*3004e581SSebastian Reichel  - $ref: power-supply.yaml#
20*3004e581SSebastian Reichel
21*3004e581SSebastian Reichelproperties:
22*3004e581SSebastian Reichel  compatible:
23*3004e581SSebastian Reichel    const: lego,ev3-battery
24*3004e581SSebastian Reichel
25*3004e581SSebastian Reichel  io-channels:
26*3004e581SSebastian Reichel    items:
27*3004e581SSebastian Reichel      - description: ADC channel for battery voltage
28*3004e581SSebastian Reichel      - description: ADC channel for battery current
29*3004e581SSebastian Reichel
30*3004e581SSebastian Reichel  io-channel-names:
31*3004e581SSebastian Reichel    items:
32*3004e581SSebastian Reichel      - const: voltage
33*3004e581SSebastian Reichel      - const: current
34*3004e581SSebastian Reichel
35*3004e581SSebastian Reichel  rechargeable-gpios:
36*3004e581SSebastian Reichel    maxItems: 1
37*3004e581SSebastian Reichel    description: Rechargeable battery indication gpio
38*3004e581SSebastian Reichel
39*3004e581SSebastian Reichelrequired:
40*3004e581SSebastian Reichel  - compatible
41*3004e581SSebastian Reichel  - io-channels
42*3004e581SSebastian Reichel  - io-channel-names
43*3004e581SSebastian Reichel  - rechargeable-gpios
44*3004e581SSebastian Reichel
45*3004e581SSebastian ReicheladditionalProperties: false
46*3004e581SSebastian Reichel
47*3004e581SSebastian Reichelexamples:
48*3004e581SSebastian Reichel  - |
49*3004e581SSebastian Reichel    #include <dt-bindings/gpio/gpio.h>
50*3004e581SSebastian Reichel    battery {
51*3004e581SSebastian Reichel      compatible = "lego,ev3-battery";
52*3004e581SSebastian Reichel      io-channels = <&adc 4>, <&adc 3>;
53*3004e581SSebastian Reichel      io-channel-names = "voltage", "current";
54*3004e581SSebastian Reichel      rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
55*3004e581SSebastian Reichel    };
56