~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/devicetree/bindings/example-schema.yaml

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/devicetree/bindings/example-schema.yaml (Version linux-6.12-rc7) and /Documentation/devicetree/bindings/example-schema.yaml (Version linux-6.4.16)


  1 # SPDX-License-Identifier: (GPL-2.0-only OR BS      1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2 # Copyright 2018 Linaro Ltd.                        2 # Copyright 2018 Linaro Ltd.
  3 %YAML 1.2                                           3 %YAML 1.2
  4 ---                                                 4 ---
  5 # All the top-level keys are standard json-sch      5 # All the top-level keys are standard json-schema keywords except for
  6 # 'maintainers' and 'select'                        6 # 'maintainers' and 'select'
  7                                                     7 
  8 # $id is a unique identifier based on the file      8 # $id is a unique identifier based on the filename. There may or may not be a
  9 # file present at the URL.                          9 # file present at the URL.
 10 $id: http://devicetree.org/schemas/example-sch     10 $id: http://devicetree.org/schemas/example-schema.yaml#
 11 # $schema is the meta-schema this schema shoul     11 # $schema is the meta-schema this schema should be validated with.
 12 $schema: http://devicetree.org/meta-schemas/co     12 $schema: http://devicetree.org/meta-schemas/core.yaml#
 13                                                    13 
 14 title: An Example Device                           14 title: An Example Device
 15                                                    15 
 16 maintainers:                                       16 maintainers:
 17   - Rob Herring <robh@kernel.org>                   17   - Rob Herring <robh@kernel.org>
 18                                                    18 
 19 description: |                                     19 description: |
 20   A more detailed multi-line description of th     20   A more detailed multi-line description of the binding.
 21                                                    21 
 22   Details about the hardware device and any li     22   Details about the hardware device and any links to datasheets can go here.
 23                                                    23 
 24   Literal blocks are marked with the '|' at th     24   Literal blocks are marked with the '|' at the beginning. The end is marked by
 25   indentation less than the first line of the      25   indentation less than the first line of the literal block. Lines also cannot
 26   begin with a tab character.                      26   begin with a tab character.
 27                                                    27 
 28 select: false                                      28 select: false
 29   # 'select' is a schema applied to a DT node      29   # 'select' is a schema applied to a DT node to determine if this binding
 30   # schema should be applied to the node. It i     30   # schema should be applied to the node. It is optional and by default the
 31   # possible compatible strings are extracted      31   # possible compatible strings are extracted and used to match.
 32                                                    32 
 33   # In this case, a 'false' schema will never      33   # In this case, a 'false' schema will never match.
 34                                                    34 
 35 properties:                                        35 properties:
 36   # A dictionary of DT properties for this bin     36   # A dictionary of DT properties for this binding schema
 37   compatible:                                      37   compatible:
 38     # More complicated schema can use oneOf (X     38     # More complicated schema can use oneOf (XOR), anyOf (OR), or allOf (AND)
 39     # to handle different conditions.              39     # to handle different conditions.
 40     # In this case, it's needed to handle a va     40     # In this case, it's needed to handle a variable number of values as there
 41     # isn't another way to express a constrain     41     # isn't another way to express a constraint of the last string value.
 42     # The boolean schema must be a list of sch     42     # The boolean schema must be a list of schemas.
 43     oneOf:                                         43     oneOf:
 44       - items:                                     44       - items:
 45           # items is a list of possible values     45           # items is a list of possible values for the property. The number of
 46           # values is determined by the number     46           # values is determined by the number of elements in the list.
 47           # Order in lists is significant, ord     47           # Order in lists is significant, order in dicts is not
 48           # Must be one of the 1st enums follo     48           # Must be one of the 1st enums followed by the 2nd enum
 49           #                                        49           #
 50           # Each element in items should be 'e     50           # Each element in items should be 'enum' or 'const'
 51           - enum:                                  51           - enum:
 52               - vendor,soc4-ip                     52               - vendor,soc4-ip
 53               - vendor,soc3-ip                     53               - vendor,soc3-ip
 54               - vendor,soc2-ip                     54               - vendor,soc2-ip
 55           - const: vendor,soc1-ip              !!  55           - enum:
                                                   >>  56               - vendor,soc1-ip
 56         # additionalItems being false is impli     57         # additionalItems being false is implied
 57         # minItems/maxItems equal to 2 is impl     58         # minItems/maxItems equal to 2 is implied
 58       - items:                                     59       - items:
 59           # 'const' is just a special case of      60           # 'const' is just a special case of an enum with a single possible value
 60           - const: vendor,soc1-ip                  61           - const: vendor,soc1-ip
 61                                                    62 
 62   reg:                                             63   reg:
 63     # The core schema already checks that reg      64     # The core schema already checks that reg values are numbers, so device
 64     # specific schema don't need to do those c     65     # specific schema don't need to do those checks.
 65     # The description of each element defines      66     # The description of each element defines the order and implicitly defines
 66     # the number of reg entries.                   67     # the number of reg entries.
 67     items:                                         68     items:
 68       - description: core registers                69       - description: core registers
 69       - description: aux registers                 70       - description: aux registers
 70     # minItems/maxItems equal to 2 is implied      71     # minItems/maxItems equal to 2 is implied
 71                                                    72 
 72   reg-names:                                       73   reg-names:
 73     # The core schema enforces this (*-names)      74     # The core schema enforces this (*-names) is a string array
 74     items:                                         75     items:
 75       - const: core                                76       - const: core
 76       - const: aux                                 77       - const: aux
 77                                                    78 
 78   clocks:                                          79   clocks:
 79     # Cases that have only a single entry just     80     # Cases that have only a single entry just need to express that with maxItems
 80     maxItems: 1                                    81     maxItems: 1
 81     description: bus clock. A description is o     82     description: bus clock. A description is only needed for a single item if
 82       there's something unique to add.             83       there's something unique to add.
 83       The items should have a fixed order, so      84       The items should have a fixed order, so pattern matching names are
 84       discouraged.                                 85       discouraged.
 85                                                    86 
 86   clock-names:                                     87   clock-names:
 87     # For single-entry lists in clocks, resets << 
 88     # bring any value, especially if they copy << 
 89     # just skip the xxx-names.                 << 
 90     items:                                         88     items:
 91       - const: bus                                 89       - const: bus
 92                                                    90 
 93   interrupts:                                      91   interrupts:
 94     # Either 1 or 2 interrupts can be present      92     # Either 1 or 2 interrupts can be present
 95     minItems: 1                                    93     minItems: 1
 96     items:                                         94     items:
 97       - description: tx or combined interrupt      95       - description: tx or combined interrupt
 98       - description: rx interrupt                  96       - description: rx interrupt
 99     description:                                   97     description:
100       A variable number of interrupts warrants     98       A variable number of interrupts warrants a description of what conditions
101       affect the number of interrupts. Otherwi     99       affect the number of interrupts. Otherwise, descriptions on standard
102       properties are not necessary.               100       properties are not necessary.
103       The items should have a fixed order, so     101       The items should have a fixed order, so pattern matching names are
104       discouraged.                                102       discouraged.
105                                                   103 
106   interrupt-names:                                104   interrupt-names:
107     # minItems must be specified here because     105     # minItems must be specified here because the default would be 2
108     minItems: 1                                   106     minItems: 1
109     items:                                        107     items:
110       - const: tx irq                             108       - const: tx irq
111       - const: rx irq                             109       - const: rx irq
112                                                   110 
113   # Property names starting with '#' must be q    111   # Property names starting with '#' must be quoted
114   '#interrupt-cells':                             112   '#interrupt-cells':
115     # A simple case where the value must alway    113     # A simple case where the value must always be '2'.
116     # The core schema handles that this must b    114     # The core schema handles that this must be a single integer.
117     const: 2                                      115     const: 2
118                                                   116 
119   interrupt-controller: true                      117   interrupt-controller: true
120     # The core checks this is a boolean, so ju    118     # The core checks this is a boolean, so just have to list it here to be
121     # valid for this binding.                     119     # valid for this binding.
122                                                   120 
123   clock-frequency:                                121   clock-frequency:
124     # The type is set in the core schema. Per-    122     # The type is set in the core schema. Per-device schema only need to set
125     # constraints on the possible values.         123     # constraints on the possible values.
126     minimum: 100                                  124     minimum: 100
127     maximum: 400000                               125     maximum: 400000
128     # The value that should be used if the pro    126     # The value that should be used if the property is not present
129     default: 200                                  127     default: 200
130                                                   128 
131   foo-gpios:                                      129   foo-gpios:
132     maxItems: 1                                   130     maxItems: 1
133     description: A connection of the 'foo' gpi    131     description: A connection of the 'foo' gpio line.
134                                                   132 
135   # *-supply is always a single phandle, so no    133   # *-supply is always a single phandle, so nothing more to define.
136   foo-supply: true                                134   foo-supply: true
137                                                   135 
138   # Vendor-specific properties                    136   # Vendor-specific properties
139   #                                               137   #
140   # Vendor-specific properties have slightly d    138   # Vendor-specific properties have slightly different schema requirements than
141   # common properties. They must have at least    139   # common properties. They must have at least a type definition and
142   # 'description'.                                140   # 'description'.
143   vendor,int-property:                            141   vendor,int-property:
144     description: Vendor-specific properties mu    142     description: Vendor-specific properties must have a description
145     $ref: /schemas/types.yaml#/definitions/uin    143     $ref: /schemas/types.yaml#/definitions/uint32
146     enum: [2, 4, 6, 8, 10]                        144     enum: [2, 4, 6, 8, 10]
147                                                   145 
148   vendor,bool-property:                           146   vendor,bool-property:
149     description: Vendor-specific properties mu    147     description: Vendor-specific properties must have a description. Boolean
150       properties are one case where the json-s    148       properties are one case where the json-schema 'type' keyword can be used
151       directly.                                   149       directly.
152     type: boolean                                 150     type: boolean
153                                                   151 
154   vendor,string-array-property:                   152   vendor,string-array-property:
155     description: Vendor-specific properties sh    153     description: Vendor-specific properties should reference a type in the
156       core schema.                                154       core schema.
157     $ref: /schemas/types.yaml#/definitions/str    155     $ref: /schemas/types.yaml#/definitions/string-array
158     items:                                        156     items:
159       - enum: [foo, bar]                          157       - enum: [foo, bar]
160       - enum: [baz, boo]                          158       - enum: [baz, boo]
161                                                   159 
162   vendor,property-in-standard-units-microvolt:    160   vendor,property-in-standard-units-microvolt:
163     description: Vendor-specific properties ha    161     description: Vendor-specific properties having a standard unit suffix
164       don't need a type.                          162       don't need a type.
165     enum: [ 100, 200, 300 ]                       163     enum: [ 100, 200, 300 ]
166                                                   164 
167   vendor,int-array-variable-length-and-constra    165   vendor,int-array-variable-length-and-constrained-values:
168     description: Array might define what type     166     description: Array might define what type of elements might be used (e.g.
169       their range).                               167       their range).
170     $ref: /schemas/types.yaml#/definitions/uin    168     $ref: /schemas/types.yaml#/definitions/uint32-array
171     minItems: 2                                   169     minItems: 2
172     maxItems: 3                                   170     maxItems: 3
173     items:                                        171     items:
174       minimum: 0                                  172       minimum: 0
175       maximum: 8                                  173       maximum: 8
176                                                   174 
177   child-node:                                     175   child-node:
178     description: Child nodes are just another     176     description: Child nodes are just another property from a json-schema
179       perspective.                                177       perspective.
180     type: object  # DT nodes are json objects     178     type: object  # DT nodes are json objects
181     # Child nodes also need additionalProperti    179     # Child nodes also need additionalProperties or unevaluatedProperties
182     additionalProperties: false                   180     additionalProperties: false
183     properties:                                   181     properties:
184       vendor,a-child-node-property:               182       vendor,a-child-node-property:
185         description: Child node properties hav    183         description: Child node properties have all the same schema
186           requirements.                           184           requirements.
187         type: boolean                             185         type: boolean
188                                                   186 
189     required:                                     187     required:
190       - vendor,a-child-node-property              188       - vendor,a-child-node-property
191                                                   189 
192 # Describe the relationship between different     190 # Describe the relationship between different properties
193 dependencies:                                     191 dependencies:
194   # 'vendor,bool-property' is only allowed whe    192   # 'vendor,bool-property' is only allowed when 'vendor,string-array-property'
195   # is present                                    193   # is present
196   vendor,bool-property: [ 'vendor,string-array    194   vendor,bool-property: [ 'vendor,string-array-property' ]
197   # Expressing 2 properties in both orders mea    195   # Expressing 2 properties in both orders means all of the set of properties
198   # must be present or none of them.              196   # must be present or none of them.
199   vendor,string-array-property: [ 'vendor,bool    197   vendor,string-array-property: [ 'vendor,bool-property' ]
200                                                   198 
201 required:                                         199 required:
202   - compatible                                    200   - compatible
203   - reg                                           201   - reg
204   - interrupts                                    202   - interrupts
205   - interrupt-controller                          203   - interrupt-controller
206                                                   204 
207 # if/then schema can be used to handle conditi    205 # if/then schema can be used to handle conditions on a property affecting
208 # another property. A typical case is a specif    206 # another property. A typical case is a specific 'compatible' value changes the
209 # constraints on other properties.                207 # constraints on other properties.
210 #                                                 208 #
211 # For multiple 'if' schema, group them under a    209 # For multiple 'if' schema, group them under an 'allOf'.
212 #                                                 210 #
213 # If the conditionals become too unweldy, then    211 # If the conditionals become too unweldy, then it may be better to just split
214 # the binding into separate schema documents.     212 # the binding into separate schema documents.
215 allOf:                                            213 allOf:
216   - if:                                           214   - if:
217       properties:                                 215       properties:
218         compatible:                               216         compatible:
219           contains:                               217           contains:
220             const: vendor,soc2-ip                 218             const: vendor,soc2-ip
221     then:                                         219     then:
222       required:                                   220       required:
223         - foo-supply                              221         - foo-supply
224     else:                                         222     else:
225       # If otherwise the property is not allow    223       # If otherwise the property is not allowed:
226       properties:                                 224       properties:
227         foo-supply: false                         225         foo-supply: false
228   # Altering schema depending on presence of p    226   # Altering schema depending on presence of properties is usually done by
229   # dependencies (see above), however some adj    227   # dependencies (see above), however some adjustments might require if:
230   - if:                                           228   - if:
231       required:                                   229       required:
232         - vendor,bool-property                    230         - vendor,bool-property
233     then:                                         231     then:
234       properties:                                 232       properties:
235         vendor,int-property:                      233         vendor,int-property:
236           enum: [2, 4, 6]                         234           enum: [2, 4, 6]
237                                                   235 
238 # Ideally, the schema should have this line ot    236 # Ideally, the schema should have this line otherwise any other properties
239 # present are allowed. There's a few common pr    237 # present are allowed. There's a few common properties such as 'status' and
240 # 'pinctrl-*' which are added automatically by    238 # 'pinctrl-*' which are added automatically by the tooling.
241 #                                                 239 #
242 # This can't be used in cases where another sc    240 # This can't be used in cases where another schema is referenced
243 # (i.e. allOf: [{$ref: ...}]).                    241 # (i.e. allOf: [{$ref: ...}]).
244 # If and only if another schema is referenced     242 # If and only if another schema is referenced and arbitrary children nodes can
245 # appear, "unevaluatedProperties: false" could    243 # appear, "unevaluatedProperties: false" could be used.  A typical example is
246 # an I2C controller where no name pattern matc    244 # an I2C controller where no name pattern matching for children can be added.
247 additionalProperties: false                       245 additionalProperties: false
248                                                   246 
249 examples:                                         247 examples:
250   # Examples are now compiled with dtc and val    248   # Examples are now compiled with dtc and validated against the schemas
251   #                                               249   #
252   # Examples have a default #address-cells and    250   # Examples have a default #address-cells and #size-cells value of 1. This can
253   # be overridden or an appropriate parent bus    251   # be overridden or an appropriate parent bus node should be shown (such as on
254   # i2c buses).                                   252   # i2c buses).
255   #                                               253   #
256   # Any includes used have to be explicitly in    254   # Any includes used have to be explicitly included. Use 4-space indentation.
257   - |                                             255   - |
258     node@1000 {                                   256     node@1000 {
259         compatible = "vendor,soc4-ip", "vendor    257         compatible = "vendor,soc4-ip", "vendor,soc1-ip";
260         reg = <0x1000 0x80>,                      258         reg = <0x1000 0x80>,
261               <0x3000 0x80>;                      259               <0x3000 0x80>;
262         reg-names = "core", "aux";                260         reg-names = "core", "aux";
263         interrupts = <10>;                        261         interrupts = <10>;
264         interrupt-controller;                     262         interrupt-controller;
265     };                                            263     };
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php