[PATCH V1 2/2] regulator: aw37503: add device-tree binding

like@awinic.com posted 2 patches 2 years, 6 months ago
There is a newer version of this series
[PATCH V1 2/2] regulator: aw37503: add device-tree binding
Posted by like@awinic.com 2 years, 6 months ago
From: Alec Li <like@awinic.com>

Add aw37503 regulator device-tree binding documentation

Signed-off-by: Alec Li <like@awinic.com>
---
 .../bindings/regulator/awinic,aw37503.yaml    | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml

diff --git a/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml b/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
new file mode 100644
index 000000000000..0cd6fb001e20
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/awinic,aw37503.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic AW37503 Voltage Regulator
+
+maintainers:
+  - Alec Li <like@awinic.com>
+
+description: |
+  The AW37503 is dual voltage regulator, designed to support positive/negative
+  supply for driving TFT-LCD panels. It support software-configurable output
+  switching and monitoring. The output voltages can be programmed via an I2C
+  compatible interface.
+
+properties:
+  compatible:
+    const:
+      - awinic,aw37503
+
+  reg:
+    maxItems: 1
+
+  patternProperties:
+    "^out[pn]$":
+      type: object
+      $ref: regulator.yaml#
+      unvaluatedproperties: false
+
+      required:
+        - regulator-name
+        - enable-gpios
+
+      additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - outp
+  - outn
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        aw37503@3e {
+            compatible = "awinic,aw37503";
+            reg = <0x3e>;
+
+            outp {
+                regulator-name = "outp";
+                regulator-boot-on;
+                regulator-always-on;
+                enable-gpios = <&gpio 17 0>;
+            };
+
+            outn {
+                regulator-name = "outn";
+                regulator-boot-on;
+                regulator-always-on;
+                enable-gpios = <&gpio 27 0>;
+            };
+        };
+    };
+...
-- 
2.41.0
Re: [PATCH V1 2/2] regulator: aw37503: add device-tree binding
Posted by Krzysztof Kozlowski 2 years, 6 months ago
On 26/07/2023 10:16, like@awinic.com wrote:
> From: Alec Li <like@awinic.com>
> 
> Add aw37503 regulator device-tree binding documentation

subject rather like:
regulator: dt-bindings: Add Awinic aw37503

> 
> Signed-off-by: Alec Li <like@awinic.com>
> ---
>  .../bindings/regulator/awinic,aw37503.yaml    | 73 +++++++++++++++++++
>  1 file changed, 73 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml b/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> new file mode 100644
> index 000000000000..0cd6fb001e20
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> @@ -0,0 +1,73 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/awinic,aw37503.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Awinic AW37503 Voltage Regulator
> +
> +maintainers:
> +  - Alec Li <like@awinic.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> +  The AW37503 is dual voltage regulator, designed to support positive/negative
> +  supply for driving TFT-LCD panels. It support software-configurable output
> +  switching and monitoring. The output voltages can be programmed via an I2C
> +  compatible interface.
> +
> +properties:
> +  compatible:
> +    const:
> +      - awinic,aw37503

This has to be in one line. As pointed out by Rob's bot: please test it
before sending.

> +
> +  reg:
> +    maxItems: 1
> +
> +  patternProperties:

<sigh>

> +    "^out[pn]$":
> +      type: object
> +      $ref: regulator.yaml#
> +      unvaluatedproperties: false
> +
> +      required:
> +        - regulator-name
> +        - enable-gpios

regulator.yaml does not define enable-gpios, so you must define it in
properties.

> +
> +      additionalProperties: false

Drop, you already have unevaluatedProperties.

> +
> +required:
> +  - compatible
> +  - reg
> +  - outp
> +  - outn
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        aw37503@3e {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


Best regards,
Krzysztof
Re: [PATCH V1 2/2] regulator: aw37503: add device-tree binding
Posted by like@awinic.com 2 years, 6 months ago
Hello Krzysztof Kozlowski,
Thank you very much for your advice.

> On 26/07/2023 10:16, like@awinic.com wrote:
> > From: Alec Li <like@awinic.com>
> > 
> > Add aw37503 regulator device-tree binding documentation
> 
> subject rather like:
> regulator: dt-bindings: Add Awinic aw37503

I will modify it as suggested.

> > 
> > Signed-off-by: Alec Li <like@awinic.com>
> > ---
> >  .../bindings/regulator/awinic,aw37503.yaml    | 73 +++++++++++++++++++
> >  1 file changed, 73 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml b/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> > new file mode 100644
> > index 000000000000..0cd6fb001e20
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> > @@ -0,0 +1,73 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/regulator/awinic,aw37503.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Awinic AW37503 Voltage Regulator
> > +
> > +maintainers:
> > +  - Alec Li <like@awinic.com>
> > +
> > +description: |
> 
> Do not need '|' unless you need to preserve formatting.

I will modify it as suggested.

> > +  The AW37503 is dual voltage regulator, designed to support positive/negative
> > +  supply for driving TFT-LCD panels. It support software-configurable output
> > +  switching and monitoring. The output voltages can be programmed via an I2C
> > +  compatible interface.
> > +
> > +properties:
> > +  compatible:
> > +    const:
> > +      - awinic,aw37503
> 
> This has to be in one line. As pointed out by Rob's bot: please test it
> before sending.

I will test it before sending and modify it as suggested.

> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  patternProperties:
> 
> <sigh>
> 
> > +    "^out[pn]$":
> > +      type: object
> > +      $ref: regulator.yaml#
> > +      unvaluatedproperties: false
> > +
> > +      required:
> > +        - regulator-name
> > +        - enable-gpios
> 
> regulator.yaml does not define enable-gpios, so you must define it in
> properties.

I will modify it as suggested.

> > +
> > +      additionalProperties: false
> 
> Drop, you already have unevaluatedProperties.

I will modify it as suggested.

> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - outp
> > +  - outn
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/gpio/gpio.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        aw37503@3e {
> 
> Node names should be generic. See also an explanation and list of
> examples (not exhaustive) in DT specification:
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

I will modify it as suggested.

 
Best regards,
Alec Li
Re: [PATCH V1 2/2] regulator: aw37503: add device-tree binding
Posted by Rob Herring 2 years, 6 months ago
On Wed, 26 Jul 2023 08:16:12 +0000, like@awinic.com wrote:
> From: Alec Li <like@awinic.com>
> 
> Add aw37503 regulator device-tree binding documentation
> 
> Signed-off-by: Alec Li <like@awinic.com>
> ---
>  .../bindings/regulator/awinic,aw37503.yaml    | 73 +++++++++++++++++++
>  1 file changed, 73 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties: 'patternProperties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
	hint: A json-schema keyword was found instead of a DT property name.
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties:compatible:const: ['awinic,aw37503'] is not of type 'integer', 'string'
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties:patternProperties: 'anyOf' conditional failed, one must be fixed:
	'^out[pn]$' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties:compatible:const: ['awinic,aw37503'] is not of type 'string'
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230726081612.586295-3-like@awinic.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH V1 2/2] regulator: aw37503: add device-tree binding
Posted by like@awinic.com 2 years, 6 months ago
Hello Rob Herring,
Thank you very much for your advice. 

On Wed, 26 Jul 2023 08:16:12 +0000, like@awinic.com wrote:
> > From: Alec Li <like@awinic.com>
> > 
> > Add aw37503 regulator device-tree binding documentation
> > 
> > Signed-off-by: Alec Li <like@awinic.com>
> > ---
> >  .../bindings/regulator/awinic,aw37503.yaml    | 73 +++++++++++++++++++
> >  1 file changed, 73 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml
> > 
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties: 'patternProperties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
> 	hint: A json-schema keyword was found instead of a DT property name.
> 	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties:compatible:const: ['awinic,aw37503'] is not of type 'integer', 'string'
> 	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties:patternProperties: 'anyOf' conditional failed, one must be fixed:
> 	'^out[pn]$' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
> 	'type' was expected
> 	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/awinic,aw37503.yaml: properties:compatible:const: ['awinic,aw37503'] is not of type 'string'
> 	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> 
> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230726081612.586295-3-like@awinic.com
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.

It was my mistake. I will run the above command and correct this error on patch v2.


Best regards,
Alec Li