13004e581SSebastian Reichel# SPDX-License-Identifier: GPL-2.0
23004e581SSebastian Reichel%YAML 1.2
33004e581SSebastian Reichel---
4*1ea78ec5SKrzysztof Kozlowski$id: http://devicetree.org/schemas/power/supply/lego,ev3-battery.yaml#
5*1ea78ec5SKrzysztof Kozlowski$schema: http://devicetree.org/meta-schemas/core.yaml#
63004e581SSebastian Reichel
73004e581SSebastian Reicheltitle: LEGO MINDSTORMS EV3 Battery
83004e581SSebastian Reichel
93004e581SSebastian Reichelmaintainers:
103004e581SSebastian Reichel  - David Lechner <david@lechnology.com>
113004e581SSebastian Reichel  - Sebastian Reichel <sre@kernel.org>
123004e581SSebastian Reichel
133004e581SSebastian Reicheldescription: |
143004e581SSebastian Reichel  LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery.
153004e581SSebastian Reichel  It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is
163004e581SSebastian Reichel  detected by a key switch in the battery compartment.
173004e581SSebastian Reichel
183004e581SSebastian ReichelallOf:
193004e581SSebastian Reichel  - $ref: power-supply.yaml#
203004e581SSebastian Reichel
213004e581SSebastian Reichelproperties:
223004e581SSebastian Reichel  compatible:
233004e581SSebastian Reichel    const: lego,ev3-battery
243004e581SSebastian Reichel
253004e581SSebastian Reichel  io-channels:
263004e581SSebastian Reichel    items:
273004e581SSebastian Reichel      - description: ADC channel for battery voltage
283004e581SSebastian Reichel      - description: ADC channel for battery current
293004e581SSebastian Reichel
303004e581SSebastian Reichel  io-channel-names:
313004e581SSebastian Reichel    items:
323004e581SSebastian Reichel      - const: voltage
333004e581SSebastian Reichel      - const: current
343004e581SSebastian Reichel
353004e581SSebastian Reichel  rechargeable-gpios:
363004e581SSebastian Reichel    maxItems: 1
373004e581SSebastian Reichel    description: Rechargeable battery indication gpio
383004e581SSebastian Reichel
393004e581SSebastian Reichelrequired:
403004e581SSebastian Reichel  - compatible
413004e581SSebastian Reichel  - io-channels
423004e581SSebastian Reichel  - io-channel-names
433004e581SSebastian Reichel  - rechargeable-gpios
443004e581SSebastian Reichel
453004e581SSebastian ReicheladditionalProperties: false
463004e581SSebastian Reichel
473004e581SSebastian Reichelexamples:
483004e581SSebastian Reichel  - |
493004e581SSebastian Reichel    #include <dt-bindings/gpio/gpio.h>
503004e581SSebastian Reichel    battery {
513004e581SSebastian Reichel      compatible = "lego,ev3-battery";
523004e581SSebastian Reichel      io-channels = <&adc 4>, <&adc 3>;
533004e581SSebastian Reichel      io-channel-names = "voltage", "current";
543004e581SSebastian Reichel      rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
553004e581SSebastian Reichel    };
56