18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
28c2ecf20Sopenharmony_ci# Copyright 2019-2020 Artur Rojek
38c2ecf20Sopenharmony_ci%YAML 1.2
48c2ecf20Sopenharmony_ci---
58c2ecf20Sopenharmony_ci$id: "http://devicetree.org/schemas/power/supply/ingenic,battery.yaml#"
68c2ecf20Sopenharmony_ci$schema: "http://devicetree.org/meta-schemas/core.yaml#"
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cititle: Ingenic JZ47xx battery bindings
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cimaintainers:
118c2ecf20Sopenharmony_ci  - Artur Rojek <contact@artur-rojek.eu>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciproperties:
148c2ecf20Sopenharmony_ci  compatible:
158c2ecf20Sopenharmony_ci    oneOf:
168c2ecf20Sopenharmony_ci      - const: ingenic,jz4740-battery
178c2ecf20Sopenharmony_ci      - items:
188c2ecf20Sopenharmony_ci          - enum:
198c2ecf20Sopenharmony_ci              - ingenic,jz4725b-battery
208c2ecf20Sopenharmony_ci              - ingenic,jz4770-battery
218c2ecf20Sopenharmony_ci          - const: ingenic,jz4740-battery
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci  io-channels:
248c2ecf20Sopenharmony_ci    maxItems: 1
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci  io-channel-names:
278c2ecf20Sopenharmony_ci    const: battery
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci  monitored-battery:
308c2ecf20Sopenharmony_ci    description: >
318c2ecf20Sopenharmony_ci      phandle to a "simple-battery" compatible node.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci      This property must be a phandle to a node using the format described
348c2ecf20Sopenharmony_ci      in battery.yaml, with the following properties being required:
358c2ecf20Sopenharmony_ci      - voltage-min-design-microvolt: drained battery voltage,
368c2ecf20Sopenharmony_ci      - voltage-max-design-microvolt: fully charged battery voltage.
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cirequired:
398c2ecf20Sopenharmony_ci  - compatible
408c2ecf20Sopenharmony_ci  - io-channels
418c2ecf20Sopenharmony_ci  - io-channel-names
428c2ecf20Sopenharmony_ci  - monitored-battery
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciadditionalProperties: false
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciexamples:
478c2ecf20Sopenharmony_ci  - |
488c2ecf20Sopenharmony_ci    #include <dt-bindings/iio/adc/ingenic,adc.h>
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci    simple_battery: battery {
518c2ecf20Sopenharmony_ci            compatible = "simple-battery";
528c2ecf20Sopenharmony_ci            voltage-min-design-microvolt = <3600000>;
538c2ecf20Sopenharmony_ci            voltage-max-design-microvolt = <4200000>;
548c2ecf20Sopenharmony_ci    };
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci    ingenic-battery {
578c2ecf20Sopenharmony_ci            compatible = "ingenic,jz4740-battery";
588c2ecf20Sopenharmony_ci            io-channels = <&adc INGENIC_ADC_BATTERY>;
598c2ecf20Sopenharmony_ci            io-channel-names = "battery";
608c2ecf20Sopenharmony_ci            monitored-battery = <&simple_battery>;
618c2ecf20Sopenharmony_ci    };
62