diff mbox series

[05/10] dt-bindings: gpio: Add AXP192 GPIO bindings

Message ID 20220603135714.12007-6-aidanmacdonald.0x0@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series Add support for AXP192 PMIC | expand

Commit Message

Aidan MacDonald June 3, 2022, 1:57 p.m. UTC
The AXP192 PMIC is different enough from the PMICs supported by
the AXP20x GPIO driver to warrant a separate driver. The AXP192
driver also supports interrupts and pinconf settings.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
---
 .../bindings/gpio/x-powers,axp192-gpio.yaml   | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml

Comments

Rob Herring (Arm) June 5, 2022, 10:55 p.m. UTC | #1
On Fri, Jun 03, 2022 at 02:57:09PM +0100, Aidan MacDonald wrote:
> The AXP192 PMIC is different enough from the PMICs supported by
> the AXP20x GPIO driver to warrant a separate driver. The AXP192
> driver also supports interrupts and pinconf settings.
> 
> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
> ---
>  .../bindings/gpio/x-powers,axp192-gpio.yaml   | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
> 
> diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
> new file mode 100644
> index 000000000000..7a985640ade8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
> @@ -0,0 +1,59 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: X-Powers AXP192 GPIO Device Tree Bindings
> +
> +maintainers:
> +  - Chen-Yu Tsai <wens@csie.org>
> +
> +properties:
> +  "#gpio-cells":
> +    const: 2
> +    description: >
> +      The first cell is the pin number and the second is the GPIO flags.
> +
> +  compatible:
> +    oneOf:
> +      - enum:

No need for 'oneOf' with only 1 entry.

> +          - x-powers,axp192-gpio
> +
> +  gpio-controller: true
> +
> +patternProperties:
> +  "^.*-pins?$":

You can omit '^.*'

Why does 's' need to be optional?

> +    $ref: /schemas/pinctrl/pinmux-node.yaml#
> +
> +    properties:
> +      pins:
> +        items:
> +          enum:
> +            - GPIO0
> +            - GPIO1
> +            - GPIO2
> +            - GPIO3
> +            - GPIO4
> +            - N_RSTO
> +
> +      function:
> +        enum:
> +          - output
> +          - input
> +          - ldo
> +          - pwm
> +          - adc
> +          - low_output
> +          - floating
> +          - ext_chg_ctl
> +          - ldo_status
> +
> +required:
> +  - compatible
> +  - "#gpio-cells"
> +  - gpio-controller
> +
> +additionalProperties: false
> +
> +...
> -- 
> 2.35.1
> 
>
Aidan MacDonald June 7, 2022, 10:34 a.m. UTC | #2
Rob Herring <robh@kernel.org> writes:

> On Fri, Jun 03, 2022 at 02:57:09PM +0100, Aidan MacDonald wrote:
>> The AXP192 PMIC is different enough from the PMICs supported by
>> the AXP20x GPIO driver to warrant a separate driver. The AXP192
>> driver also supports interrupts and pinconf settings.
>> 
>> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
>> ---
>>  .../bindings/gpio/x-powers,axp192-gpio.yaml   | 59 +++++++++++++++++++
>>  1 file changed, 59 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> 
>> diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> new file mode 100644
>> index 000000000000..7a985640ade8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> @@ -0,0 +1,59 @@
>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: X-Powers AXP192 GPIO Device Tree Bindings
>> +
>> +maintainers:
>> +  - Chen-Yu Tsai <wens@csie.org>
>> +
>> +properties:
>> +  "#gpio-cells":
>> +    const: 2
>> +    description: >
>> +      The first cell is the pin number and the second is the GPIO flags.
>> +
>> +  compatible:
>> +    oneOf:
>> +      - enum:
>
> No need for 'oneOf' with only 1 entry.
>

Got it.

>> +          - x-powers,axp192-gpio
>> +
>> +  gpio-controller: true
>> +
>> +patternProperties:
>> +  "^.*-pins?$":
>
> You can omit '^.*'
>
> Why does 's' need to be optional?
>

TBH I just copied this from x-powers,axp209-gpio.yaml. A similar pattern
is used in a few other bindings, eg. allwinner,sun4i-a10-pinctrl.yaml.
I guess it's to allow the node names to sound more natural when there's
only one pin.

I am going to send a v2 with '-pins?$' but if you would prefer to have
'-pins$' that's fine. I don't mind either way.

Regards,
Aidan

>> +    $ref: /schemas/pinctrl/pinmux-node.yaml#
>> +
>> +    properties:
>> +      pins:
>> +        items:
>> +          enum:
>> +            - GPIO0
>> +            - GPIO1
>> +            - GPIO2
>> +            - GPIO3
>> +            - GPIO4
>> +            - N_RSTO
>> +
>> +      function:
>> +        enum:
>> +          - output
>> +          - input
>> +          - ldo
>> +          - pwm
>> +          - adc
>> +          - low_output
>> +          - floating
>> +          - ext_chg_ctl
>> +          - ldo_status
>> +
>> +required:
>> +  - compatible
>> +  - "#gpio-cells"
>> +  - gpio-controller
>> +
>> +additionalProperties: false
>> +
>> +...
>> -- 
>> 2.35.1
>> 
>>
Rob Herring (Arm) June 7, 2022, 3:17 p.m. UTC | #3
On Tue, Jun 07, 2022 at 11:34:19AM +0100, Aidan MacDonald wrote:
> 
> Rob Herring <robh@kernel.org> writes:
> 
> > On Fri, Jun 03, 2022 at 02:57:09PM +0100, Aidan MacDonald wrote:
> >> The AXP192 PMIC is different enough from the PMICs supported by
> >> the AXP20x GPIO driver to warrant a separate driver. The AXP192
> >> driver also supports interrupts and pinconf settings.
> >> 
> >> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
> >> ---
> >>  .../bindings/gpio/x-powers,axp192-gpio.yaml   | 59 +++++++++++++++++++
> >>  1 file changed, 59 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
> >> 
> >> diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
> >> new file mode 100644
> >> index 000000000000..7a985640ade8
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
> >> @@ -0,0 +1,59 @@
> >> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> >> +%YAML 1.2
> >> +---
> >> +$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#"
> >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> >> +
> >> +title: X-Powers AXP192 GPIO Device Tree Bindings
> >> +
> >> +maintainers:
> >> +  - Chen-Yu Tsai <wens@csie.org>
> >> +
> >> +properties:
> >> +  "#gpio-cells":
> >> +    const: 2
> >> +    description: >
> >> +      The first cell is the pin number and the second is the GPIO flags.
> >> +
> >> +  compatible:
> >> +    oneOf:
> >> +      - enum:
> >
> > No need for 'oneOf' with only 1 entry.
> >
> 
> Got it.
> 
> >> +          - x-powers,axp192-gpio
> >> +
> >> +  gpio-controller: true
> >> +
> >> +patternProperties:
> >> +  "^.*-pins?$":
> >
> > You can omit '^.*'
> >
> > Why does 's' need to be optional?
> >
> 
> TBH I just copied this from x-powers,axp209-gpio.yaml. A similar pattern
> is used in a few other bindings, eg. allwinner,sun4i-a10-pinctrl.yaml.
> I guess it's to allow the node names to sound more natural when there's
> only one pin.

Those cases were for compatibility with existing users. That shouldn't 
be the case here.

Rob
Aidan MacDonald June 7, 2022, 3:40 p.m. UTC | #4
Rob Herring <robh@kernel.org> writes:

> On Tue, Jun 07, 2022 at 11:34:19AM +0100, Aidan MacDonald wrote:
>> 
>> Rob Herring <robh@kernel.org> writes:
>> 
>> > On Fri, Jun 03, 2022 at 02:57:09PM +0100, Aidan MacDonald wrote:
>> >> The AXP192 PMIC is different enough from the PMICs supported by
>> >> the AXP20x GPIO driver to warrant a separate driver. The AXP192
>> >> driver also supports interrupts and pinconf settings.
>> >> 
>> >> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
>> >> ---
>> >>  .../bindings/gpio/x-powers,axp192-gpio.yaml   | 59 +++++++++++++++++++
>> >>  1 file changed, 59 insertions(+)
>> >>  create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> >> 
>> >> diff --git
>> >> a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> >> b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> >> new file mode 100644
>> >> index 000000000000..7a985640ade8
>> >> --- /dev/null
>> >> +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
>> >> @@ -0,0 +1,59 @@
>> >> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> >> +%YAML 1.2
>> >> +---
>> >> +$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#"
>> >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> >> +
>> >> +title: X-Powers AXP192 GPIO Device Tree Bindings
>> >> +
>> >> +maintainers:
>> >> +  - Chen-Yu Tsai <wens@csie.org>
>> >> +
>> >> +properties:
>> >> +  "#gpio-cells":
>> >> +    const: 2
>> >> +    description: >
>> >> +      The first cell is the pin number and the second is the GPIO flags.
>> >> +
>> >> +  compatible:
>> >> +    oneOf:
>> >> +      - enum:
>> >
>> > No need for 'oneOf' with only 1 entry.
>> >
>> 
>> Got it.
>> 
>> >> +          - x-powers,axp192-gpio
>> >> +
>> >> +  gpio-controller: true
>> >> +
>> >> +patternProperties:
>> >> +  "^.*-pins?$":
>> >
>> > You can omit '^.*'
>> >
>> > Why does 's' need to be optional?
>> >
>> 
>> TBH I just copied this from x-powers,axp209-gpio.yaml. A similar pattern
>> is used in a few other bindings, eg. allwinner,sun4i-a10-pinctrl.yaml.
>> I guess it's to allow the node names to sound more natural when there's
>> only one pin.
>
> Those cases were for compatibility with existing users. That shouldn't 
> be the case here.
>
> Rob

OK, thanks for the clarification. I will use '-pins$' then.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
new file mode 100644
index 000000000000..7a985640ade8
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml
@@ -0,0 +1,59 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: X-Powers AXP192 GPIO Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+
+properties:
+  "#gpio-cells":
+    const: 2
+    description: >
+      The first cell is the pin number and the second is the GPIO flags.
+
+  compatible:
+    oneOf:
+      - enum:
+          - x-powers,axp192-gpio
+
+  gpio-controller: true
+
+patternProperties:
+  "^.*-pins?$":
+    $ref: /schemas/pinctrl/pinmux-node.yaml#
+
+    properties:
+      pins:
+        items:
+          enum:
+            - GPIO0
+            - GPIO1
+            - GPIO2
+            - GPIO3
+            - GPIO4
+            - N_RSTO
+
+      function:
+        enum:
+          - output
+          - input
+          - ldo
+          - pwm
+          - adc
+          - low_output
+          - floating
+          - ext_chg_ctl
+          - ldo_status
+
+required:
+  - compatible
+  - "#gpio-cells"
+  - gpio-controller
+
+additionalProperties: false
+
+...