All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: mfd: Convert rn5t618 to json-schema
@ 2020-09-08 20:13 Andreas Kemnade
  2020-09-15 17:11 ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Kemnade @ 2020-09-08 20:13 UTC (permalink / raw)
  To: lee.jones, robh+dt, andreas, devicetree, linux-kernel, b.galvani, stefan

Convert the RN5T618 binding to DT schema format. Also
clearly state which regulators are available.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
I have noted myself here as maintainer because I wrote most of the
code of the several subdevices, although not of the .txt-binding.
Due to its .txt-format history BSD license was not added.
I happily ignored the "does MAINTAINERS need updating" thing
from checkpatch.pl, I do not know whether that PMIC should
have a separate entry there.

 .../bindings/mfd/ricoh,rn5t618.yaml           | 113 ++++++++++++++++++
 .../devicetree/bindings/mfd/rn5t618.txt       |  52 --------
 2 files changed, 113 insertions(+), 52 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/rn5t618.txt

diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
new file mode 100644
index 000000000000..9596dde7a69a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
@@ -0,0 +1,113 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/ricoh,rn5t618.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ricoh RN5T567/RN5T618/RC5T619 PMIC
+
+maintainers:
+  - Andreas Kemnade <andreas@kemnade.info>
+
+description: |
+  Ricoh RN5T567/RN5T618/RC5T619 is a power management IC family which
+  integrates 3 to 5 step-down DCDC converters, 7 to 10 low-dropout regulators,
+  GPIOs, and a watchdog timer. It can be controlled through an I2C interface.
+  The RN5T618/RC5T619 provides additionally a Li-ion battery charger,
+  fuel gauge, and an ADC.
+  The RC5T619 additionnally includes USB charger detection and an RTC.
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ricoh,rn5t567
+    then:
+      properties:
+        regulators:
+          patternProperties:
+            "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$":
+              $ref: ../regulator/regulator.yaml
+          additionalProperties: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ricoh,rn5t618
+    then:
+      properties:
+        regulators:
+          patternProperties:
+            "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$":
+              $ref: ../regulator/regulator.yaml
+          additionalProperties: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ricoh,rc5t619
+    then:
+      properties:
+        regulators:
+          patternProperties:
+            "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
+              $ref: ../regulator/regulator.yaml
+          additionalProperties: false
+
+properties:
+  compatible:
+    enum:
+      - ricoh,rn5t567
+      - ricoh,rn5t618
+      - ricoh,rc5t619
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+    description: |
+      See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+
+  system-power-controller:
+    type: boolean
+    description: |
+      See Documentation/devicetree/bindings/power/power-controller.txt
+
+  regulators:
+    type: object
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      pmic@32 {
+        compatible = "ricoh,rn5t618";
+        reg = <0x32>;
+        interrupt-parent = <&gpio5>;
+        interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
+        system-power-controller;
+
+        regulators {
+          DCDC1 {
+            regulator-min-microvolt = <1050000>;
+            regulator-max-microvolt = <1050000>;
+          };
+
+          DCDC2 {
+            regulator-min-microvolt = <1175000>;
+            regulator-max-microvolt = <1175000>;
+          };
+        };
+      };
+    };
diff --git a/Documentation/devicetree/bindings/mfd/rn5t618.txt b/Documentation/devicetree/bindings/mfd/rn5t618.txt
deleted file mode 100644
index 16778ea00dbc..000000000000
--- a/Documentation/devicetree/bindings/mfd/rn5t618.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-* Ricoh RN5T567/RN5T618 PMIC
-
-Ricoh RN5T567/RN5T618/RC5T619 is a power management IC family which
-integrates 3 to 5 step-down DCDC converters, 7 to 10 low-dropout regulators,
-GPIOs, and a watchdog timer. It can be controlled through an I2C interface.
-The RN5T618/RC5T619 provides additionally a Li-ion battery charger,
-fuel gauge, and an ADC.
-The RC5T619 additionnally includes USB charger detection and an RTC.
-
-Required properties:
- - compatible: must be one of
-		"ricoh,rn5t567"
-		"ricoh,rn5t618"
-		"ricoh,rc5t619"
- - reg: the I2C slave address of the device
-
-Optional properties:
- - interrupts: interrupt mapping for IRQ
-   See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
- - system-power-controller:
-   See Documentation/devicetree/bindings/power/power-controller.txt
-
-Sub-nodes:
- - regulators: the node is required if the regulator functionality is
-   needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC4
-   (RN5T567/RC5T619), LDO1, LDO2, LDO3, LDO4, LDO5, LDO6, LDO7, LDO8,
-   LDO9, LDO10, LDORTC1 and LDORTC2.
-   LDO7-10 are specific to RC5T619.
-   The common bindings for each individual regulator can be found in:
-   Documentation/devicetree/bindings/regulator/regulator.txt
-
-Example:
-
-	pmic@32 {
-		compatible = "ricoh,rn5t618";
-		reg = <0x32>;
-		interrupt-parent = <&gpio5>;
-		interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
-		system-power-controller;
-
-		regulators {
-			DCDC1 {
-				regulator-min-microvolt = <1050000>;
-				regulator-max-microvolt = <1050000>;
-			};
-
-			DCDC2 {
-				regulator-min-microvolt = <1175000>;
-				regulator-max-microvolt = <1175000>;
-			};
-		};
-	};
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: mfd: Convert rn5t618 to json-schema
  2020-09-08 20:13 [PATCH] dt-bindings: mfd: Convert rn5t618 to json-schema Andreas Kemnade
@ 2020-09-15 17:11 ` Rob Herring
  2020-09-15 19:49   ` Andreas Kemnade
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2020-09-15 17:11 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: lee.jones, devicetree, linux-kernel, b.galvani, stefan

On Tue, Sep 08, 2020 at 10:13:03PM +0200, Andreas Kemnade wrote:
> Convert the RN5T618 binding to DT schema format. Also
> clearly state which regulators are available.
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> I have noted myself here as maintainer because I wrote most of the
> code of the several subdevices, although not of the .txt-binding.
> Due to its .txt-format history BSD license was not added.
> I happily ignored the "does MAINTAINERS need updating" thing
> from checkpatch.pl, I do not know whether that PMIC should
> have a separate entry there.
> 
>  .../bindings/mfd/ricoh,rn5t618.yaml           | 113 ++++++++++++++++++
>  .../devicetree/bindings/mfd/rn5t618.txt       |  52 --------
>  2 files changed, 113 insertions(+), 52 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
>  delete mode 100644 Documentation/devicetree/bindings/mfd/rn5t618.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> new file mode 100644
> index 000000000000..9596dde7a69a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> @@ -0,0 +1,113 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/ricoh,rn5t618.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Ricoh RN5T567/RN5T618/RC5T619 PMIC
> +
> +maintainers:
> +  - Andreas Kemnade <andreas@kemnade.info>
> +
> +description: |
> +  Ricoh RN5T567/RN5T618/RC5T619 is a power management IC family which
> +  integrates 3 to 5 step-down DCDC converters, 7 to 10 low-dropout regulators,
> +  GPIOs, and a watchdog timer. It can be controlled through an I2C interface.
> +  The RN5T618/RC5T619 provides additionally a Li-ion battery charger,
> +  fuel gauge, and an ADC.
> +  The RC5T619 additionnally includes USB charger detection and an RTC.
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: ricoh,rn5t567
> +    then:
> +      properties:
> +        regulators:
> +          patternProperties:
> +            "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$":
> +              $ref: ../regulator/regulator.yaml
> +          additionalProperties: false
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: ricoh,rn5t618
> +    then:
> +      properties:
> +        regulators:
> +          patternProperties:
> +            "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$":
> +              $ref: ../regulator/regulator.yaml
> +          additionalProperties: false
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: ricoh,rc5t619
> +    then:
> +      properties:
> +        regulators:
> +          patternProperties:
> +            "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
> +              $ref: ../regulator/regulator.yaml
> +          additionalProperties: false

I prefer under 'regulators' below, you have all possible regulator 
names:

patternProperties:
  "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
     $ref: ../regulator/regulator.yaml

and then above you just need to restrict the possible names:

regulators:
  propertyNames:
    pattern: "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$"

(propertyNames schema is applied to all an object's properties and you 
don't need additionalProperties here.)

> +properties:
> +  compatible:
> +    enum:
> +      - ricoh,rn5t567
> +      - ricoh,rn5t618
> +      - ricoh,rc5t619
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +    description: |
> +      See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt

Drop the description.

> +
> +  system-power-controller:
> +    type: boolean
> +    description: |
> +      See Documentation/devicetree/bindings/power/power-controller.txt
> +
> +  regulators:
> +    type: object
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    i2c {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      pmic@32 {
> +        compatible = "ricoh,rn5t618";
> +        reg = <0x32>;
> +        interrupt-parent = <&gpio5>;
> +        interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
> +        system-power-controller;
> +
> +        regulators {
> +          DCDC1 {
> +            regulator-min-microvolt = <1050000>;
> +            regulator-max-microvolt = <1050000>;
> +          };
> +
> +          DCDC2 {
> +            regulator-min-microvolt = <1175000>;
> +            regulator-max-microvolt = <1175000>;
> +          };
> +        };
> +      };
> +    };
> diff --git a/Documentation/devicetree/bindings/mfd/rn5t618.txt b/Documentation/devicetree/bindings/mfd/rn5t618.txt
> deleted file mode 100644
> index 16778ea00dbc..000000000000
> --- a/Documentation/devicetree/bindings/mfd/rn5t618.txt
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -* Ricoh RN5T567/RN5T618 PMIC
> -
> -Ricoh RN5T567/RN5T618/RC5T619 is a power management IC family which
> -integrates 3 to 5 step-down DCDC converters, 7 to 10 low-dropout regulators,
> -GPIOs, and a watchdog timer. It can be controlled through an I2C interface.
> -The RN5T618/RC5T619 provides additionally a Li-ion battery charger,
> -fuel gauge, and an ADC.
> -The RC5T619 additionnally includes USB charger detection and an RTC.
> -
> -Required properties:
> - - compatible: must be one of
> -		"ricoh,rn5t567"
> -		"ricoh,rn5t618"
> -		"ricoh,rc5t619"
> - - reg: the I2C slave address of the device
> -
> -Optional properties:
> - - interrupts: interrupt mapping for IRQ
> -   See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> - - system-power-controller:
> -   See Documentation/devicetree/bindings/power/power-controller.txt
> -
> -Sub-nodes:
> - - regulators: the node is required if the regulator functionality is
> -   needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC4
> -   (RN5T567/RC5T619), LDO1, LDO2, LDO3, LDO4, LDO5, LDO6, LDO7, LDO8,
> -   LDO9, LDO10, LDORTC1 and LDORTC2.
> -   LDO7-10 are specific to RC5T619.
> -   The common bindings for each individual regulator can be found in:
> -   Documentation/devicetree/bindings/regulator/regulator.txt
> -
> -Example:
> -
> -	pmic@32 {
> -		compatible = "ricoh,rn5t618";
> -		reg = <0x32>;
> -		interrupt-parent = <&gpio5>;
> -		interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
> -		system-power-controller;
> -
> -		regulators {
> -			DCDC1 {
> -				regulator-min-microvolt = <1050000>;
> -				regulator-max-microvolt = <1050000>;
> -			};
> -
> -			DCDC2 {
> -				regulator-min-microvolt = <1175000>;
> -				regulator-max-microvolt = <1175000>;
> -			};
> -		};
> -	};
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: mfd: Convert rn5t618 to json-schema
  2020-09-15 17:11 ` Rob Herring
@ 2020-09-15 19:49   ` Andreas Kemnade
  2020-09-15 22:55     ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Kemnade @ 2020-09-15 19:49 UTC (permalink / raw)
  To: Rob Herring; +Cc: lee.jones, devicetree, linux-kernel, b.galvani, stefan

On Tue, 15 Sep 2020 11:11:52 -0600
Rob Herring <robh@kernel.org> wrote:

> On Tue, Sep 08, 2020 at 10:13:03PM +0200, Andreas Kemnade wrote:
> > Convert the RN5T618 binding to DT schema format. Also
> > clearly state which regulators are available.
> > 
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> > I have noted myself here as maintainer because I wrote most of the
> > code of the several subdevices, although not of the .txt-binding.
> > Due to its .txt-format history BSD license was not added.
> > I happily ignored the "does MAINTAINERS need updating" thing
> > from checkpatch.pl, I do not know whether that PMIC should
> > have a separate entry there.
> > 
> >  .../bindings/mfd/ricoh,rn5t618.yaml           | 113 ++++++++++++++++++
> >  .../devicetree/bindings/mfd/rn5t618.txt       |  52 --------
> >  2 files changed, 113 insertions(+), 52 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> >  delete mode 100644 Documentation/devicetree/bindings/mfd/rn5t618.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > new file mode 100644
> > index 000000000000..9596dde7a69a
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > @@ -0,0 +1,113 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mfd/ricoh,rn5t618.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Ricoh RN5T567/RN5T618/RC5T619 PMIC
> > +
> > +maintainers:
> > +  - Andreas Kemnade <andreas@kemnade.info>
> > +
> > +description: |
> > +  Ricoh RN5T567/RN5T618/RC5T619 is a power management IC family which
> > +  integrates 3 to 5 step-down DCDC converters, 7 to 10 low-dropout regulators,
> > +  GPIOs, and a watchdog timer. It can be controlled through an I2C interface.
> > +  The RN5T618/RC5T619 provides additionally a Li-ion battery charger,
> > +  fuel gauge, and an ADC.
> > +  The RC5T619 additionnally includes USB charger detection and an RTC.
> > +
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: ricoh,rn5t567
> > +    then:
> > +      properties:
> > +        regulators:
> > +          patternProperties:
> > +            "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$":
> > +              $ref: ../regulator/regulator.yaml
> > +          additionalProperties: false
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: ricoh,rn5t618
> > +    then:
> > +      properties:
> > +        regulators:
> > +          patternProperties:
> > +            "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$":
> > +              $ref: ../regulator/regulator.yaml
> > +          additionalProperties: false
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: ricoh,rc5t619
> > +    then:
> > +      properties:
> > +        regulators:
> > +          patternProperties:
> > +            "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
> > +              $ref: ../regulator/regulator.yaml
> > +          additionalProperties: false  
> 
> I prefer under 'regulators' below, you have all possible regulator 
> names:
> 
> patternProperties:
>   "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
>      $ref: ../regulator/regulator.yaml
> 
> and then above you just need to restrict the possible names:
> 
> regulators:
>   propertyNames:
>     pattern: "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$"
> 
> (propertyNames schema is applied to all an object's properties and you 
> don't need additionalProperties here.)
> 
hmm, dt_binding_check refuses to digest things like this:

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: ricoh,rn5t567
    then:
      properties:
        regulators:
          propertyNames:
            pattern: "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$"

I get:
andi@aktux:~/kernel$ DT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml makearm dt_binding_check
  CHKDT   Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
/home/andi/kernel/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml: allOf:0:then:properties:regulators: Additional properties are not allowed ('propertyNames' was unexpected)
/home/andi/kernel/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml: allOf:0:then:properties:regulators: 'propertyNames' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'type', 'typeSize', 'unevaluatedProperties', 'uniqueItems']

andi@aktux:~/kernel/Documentation$ grep -R propertyNames *
devicetree/bindings/mfd/ricoh,rn5t618.yaml:          propertyNames:
devicetree/bindings/mfd/ricoh,rn5t618.yaml:          propertyNames:
devicetree/bindings/mfd/ricoh,rn5t618.yaml:          propertyNames:

... and I am the only user, it is not documented.
and yes I have updated my tools
andi@aktux:~/kernel$ dt-validate --version
2020.8.1

Regards,
Andreas


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: mfd: Convert rn5t618 to json-schema
  2020-09-15 19:49   ` Andreas Kemnade
@ 2020-09-15 22:55     ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2020-09-15 22:55 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: Lee Jones, devicetree, linux-kernel, Beniamino Galvani, Stefan Agner

On Tue, Sep 15, 2020 at 1:49 PM Andreas Kemnade <andreas@kemnade.info> wrote:
>
> On Tue, 15 Sep 2020 11:11:52 -0600
> Rob Herring <robh@kernel.org> wrote:
>
> > On Tue, Sep 08, 2020 at 10:13:03PM +0200, Andreas Kemnade wrote:
> > > Convert the RN5T618 binding to DT schema format. Also
> > > clearly state which regulators are available.
> > >
> > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > > ---
> > > I have noted myself here as maintainer because I wrote most of the
> > > code of the several subdevices, although not of the .txt-binding.
> > > Due to its .txt-format history BSD license was not added.
> > > I happily ignored the "does MAINTAINERS need updating" thing
> > > from checkpatch.pl, I do not know whether that PMIC should
> > > have a separate entry there.
> > >
> > >  .../bindings/mfd/ricoh,rn5t618.yaml           | 113 ++++++++++++++++++
> > >  .../devicetree/bindings/mfd/rn5t618.txt       |  52 --------
> > >  2 files changed, 113 insertions(+), 52 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > >  delete mode 100644 Documentation/devicetree/bindings/mfd/rn5t618.txt
> > >
> > > diff --git a/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > > new file mode 100644
> > > index 000000000000..9596dde7a69a
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mfd/ricoh,rn5t618.yaml
> > > @@ -0,0 +1,113 @@
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/mfd/ricoh,rn5t618.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Ricoh RN5T567/RN5T618/RC5T619 PMIC
> > > +
> > > +maintainers:
> > > +  - Andreas Kemnade <andreas@kemnade.info>
> > > +
> > > +description: |
> > > +  Ricoh RN5T567/RN5T618/RC5T619 is a power management IC family which
> > > +  integrates 3 to 5 step-down DCDC converters, 7 to 10 low-dropout regulators,
> > > +  GPIOs, and a watchdog timer. It can be controlled through an I2C interface.
> > > +  The RN5T618/RC5T619 provides additionally a Li-ion battery charger,
> > > +  fuel gauge, and an ADC.
> > > +  The RC5T619 additionnally includes USB charger detection and an RTC.
> > > +
> > > +allOf:
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: ricoh,rn5t567
> > > +    then:
> > > +      properties:
> > > +        regulators:
> > > +          patternProperties:
> > > +            "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$":
> > > +              $ref: ../regulator/regulator.yaml
> > > +          additionalProperties: false
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: ricoh,rn5t618
> > > +    then:
> > > +      properties:
> > > +        regulators:
> > > +          patternProperties:
> > > +            "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$":
> > > +              $ref: ../regulator/regulator.yaml
> > > +          additionalProperties: false
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: ricoh,rc5t619
> > > +    then:
> > > +      properties:
> > > +        regulators:
> > > +          patternProperties:
> > > +            "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
> > > +              $ref: ../regulator/regulator.yaml
> > > +          additionalProperties: false
> >
> > I prefer under 'regulators' below, you have all possible regulator
> > names:
> >
> > patternProperties:
> >   "^(DCDC[1-5]|LDO[1-9]|LDO10|LDORTC[12])$":
> >      $ref: ../regulator/regulator.yaml
> >
> > and then above you just need to restrict the possible names:
> >
> > regulators:
> >   propertyNames:
> >     pattern: "^(DCDC[1-3]|LDO[1-5]|LDORTC[12])$"
> >
> > (propertyNames schema is applied to all an object's properties and you
> > don't need additionalProperties here.)
> >
> hmm, dt_binding_check refuses to digest things like this:

That's the overly restrictive meta-schema trying to keep folks in the
lane. Sorry, I should have checked that first.

> allOf:
>   - if:
>       properties:
>         compatible:
>           contains:
>             const: ricoh,rn5t567
>     then:
>       properties:
>         regulators:
>           propertyNames:
>             pattern: "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$"

So just stick with the form you had:

patternProperties:
  "^(DCDC[1-4]|LDO[1-5]|LDORTC[12])$": true
additionalProperties: false

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-15 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 20:13 [PATCH] dt-bindings: mfd: Convert rn5t618 to json-schema Andreas Kemnade
2020-09-15 17:11 ` Rob Herring
2020-09-15 19:49   ` Andreas Kemnade
2020-09-15 22:55     ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.