devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* yaml schema and sub-nodes with vendor prefixes
@ 2020-09-21 10:26 Lars-Peter Clausen
  2020-10-06 20:19 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2020-09-21 10:26 UTC (permalink / raw)
  To: Rob Herring, Jonathan Cameron, linux-iio, devicetree

Hi,

I'm trying to convert Xilinx XADC devicetree bindings[1] description to 
yaml format. And I'm running into issue with describing a sub-node with 
a vendor prefix.

A typical devicetree entry for the XADC looks like

     xadc@43200000 {
         compatible = "xlnx,axi-xadc-1.00.a";

         xlnx,channels {
             #address-cells = <1>;
             #size-cells = <0>;
             channel@0 {
                 reg = <0>;
                 xlnx,bipolar;
             };
         };
     };

So there is the 'xlnx,channels' sub-node which contains a set of other 
nodes which represent the individual channels.

The way I'm trying to describe it in the yaml file is like

  xlnx,channels:
     description: Node containing all the channel nodes
     type: object
     properties:
       '#address-cells':
          const: 1
       '#size-cells':
          const: 0

     patternProperties:
       "^channel@([0-9]|1[0-6])$":
         type: object
         properties:
           reg:
             description: ...
           xlnx,bipolar:
             description: If set the channel is used in bipolar mode.
             type: boolean
         required:
           - reg
         additionalProperties: false

     required:
       - '#address-cells'
       - '#size-cells'
     additionalProperties: false

This now fails validation, presumably because there is no match in 
meta-schemas/vendor-props.yaml. If I drop the vendor prefix from the 
property name validation passes. I can also make validation pass by 
adding an arbitrary $ref property, but there is no 'node' type in 
types.yaml.

What's the best way to describe a node with a vendor prefix?

Thanks,

- Lars

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/iio/adc/xilinx-xadc.txt


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

* Re: yaml schema and sub-nodes with vendor prefixes
  2020-09-21 10:26 yaml schema and sub-nodes with vendor prefixes Lars-Peter Clausen
@ 2020-10-06 20:19 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2020-10-06 20:19 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio, devicetree

On Mon, Sep 21, 2020 at 5:53 AM Lars-Peter Clausen <lars@metafoo.de> wrote:
>
> Hi,
>
> I'm trying to convert Xilinx XADC devicetree bindings[1] description to
> yaml format. And I'm running into issue with describing a sub-node with
> a vendor prefix.
>
> A typical devicetree entry for the XADC looks like
>
>      xadc@43200000 {
>          compatible = "xlnx,axi-xadc-1.00.a";
>
>          xlnx,channels {
>              #address-cells = <1>;
>              #size-cells = <0>;
>              channel@0 {
>                  reg = <0>;
>                  xlnx,bipolar;
>              };
>          };
>      };
>
> So there is the 'xlnx,channels' sub-node which contains a set of other
> nodes which represent the individual channels.
>
> The way I'm trying to describe it in the yaml file is like
>
>   xlnx,channels:
>      description: Node containing all the channel nodes
>      type: object
>      properties:
>        '#address-cells':
>           const: 1
>        '#size-cells':
>           const: 0
>
>      patternProperties:
>        "^channel@([0-9]|1[0-6])$":
>          type: object
>          properties:
>            reg:
>              description: ...
>            xlnx,bipolar:
>              description: If set the channel is used in bipolar mode.
>              type: boolean
>          required:
>            - reg
>          additionalProperties: false
>
>      required:
>        - '#address-cells'
>        - '#size-cells'
>      additionalProperties: false
>
> This now fails validation, presumably because there is no match in
> meta-schemas/vendor-props.yaml. If I drop the vendor prefix from the
> property name validation passes. I can also make validation pass by
> adding an arbitrary $ref property, but there is no 'node' type in
> types.yaml.
>
> What's the best way to describe a node with a vendor prefix?

Don't. Update the node name. Given there's only 1 child node, the
driver shouldn't really need to care what it called.

Rob

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

end of thread, other threads:[~2020-10-06 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 10:26 yaml schema and sub-nodes with vendor prefixes Lars-Peter Clausen
2020-10-06 20:19 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).