Re: [PATCH RFC] dt-bindings: pinctrl: sh-pfc: Convert to json-schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rob,

On Thu, Apr 30, 2020 at 4:32 AM Rob Herring <robh@xxxxxxxxxx> wrote:
> On Fri, Apr 17, 2020 at 04:09:20PM +0200, Geert Uytterhoeven wrote:
> > Convert the Renesas Pin Function Controller (PFC) Device Tree binding
> > documentation to json-schema.
> >
> > Document missing properties.
> > Drop deprecated and obsolete #gpio-range-cells property.
> > Update the example to match reality.
> > Drop consumer examples, as they do not belong here.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> > ---
> > How to describe that pin configuration nodes can have subnodes?
> > E.g.
> >
> >     arch/arm/boot/dts/sh73a0-kzm9g.dt.yaml: pin-controller@e6050000: mmc: Additional properties are not allowed ('cfg', 'mux' were unexpected)
>
> I shouldn't tell you so no one does this again...
>
> I think you want something like this assuming you have either
> grandchildren or properties, but not both in the child nodes:
>
> patternProperties:
>   ".*":
>     if:
>       type: object
>     then:
>       oneOf:
>         - allOf:
>             - $ref: pincfg-node.yaml#
>             - $ref: pinmux-node.yaml#
>           ...
>         - patternProperties:
>             ".*":
>               type: object
>               allOf:
>                 - $ref: pincfg-node.yaml#
>                 - $ref: pinmux-node.yaml#

Thanks, sounds sane!
As there are phandles pointing to the child node, I do need an explicit
phandle property in the child node...

> If you did have a mixture, then you'd need the same if/then construct.

... so I have a mixture, and do need the if/then construct.
However, that gives me "is valid under each of" errors for all  child nodes
of sh-pfc nodes.

As both child and grandchild do not have any required properties, I
tried adding some, but that didn't help.

Do you have a clue? For reference, this is what I ended up with:

patternProperties:
  "^.*$":
    if:
      type: object
    then:
      oneOf:
        - allOf:
            - $ref: pincfg-node.yaml#
            - $ref: pinmux-node.yaml#
          description:
            Pinctrl node's client devices use subnodes for desired pin
            configuration.
            Client device subnodes use below standard properties.

          properties:
            phandle: true
            pins: true
            groups: true
            function: true
            bias-disable: true
            bias-pull-down: true
            bias-pull-up: true
            drive-strength:
              enum: [ 3, 6, 9, 12, 15, 18, 21, 24 ] # Superset of
supported values
            power-source:
              enum: [ 1800, 3300 ]
            gpio-hog: true
            gpios: true
            input: true
            output-high: true
            output-low: true

          additionalProperties: false

        - properties:
            phandle: true

          patternProperties:
            "^.*$":
              if:
                type: object
              then:
                allOf:
                  - $ref: pincfg-node.yaml#
                  - $ref: pinmux-node.yaml#
                description:
                  Pinctrl node's client devices use subnodes for desired pin
                  configuration.
                  Client device subnodes use below standard properties.

                properties:
                  pins: true
                  groups: true
                  function: true
                  bias-disable: true
                  bias-pull-down: true
                  bias-pull-up: true
                  drive-strength:
                    enum: [ 3, 6, 9, 12, 15, 18, 21, 24 ] # Superset
of supported values
                  power-source:
                    enum: [ 1800, 3300 ]
                  gpio-hog: true
                  gpios: true
                  input: true
                  output-high: true
                  output-low: true

                additionalProperties: false

          additionalProperties: false

> Now it probably ends up that the 'allOf' and everything else with it are
> duplicated. If so you can do:
>
> definitions:
>   pin-nodes:
>     allOf:
>     ...
>
> And use '$ref: #/definitions/pin-nodes' where you need it.
>
> That probably is not going to work with the fixups the tooling does, but
> we could fix that.

Obviously I haven't tried this part yet, but I'll keep it in mind.
Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux