162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/power/supply/lego,ev3-battery.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: LEGO MINDSTORMS EV3 Battery
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - David Lechner <david@lechnology.com>
1162306a36Sopenharmony_ci  - Sebastian Reichel <sre@kernel.org>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery.
1562306a36Sopenharmony_ci  It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is
1662306a36Sopenharmony_ci  detected by a key switch in the battery compartment.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciallOf:
1962306a36Sopenharmony_ci  - $ref: power-supply.yaml#
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciproperties:
2262306a36Sopenharmony_ci  compatible:
2362306a36Sopenharmony_ci    const: lego,ev3-battery
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci  io-channels:
2662306a36Sopenharmony_ci    items:
2762306a36Sopenharmony_ci      - description: ADC channel for battery voltage
2862306a36Sopenharmony_ci      - description: ADC channel for battery current
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci  io-channel-names:
3162306a36Sopenharmony_ci    items:
3262306a36Sopenharmony_ci      - const: voltage
3362306a36Sopenharmony_ci      - const: current
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci  rechargeable-gpios:
3662306a36Sopenharmony_ci    maxItems: 1
3762306a36Sopenharmony_ci    description: Rechargeable battery indication gpio
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cirequired:
4062306a36Sopenharmony_ci  - compatible
4162306a36Sopenharmony_ci  - io-channels
4262306a36Sopenharmony_ci  - io-channel-names
4362306a36Sopenharmony_ci  - rechargeable-gpios
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciadditionalProperties: false
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciexamples:
4862306a36Sopenharmony_ci  - |
4962306a36Sopenharmony_ci    #include <dt-bindings/gpio/gpio.h>
5062306a36Sopenharmony_ci    battery {
5162306a36Sopenharmony_ci      compatible = "lego,ev3-battery";
5262306a36Sopenharmony_ci      io-channels = <&adc 4>, <&adc 3>;
5362306a36Sopenharmony_ci      io-channel-names = "voltage", "current";
5462306a36Sopenharmony_ci      rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
5562306a36Sopenharmony_ci    };
56