diff mbox series

[v2,2/2] dt-bindings: pinctrl: Add bindings for Awinic AW9523/AW9523B

Message ID 20210111182928.587285-2-angelogioacchino.delregno@somainline.org
State Superseded
Headers show
Series [v2,1/2] pinctrl: Add driver for Awinic AW9523/B I2C GPIO Expander | expand

Commit Message

AngeloGioacchino Del Regno Jan. 11, 2021, 6:29 p.m. UTC
Add bindings for the Awinic AW9523/AW9523B I2C GPIO Expander driver.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 .../pinctrl/awinic,aw9523-pinctrl.yaml        | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

Comments

Rob Herring Jan. 12, 2021, 9:52 p.m. UTC | #1
On Mon, 11 Jan 2021 19:29:28 +0100, AngeloGioacchino Del Regno wrote:
> Add bindings for the Awinic AW9523/AW9523B I2C GPIO Expander driver.

> 

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> ---

>  .../pinctrl/awinic,aw9523-pinctrl.yaml        | 112 ++++++++++++++++++

>  1 file changed, 112 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

> 


My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dts:25.21-34: Warning (reg_format): /example-0/i2c_node/gpio-expander@58:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dt.yaml: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dt.yaml: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dts:23.30-34.15: Warning (avoid_default_addr_size): /example-0/i2c_node/gpio-expander@58: Relying on default #address-cells value
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dts:23.30-34.15: Warning (avoid_default_addr_size): /example-0/i2c_node/gpio-expander@58: Relying on default #size-cells value
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.example.dt.yaml: Warning (unique_unit_address): Failed prerequisite 'avoid_default_addr_size'

See https://patchwork.ozlabs.org/patch/1424757

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.
AngeloGioacchino Del Regno Jan. 13, 2021, 12:30 p.m. UTC | #2
Il 13/01/21 03:41, Rob Herring ha scritto:
> On Mon, Jan 11, 2021 at 07:29:28PM +0100, AngeloGioacchino Del Regno wrote:

>> Add bindings for the Awinic AW9523/AW9523B I2C GPIO Expander driver.

>>

>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

>> ---

>>   .../pinctrl/awinic,aw9523-pinctrl.yaml        | 112 ++++++++++++++++++

>>   1 file changed, 112 insertions(+)

>>   create mode 100644 Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

>>

>> diff --git a/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

>> new file mode 100644

>> index 000000000000..a705c05bb5a2

>> --- /dev/null

>> +++ b/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

>> @@ -0,0 +1,112 @@

>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

>> +%YAML 1.2

>> +---

>> +$id: http://devicetree.org/schemas/pinctrl/awinic,aw9523-pinctrl.yaml#

>> +$schema: http://devicetree.org/meta-schemas/core.yaml#

>> +

>> +title: Awinic AW9523/AW9523B I2C GPIO Expander

>> +

>> +maintainers:

>> +  - AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

>> +

>> +description: |

>> +  The Awinic AW9523/AW9523B I2C GPIO Expander featuring 16 multi-function

>> +  I/O, 256 steps PWM mode and interrupt support.

>> +

>> +properties:

>> +  compatible:

>> +    const: awinic,aw9523-pinctrl

>> +

>> +  reg:

>> +    maxItems: 1

>> +

>> +  '#gpio-cells':

>> +    description: |

>> +      Specifying the pin number and flags, as defined in

>> +      include/dt-bindings/gpio/gpio.h

>> +    const: 2

>> +

>> +  gpio-controller: true

>> +

>> +  gpio-ranges:

>> +    maxItems: 1

>> +

>> +  interrupt-controller: true

>> +

>> +  interrupts:

>> +    maxItems: 1

>> +    description: Specifies the INTN pin IRQ.

>> +

>> +  '#interrupt-cells':

>> +    description:

>> +      Specifies the PIN numbers and Flags, as defined in defined in

>> +      include/dt-bindings/interrupt-controller/irq.h

>> +    const: 2

>> +

>> +#PIN CONFIGURATION NODES

>> +patternProperties:

>> +  '^.*$':

>> +    if:

>> +      type: object

>> +      $ref: "/schemas/pinctrl/pincfg-node.yaml"

>> +    then:

> 

> I wish people would stop copying this if/then hack...

> 

> For new bindings, just name your nodes something sensible you can match

> on like '-pins$'.

> 

I always check the newest available yaml that I can find in the same 
folder before writing mine... in this case, it was sm8250-pinctrl.yaml
and I thought that this was the accepted way, since.. that's.. the 
newest one.

By the way, I've fixed it now. I'll send V4 in the evening!
Thank you!

>> +      properties:

>> +        pins:

>> +          description:

>> +            List of gpio pins affected by the properties specified in

>> +            this subnode.

>> +          items:

>> +            pattern: "^gpio([0-9]|1[0-5])$"

>> +          minItems: 1

>> +          maxItems: 16

>> +

>> +        function:

>> +          description:

>> +            Specify the alternative function to be configured for the

>> +            specified pins.

>> +

>> +          enum: [ gpio, pwm ]

>> +

>> +        bias-disable: true

>> +        bias-pull-down: true

>> +        bias-pull-up: true

>> +        drive-open-drain: true

>> +        drive-push-pull: true

>> +        input-enable: true

>> +        output-high: true

>> +        output-low: true

>> +

>> +      required:

>> +        - pins

>> +        - function

>> +

>> +      additionalProperties: false

>> +

>> +required:

>> +  - compatible

>> +  - reg

>> +  - gpio-controller

>> +  - '#gpio-cells'

>> +  - gpio-ranges

>> +

>> +additionalProperties: false

>> +

>> +examples:

>> +  - |

>> +    #include <dt-bindings/gpio/gpio.h>

>> +    #include <dt-bindings/interrupt-controller/irq.h>

>> +

>> +    i2c_node {

>> +        gpio-expander@58 {

>> +                compatible = "awinic,aw9523-pinctrl";

>> +                reg = <0x58>;

>> +                interrupt-parent = <&tlmm>;

>> +                interrupts = <50 IRQ_TYPE_EDGE_FALLING>;

>> +                gpio-controller;

>> +                #gpio-cells = <2>;

>> +                gpio-ranges = <&tlmm 0 0 16>;

>> +                interrupt-controller;

>> +                #interrupt-cells = <2>;

>> +                reset-gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>;

>> +        };

>> +    };

>> -- 

>> 2.29.2

>>
Rob Herring Jan. 14, 2021, 10:42 p.m. UTC | #3
On Wed, Jan 13, 2021 at 6:30 AM AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org> wrote:
>

> Il 13/01/21 03:41, Rob Herring ha scritto:

> > On Mon, Jan 11, 2021 at 07:29:28PM +0100, AngeloGioacchino Del Regno wrote:

> >> Add bindings for the Awinic AW9523/AW9523B I2C GPIO Expander driver.

> >>

> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> >> ---

> >>   .../pinctrl/awinic,aw9523-pinctrl.yaml        | 112 ++++++++++++++++++

> >>   1 file changed, 112 insertions(+)

> >>   create mode 100644 Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

> >>

> >> diff --git a/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

> >> new file mode 100644

> >> index 000000000000..a705c05bb5a2

> >> --- /dev/null

> >> +++ b/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml

> >> @@ -0,0 +1,112 @@

> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> >> +%YAML 1.2

> >> +---

> >> +$id: http://devicetree.org/schemas/pinctrl/awinic,aw9523-pinctrl.yaml#

> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> >> +

> >> +title: Awinic AW9523/AW9523B I2C GPIO Expander

> >> +

> >> +maintainers:

> >> +  - AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> >> +

> >> +description: |

> >> +  The Awinic AW9523/AW9523B I2C GPIO Expander featuring 16 multi-function

> >> +  I/O, 256 steps PWM mode and interrupt support.

> >> +

> >> +properties:

> >> +  compatible:

> >> +    const: awinic,aw9523-pinctrl

> >> +

> >> +  reg:

> >> +    maxItems: 1

> >> +

> >> +  '#gpio-cells':

> >> +    description: |

> >> +      Specifying the pin number and flags, as defined in

> >> +      include/dt-bindings/gpio/gpio.h

> >> +    const: 2

> >> +

> >> +  gpio-controller: true

> >> +

> >> +  gpio-ranges:

> >> +    maxItems: 1

> >> +

> >> +  interrupt-controller: true

> >> +

> >> +  interrupts:

> >> +    maxItems: 1

> >> +    description: Specifies the INTN pin IRQ.

> >> +

> >> +  '#interrupt-cells':

> >> +    description:

> >> +      Specifies the PIN numbers and Flags, as defined in defined in

> >> +      include/dt-bindings/interrupt-controller/irq.h

> >> +    const: 2

> >> +

> >> +#PIN CONFIGURATION NODES

> >> +patternProperties:

> >> +  '^.*$':

> >> +    if:

> >> +      type: object

> >> +      $ref: "/schemas/pinctrl/pincfg-node.yaml"

> >> +    then:

> >

> > I wish people would stop copying this if/then hack...

> >

> > For new bindings, just name your nodes something sensible you can match

> > on like '-pins$'.

> >

> I always check the newest available yaml that I can find in the same

> folder before writing mine... in this case, it was sm8250-pinctrl.yaml

> and I thought that this was the accepted way, since.. that's.. the

> newest one.


Normally, that's a good strategy. Unfortunately, this one went in
without my review. There was supposed to be a follow-up to fix some of
the issues, but seems that never happened.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml
new file mode 100644
index 000000000000..a705c05bb5a2
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml
@@ -0,0 +1,112 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/awinic,aw9523-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic AW9523/AW9523B I2C GPIO Expander
+
+maintainers:
+  - AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
+
+description: |
+  The Awinic AW9523/AW9523B I2C GPIO Expander featuring 16 multi-function
+  I/O, 256 steps PWM mode and interrupt support.
+
+properties:
+  compatible:
+    const: awinic,aw9523-pinctrl
+
+  reg:
+    maxItems: 1
+
+  '#gpio-cells':
+    description: |
+      Specifying the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  gpio-controller: true
+
+  gpio-ranges:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  interrupts:
+    maxItems: 1
+    description: Specifies the INTN pin IRQ.
+
+  '#interrupt-cells':
+    description:
+      Specifies the PIN numbers and Flags, as defined in defined in
+      include/dt-bindings/interrupt-controller/irq.h
+    const: 2
+
+#PIN CONFIGURATION NODES
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+      $ref: "/schemas/pinctrl/pincfg-node.yaml"
+    then:
+      properties:
+        pins:
+          description:
+            List of gpio pins affected by the properties specified in
+            this subnode.
+          items:
+            pattern: "^gpio([0-9]|1[0-5])$"
+          minItems: 1
+          maxItems: 16
+
+        function:
+          description:
+            Specify the alternative function to be configured for the
+            specified pins.
+
+          enum: [ gpio, pwm ]
+
+        bias-disable: true
+        bias-pull-down: true
+        bias-pull-up: true
+        drive-open-drain: true
+        drive-push-pull: true
+        input-enable: true
+        output-high: true
+        output-low: true
+
+      required:
+        - pins
+        - function
+
+      additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - gpio-controller
+  - '#gpio-cells'
+  - gpio-ranges
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c_node {
+        gpio-expander@58 {
+                compatible = "awinic,aw9523-pinctrl";
+                reg = <0x58>;
+                interrupt-parent = <&tlmm>;
+                interrupts = <50 IRQ_TYPE_EDGE_FALLING>;
+                gpio-controller;
+                #gpio-cells = <2>;
+                gpio-ranges = <&tlmm 0 0 16>;
+                interrupt-controller;
+                #interrupt-cells = <2>;
+                reset-gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>;
+        };
+    };