diff mbox series

dt-bindings: power: Convert ingenic,battery.txt to YAML

Message ID 20200726125605.7009-1-contact@artur-rojek.eu (mailing list archive)
State Not Applicable, archived
Headers show
Series dt-bindings: power: Convert ingenic,battery.txt to YAML | expand

Commit Message

Artur Rojek July 26, 2020, 12:56 p.m. UTC
Convert the textual documentation of Device Tree bindings for the
Ingenic JZ47xx SoCs battery to YAML.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
---
 .../bindings/power/supply/ingenic,battery.txt | 31 ---------
 .../power/supply/ingenic,battery.yaml         | 67 +++++++++++++++++++
 2 files changed, 67 insertions(+), 31 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
 create mode 100644 Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml

Comments

Sebastian Reichel July 26, 2020, 9:11 p.m. UTC | #1
Hi,

On Sun, Jul 26, 2020 at 02:56:05PM +0200, Artur Rojek wrote:
> Convert the textual documentation of Device Tree bindings for the
> Ingenic JZ47xx SoCs battery to YAML.
> 
> Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
> ---
>  .../bindings/power/supply/ingenic,battery.txt | 31 ---------
>  .../power/supply/ingenic,battery.yaml         | 67 +++++++++++++++++++
>  2 files changed, 67 insertions(+), 31 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
>  create mode 100644 Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt b/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
> deleted file mode 100644
> index 66430bf73815..000000000000
> --- a/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -* Ingenic JZ47xx battery bindings
> -
> -Required properties:
> -
> -- compatible: Must be "ingenic,jz4740-battery".
> -- io-channels: phandle and IIO specifier pair to the IIO device.
> -  Format described in iio-bindings.txt.
> -- monitored-battery: phandle to a "simple-battery" compatible node.
> -
> -The "monitored-battery" property must be a phandle to a node using the format
> -described in battery.txt, with the following properties being required:
> -
> -- voltage-min-design-microvolt: Drained battery voltage.
> -- voltage-max-design-microvolt: Fully charged battery voltage.
> -
> -Example:
> -
> -#include <dt-bindings/iio/adc/ingenic,adc.h>
> -
> -simple_battery: battery {
> -	compatible = "simple-battery";
> -	voltage-min-design-microvolt = <3600000>;
> -	voltage-max-design-microvolt = <4200000>;
> -};
> -
> -ingenic_battery {
> -	compatible = "ingenic,jz4740-battery";
> -	io-channels = <&adc INGENIC_ADC_BATTERY>;
> -	io-channel-names = "battery";
> -	monitored-battery = <&simple_battery>;
> -};
> diff --git a/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml b/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
> new file mode 100644
> index 000000000000..8d36216f6c0e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
> @@ -0,0 +1,67 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +# Copyright 2019-2020 Artur Rojek
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/power/supply/ingenic,battery.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: Ingenic JZ47xx battery bindings
> +
> +maintainers:
> +  - Artur Rojek <contact@artur-rojek.eu>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - enum:
> +        - ingenic,jz4740-battery

Can be simplified to:

- const: ingenic,jz4740-battery

> +      - items:
> +        - enum:
> +          - ingenic,jz4725b-battery
> +          - ingenic,jz4770-battery
> +        - const: ingenic,jz4740-battery

The patch introduces new compatible values without any mention in
the patch description. Please move this into a second patch.

> +
> +  io-channels:
> +    items:
> +      - description: >
> +          phandle and IIO specifier pair to the IIO device.
> +          See Documentation/devicetree/bindings/iio/iio-bindings.txt for more
> +          details.
> +
> +  io-channel-names:
> +    const: "battery"
> +
> +  monitored-battery:
> +    items:
> +      - description: >
> +          phandle to a "simple-battery" compatible node.
> +
> +          This property must be a phandle to a node using the format described
> +          in battery.txt, with the following properties being required:
> +          - voltage-min-design-microvolt: drained battery voltage,
> +          - voltage-max-design-microvolt: fully charged battery voltage.
> +
> +required:
> +  - compatible
> +  - io-channels
> +  - io-channel-names
> +  - monitored-battery
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/iio/adc/ingenic,adc.h>
> +
> +    simple_battery: battery {
> +            compatible = "simple-battery";
> +            voltage-min-design-microvolt = <3600000>;
> +            voltage-max-design-microvolt = <4200000>;
> +    };
> +
> +    ingenic-battery {
> +            compatible = "ingenic,jz4740-battery";
> +            io-channels = <&adc INGENIC_ADC_BATTERY>;
> +            io-channel-names = "battery";
> +            monitored-battery = <&simple_battery>;
> +    };

Otherwise LGTM.

-- Sebastian
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt b/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
deleted file mode 100644
index 66430bf73815..000000000000
--- a/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
+++ /dev/null
@@ -1,31 +0,0 @@ 
-* Ingenic JZ47xx battery bindings
-
-Required properties:
-
-- compatible: Must be "ingenic,jz4740-battery".
-- io-channels: phandle and IIO specifier pair to the IIO device.
-  Format described in iio-bindings.txt.
-- monitored-battery: phandle to a "simple-battery" compatible node.
-
-The "monitored-battery" property must be a phandle to a node using the format
-described in battery.txt, with the following properties being required:
-
-- voltage-min-design-microvolt: Drained battery voltage.
-- voltage-max-design-microvolt: Fully charged battery voltage.
-
-Example:
-
-#include <dt-bindings/iio/adc/ingenic,adc.h>
-
-simple_battery: battery {
-	compatible = "simple-battery";
-	voltage-min-design-microvolt = <3600000>;
-	voltage-max-design-microvolt = <4200000>;
-};
-
-ingenic_battery {
-	compatible = "ingenic,jz4740-battery";
-	io-channels = <&adc INGENIC_ADC_BATTERY>;
-	io-channel-names = "battery";
-	monitored-battery = <&simple_battery>;
-};
diff --git a/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml b/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
new file mode 100644
index 000000000000..8d36216f6c0e
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
@@ -0,0 +1,67 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019-2020 Artur Rojek
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/ingenic,battery.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Ingenic JZ47xx battery bindings
+
+maintainers:
+  - Artur Rojek <contact@artur-rojek.eu>
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+        - ingenic,jz4740-battery
+      - items:
+        - enum:
+          - ingenic,jz4725b-battery
+          - ingenic,jz4770-battery
+        - const: ingenic,jz4740-battery
+
+  io-channels:
+    items:
+      - description: >
+          phandle and IIO specifier pair to the IIO device.
+          See Documentation/devicetree/bindings/iio/iio-bindings.txt for more
+          details.
+
+  io-channel-names:
+    const: "battery"
+
+  monitored-battery:
+    items:
+      - description: >
+          phandle to a "simple-battery" compatible node.
+
+          This property must be a phandle to a node using the format described
+          in battery.txt, with the following properties being required:
+          - voltage-min-design-microvolt: drained battery voltage,
+          - voltage-max-design-microvolt: fully charged battery voltage.
+
+required:
+  - compatible
+  - io-channels
+  - io-channel-names
+  - monitored-battery
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/iio/adc/ingenic,adc.h>
+
+    simple_battery: battery {
+            compatible = "simple-battery";
+            voltage-min-design-microvolt = <3600000>;
+            voltage-max-design-microvolt = <4200000>;
+    };
+
+    ingenic-battery {
+            compatible = "ingenic,jz4740-battery";
+            io-channels = <&adc INGENIC_ADC_BATTERY>;
+            io-channel-names = "battery";
+            monitored-battery = <&simple_battery>;
+    };