summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/power/supply/lego,ev3-battery.yaml
blob: a99d989f1450a0e6c03122e755ec52e57845c8d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/lego,ev3-battery.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LEGO MINDSTORMS EV3 Battery

maintainers:
  - David Lechner <david@lechnology.com>
  - Sebastian Reichel <sre@kernel.org>

description: |
  LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery.
  It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is
  detected by a key switch in the battery compartment.

allOf:
  - $ref: power-supply.yaml#

properties:
  compatible:
    const: lego,ev3-battery

  io-channels:
    items:
      - description: ADC channel for battery voltage
      - description: ADC channel for battery current

  io-channel-names:
    items:
      - const: voltage
      - const: current

  rechargeable-gpios:
    maxItems: 1
    description: Rechargeable battery indication gpio

required:
  - compatible
  - io-channels
  - io-channel-names
  - rechargeable-gpios

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    battery {
      compatible = "lego,ev3-battery";
      io-channels = <&adc 4>, <&adc 3>;
      io-channel-names = "voltage", "current";
      rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
    };