€•Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ6/translations/zh_CN/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/zh_TW/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/it_IT/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/ja_JP/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/ko_KR/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/pt_BR/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/sp_SP/devicetree/bindings/writing-schema”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒP/var/lib/git/docbuild/linux/Documentation/devicetree/bindings/writing-schema.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ*Writing Devicetree Bindings in json-schema”h]”hŒ*Writing Devicetree Bindings in json-schema”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)”}”(hXDevicetree bindings are written using json-schema vocabulary. Schema files are written in a JSON-compatible subset of YAML. YAML is used instead of JSON as it is considered more human readable and has some advantages such as allowing comments (Prefixed with '#').”h]”hX Devicetree bindings are written using json-schema vocabulary. Schema files are written in a JSON-compatible subset of YAML. YAML is used instead of JSON as it is considered more human readable and has some advantages such as allowing comments (Prefixed with ‘#’).”…””}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´KhhÊh²hubhŞ)”}”(hŒAlso see :ref:`example-schema`.”h]”(hŒ Also see ”…””}”(hhíh²hh³Nh´Nubh)”}”(hŒ:ref:`example-schema`”h]”hŒinline”“”)”}”(hh÷h]”hŒexample-schema”…””}”(hhûh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-ref”eh"]”h$]”h&]”uh1hùhhõubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œ"devicetree/bindings/writing-schema”Œ refdomain”jŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆŒ reftarget”Œexample-schema”uh1hh³hÇh´K hhíubhŒ.”…””}”(hhíh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K hhÊh²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒSchema Contents”h]”hŒSchema Contents”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj$h²hh³hÇh´KubhŞ)”}”(hŒ¿Each schema doc is a structured json-schema which is defined by a set of top-level properties. Generally, there is one binding defined per file. The top-level json-schema properties used are:”h]”hŒ¿Each schema doc is a structured json-schema which is defined by a set of top-level properties. Generally, there is one binding defined per file. The top-level json-schema properties used are:”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´Khj$h²hubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hXa$id A json-schema unique identifier string. The string must be a valid URI typically containing the binding's filename and path. For DT schema, it must begin with "http://devicetree.org/schemas/". The URL is used in constructing references to other files specified in schema "$ref" properties. A $ref value with a leading '/' will have the hostname prepended. A $ref value with only a relative path or filename will be prepended with the hostname and path components of the current schema file's '$id' value. A URL is used even for local files, but there may not actually be files present at those locations. ”h]”(hŒterm”“”)”}”(hŒ$id”h]”hŒ$id”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jNh³hÇh´KhjJubhŒ definition”“”)”}”(hhh]”hŞ)”}”(hX\A json-schema unique identifier string. The string must be a valid URI typically containing the binding's filename and path. For DT schema, it must begin with "http://devicetree.org/schemas/". The URL is used in constructing references to other files specified in schema "$ref" properties. A $ref value with a leading '/' will have the hostname prepended. A $ref value with only a relative path or filename will be prepended with the hostname and path components of the current schema file's '$id' value. A URL is used even for local files, but there may not actually be files present at those locations.”h]”(hŒ¤A json-schema unique identifier string. The string must be a valid URI typically containing the binding’s filename and path. For DT schema, it must begin with “”…””}”(hjch²hh³Nh´NubhŒ reference”“”)”}”(hŒhttp://devicetree.org/schemas/”h]”hŒhttp://devicetree.org/schemas/”…””}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jouh1jkhjcubhX®â€. The URL is used in constructing references to other files specified in schema “$ref†properties. A $ref value with a leading ‘/’ will have the hostname prepended. A $ref value with only a relative path or filename will be prepended with the hostname and path components of the current schema file’s ‘$id’ value. A URL is used even for local files, but there may not actually be files present at those locations.”…””}”(hjch²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´Khj`ubah}”(h]”h ]”h"]”h$]”h&]”uh1j^hjJubeh}”(h]”h ]”h"]”h$]”h&]”uh1jHh³hÇh´KhjEubjI)”}”(hŒ>$schema Indicates the meta-schema the schema file adheres to. ”h]”(jO)”}”(hŒ$schema”h]”hŒ$schema”…””}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jNh³hÇh´Khj’ubj_)”}”(hhh]”hŞ)”}”(hŒ5Indicates the meta-schema the schema file adheres to.”h]”hŒ5Indicates the meta-schema the schema file adheres to.”…””}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´Khj¤ubah}”(h]”h ]”h"]”h$]”h&]”uh1j^hj’ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jHh³hÇh´KhjEh²hubjI)”}”(hŒTtitle A one-line description of the hardware being described in the binding schema. ”h]”(jO)”}”(hŒtitle”h]”hŒtitle”…””}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jNh³hÇh´K"hjÁubj_)”}”(hhh]”hŞ)”}”(hŒMA one-line description of the hardware being described in the binding schema.”h]”hŒMA one-line description of the hardware being described in the binding schema.”…””}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K"hjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1j^hjÁubeh}”(h]”h ]”h"]”h$]”h&]”uh1jHh³hÇh´K"hjEh²hubjI)”}”(hŒjmaintainers A DT specific property. Contains a list of email address(es) for maintainers of this binding. ”h]”(jO)”}”(hŒ maintainers”h]”hŒ maintainers”…””}”(hjôh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jNh³hÇh´K&hjğubj_)”}”(hhh]”hŞ)”}”(hŒ]A DT specific property. Contains a list of email address(es) for maintainers of this binding.”h]”hŒ]A DT specific property. Contains a list of email address(es) for maintainers of this binding.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K%hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j^hjğubeh}”(h]”h ]”h"]”h$]”h&]”uh1jHh³hÇh´K&hjEh²hubjI)”}”(hXÁdescription Optional. A multi-line text block containing any detailed information about this hardware. It should contain things such as what the block or device does, standards the device conforms to, and links to datasheets for more information. The YAML format has several options for defining the formatting of the text block. The options are controlled with indicator characters following the key (e.g. "description: \|"). The minimum formatting needed for a block should be used. The formatting controls can not only affect whether the YAML can be parsed correctly, but are important when the text blocks are rendered to another form. The options are as follows. The default without any indicators is flowed, plain scalar style where single line breaks and leading whitespace are stripped. Paragraphs are delimited by blank lines (i.e. double line break). This style cannot contain ": " in it as it will be interpreted as a key. Any " #" sequence will be interpreted as a comment. There's other restrictions on characters as well. Most restrictions are on what the first character can be. The second style is folded which is indicated by ">" character. In addition to maintaining line breaks on double line breaks, the folded style also maintains leading whitespace beyond indentation of the first line. The line breaks on indented lines are also maintained. The third style is literal which is indicated by "\|" character. The literal style maintains all line breaks and whitespace (beyond indentation of the first line). The above is not a complete description of YAML text blocks. More details on multi-line YAML text blocks can be found online: https://yaml-multiline.info/ https://www.yaml.info/learn/quote.html ”h]”(jO)”}”(hŒ description”h]”hŒ description”…””}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jNh³hÇh´KJhjubj_)”}”(hhh]”(hŞ)”}”(hŒêOptional. A multi-line text block containing any detailed information about this hardware. It should contain things such as what the block or device does, standards the device conforms to, and links to datasheets for more information.”h]”hŒêOptional. A multi-line text block containing any detailed information about this hardware. It should contain things such as what the block or device does, standards the device conforms to, and links to datasheets for more information.”…””}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K)hj1ubhŞ)”}”(hX¤The YAML format has several options for defining the formatting of the text block. The options are controlled with indicator characters following the key (e.g. "description: \|"). The minimum formatting needed for a block should be used. The formatting controls can not only affect whether the YAML can be parsed correctly, but are important when the text blocks are rendered to another form. The options are as follows.”h]”hX¨The YAML format has several options for defining the formatting of the text block. The options are controlled with indicator characters following the key (e.g. “description: |â€). The minimum formatting needed for a block should be used. The formatting controls can not only affect whether the YAML can be parsed correctly, but are important when the text blocks are rendered to another form. The options are as follows.”…””}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K.hj1ubhŞ)”}”(hX©The default without any indicators is flowed, plain scalar style where single line breaks and leading whitespace are stripped. Paragraphs are delimited by blank lines (i.e. double line break). This style cannot contain ": " in it as it will be interpreted as a key. Any " #" sequence will be interpreted as a comment. There's other restrictions on characters as well. Most restrictions are on what the first character can be.”h]”hX³The default without any indicators is flowed, plain scalar style where single line breaks and leading whitespace are stripped. Paragraphs are delimited by blank lines (i.e. double line break). This style cannot contain “: “ in it as it will be interpreted as a key. Any “ #†sequence will be interpreted as a comment. There’s other restrictions on characters as well. Most restrictions are on what the first character can be.”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K5hj1ubhŞ)”}”(hX The second style is folded which is indicated by ">" character. In addition to maintaining line breaks on double line breaks, the folded style also maintains leading whitespace beyond indentation of the first line. The line breaks on indented lines are also maintained.”h]”hXThe second style is folded which is indicated by “>†character. In addition to maintaining line breaks on double line breaks, the folded style also maintains leading whitespace beyond indentation of the first line. The line breaks on indented lines are also maintained.”…””}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´K to get all the validation errors in the binding schema files.”…””}”(hjeh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´KáhjÚh²hubhŞ)”}”(hŒ0It is possible to run both in a single command::”h]”hŒ/It is possible to run both in a single command:”…””}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´KåhjÚh²hubj‹)”}”(hŒ make dt_binding_check dtbs_check”h]”hŒ make dt_binding_check dtbs_check”…””}”hj¥sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jŠh³hÇh´KçhjÚh²hubhŞ)”}”(hXIt is also possible to combine running the above commands with a subset of matching schema files by setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ':'.”h]”(hŒpIt is also possible to combine running the above commands with a subset of matching schema files by setting the ”…””}”(hj³h²hh³Nh´Nubjô)”}”(hŒ``DT_SCHEMA_FILES``”h]”hŒDT_SCHEMA_FILES”…””}”(hj»h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj³ubhŒ variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ‘:’.”…””}”(hj³h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´KéhjÚh²hubj‹)”}”(hŒàmake dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml make dt_binding_check DT_SCHEMA_FILES=/gpio/ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml”h]”hŒàmake dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml make dt_binding_check DT_SCHEMA_FILES=/gpio/ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml”…””}”hjÓsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jŠh³hÇh´KğhjÚh²hubeh}”(h]”Œrunning-checks”ah ]”h"]”Œrunning checks”ah$]”h&]”uh1hÈhjZh²hh³hÇh´KĞubeh}”(h]”Œtesting”ah ]”h"]”Œtesting”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KºubhÉ)”}”(hhh]”(hÎ)”}”(hŒjson-schema Resources”h]”hŒjson-schema Resources”…””}”(hjôh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjñh²hh³hÇh´K÷ubhŞ)”}”(hŒ7`JSON-Schema Specifications `_”h]”(jl)”}”(hjh]”hŒJSON-Schema Specifications”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒJSON-Schema Specifications”Œrefuri”Œhttp://json-schema.org/”uh1jkhjubhŒtarget”“”)”}”(hŒ ”h]”h}”(h]”Œjson-schema-specifications”ah ]”h"]”Œjson-schema specifications”ah$]”h&]”Œrefuri”juh1jŒ referenced”Khjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´Kúhjñh²hubhŞ)”}”(hŒ7`Using JSON Schema Book `_”h]”(jl)”}”(hj/h]”hŒUsing JSON Schema Book”…””}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒUsing JSON Schema Book”jŒhttp://usingjsonschema.com/”uh1jkhj-ubj)”}”(hŒ ”h]”h}”(h]”Œusing-json-schema-book”ah ]”h"]”Œusing json schema book”ah$]”h&]”Œrefuri”j@uh1jj&Khj-ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´Kühjñh²hubj)”}”(hŒ.. _example-schema:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œexample-schema”uh1jh´Kşhjñh²hh³hÇubeh}”(h]”Œjson-schema-resources”ah ]”h"]”Œjson-schema resources”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K÷ubhÉ)”}”(hhh]”(hÎ)”}”(hŒAnnotated Example Schema”h]”hŒAnnotated Example Schema”…””}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjhh²hh³hÇh´MubhŞ)”}”(hŒBAlso available as a separate file: :download:`example-schema.yaml`”h]”(hŒ#Also available as a separate file: ”…””}”(hjyh²hh³Nh´NubhŒdownload_reference”“”)”}”(hŒ:download:`example-schema.yaml`”h]”jô)”}”(hj…h]”hŒexample-schema.yaml”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”(jŒdownload”eh"]”h$]”h&]”uh1jóhjƒubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jŒ refdomain”hŒreftype”j‘Œ refexplicit”‰Œrefwarn”‰jŒexample-schema.yaml”Œfilename”Œ4bf29fbb4b15af5f11533d4e2b6a0e85b/example-schema.yaml”uh1jh³hÇh´Mhjyubeh}”(h]”h ]”h"]”h$]”h&]”uh1hİh³hÇh´Mhjhh²hubj‹)”}”(hX»%# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright 2018 Linaro Ltd. %YAML 1.2 --- # All the top-level keys are standard json-schema keywords except for # 'maintainers' and 'select' # $id is a unique identifier based on the filename. There may or may not be a # file present at the URL. $id: http://devicetree.org/schemas/example-schema.yaml# # $schema is the meta-schema this schema should be validated with. $schema: http://devicetree.org/meta-schemas/core.yaml# title: An Example Device maintainers: - Rob Herring description: | A more detailed multi-line description of the binding. Details about the hardware device and any links to datasheets can go here. Literal blocks are marked with the '|' at the beginning. The end is marked by indentation less than the first line of the literal block. Lines also cannot begin with a tab character. select: false # 'select' is a schema applied to a DT node to determine if this binding # schema should be applied to the node. It is optional and by default the # possible compatible strings are extracted and used to match. # In this case, a 'false' schema will never match. properties: # A dictionary of DT properties for this binding schema compatible: # More complicated schema can use oneOf (XOR), anyOf (OR), or allOf (AND) # to handle different conditions. # In this case, it's needed to handle a variable number of values as there # isn't another way to express a constraint of the last string value. # The boolean schema must be a list of schemas. oneOf: - items: # items is a list of possible values for the property. The number of # values is determined by the number of elements in the list. # Order in lists is significant, order in dicts is not # Must be one of the 1st enums followed by the 2nd enum # # Each element in items should be 'enum' or 'const' - enum: - vendor,soc4-ip - vendor,soc3-ip - vendor,soc2-ip - const: vendor,soc1-ip # additionalItems being false is implied # minItems/maxItems equal to 2 is implied - items: # 'const' is just a special case of an enum with a single possible value - const: vendor,soc1-ip reg: # The core schema already checks that reg values are numbers, so device # specific schema don't need to do those checks. # The description of each element defines the order and implicitly defines # the number of reg entries. items: - description: core registers - description: aux registers # minItems/maxItems equal to 2 is implied reg-names: # The core schema enforces this (*-names) is a string array items: - const: core - const: aux clocks: # Cases that have only a single entry just need to express that with maxItems maxItems: 1 description: bus clock. A description is only needed for a single item if there's something unique to add. The items should have a fixed order, so pattern matching names are discouraged. clock-names: # For single-entry lists in clocks, resets etc., the xxx-names often do not # bring any value, especially if they copy the IP block name. In such case # just skip the xxx-names. items: - const: bus interrupts: # Either 1 or 2 interrupts can be present minItems: 1 items: - description: tx or combined interrupt - description: rx interrupt description: A variable number of interrupts warrants a description of what conditions affect the number of interrupts. Otherwise, descriptions on standard properties are not necessary. The items should have a fixed order, so pattern matching names are discouraged. interrupt-names: # minItems must be specified here because the default would be 2 minItems: 1 items: - const: tx irq - const: rx irq # Property names starting with '#' must be quoted '#interrupt-cells': # A simple case where the value must always be '2'. # The core schema handles that this must be a single integer. const: 2 interrupt-controller: true # The core checks this is a boolean, so just have to list it here to be # valid for this binding. clock-frequency: # The type is set in the core schema. Per-device schema only need to set # constraints on the possible values. minimum: 100 maximum: 400000 # The value that should be used if the property is not present default: 200 foo-gpios: maxItems: 1 description: A connection of the 'foo' gpio line. # *-supply is always a single phandle, so nothing more to define. foo-supply: true # Vendor-specific properties # # Vendor-specific properties have slightly different schema requirements than # common properties. They must have at least a type definition and # 'description'. vendor,int-property: description: Vendor-specific properties must have a description $ref: /schemas/types.yaml#/definitions/uint32 enum: [2, 4, 6, 8, 10] vendor,bool-property: description: Vendor-specific properties must have a description. Boolean properties are one case where the json-schema 'type' keyword can be used directly. type: boolean vendor,string-array-property: description: Vendor-specific properties should reference a type in the core schema. $ref: /schemas/types.yaml#/definitions/string-array items: - enum: [foo, bar] - enum: [baz, boo] vendor,property-in-standard-units-microvolt: description: Vendor-specific properties having a standard unit suffix don't need a type. enum: [ 100, 200, 300 ] vendor,int-array-variable-length-and-constrained-values: description: Array might define what type of elements might be used (e.g. their range). $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 2 maxItems: 3 items: minimum: 0 maximum: 8 child-node: description: Child nodes are just another property from a json-schema perspective. type: object # DT nodes are json objects # Child nodes also need additionalProperties or unevaluatedProperties, where # 'false' should be used in most cases (see 'child-node-with-own-schema' # below). additionalProperties: false properties: vendor,a-child-node-property: description: Child node properties have all the same schema requirements. type: boolean required: - vendor,a-child-node-property child-node-with-own-schema: description: | Child node with their own compatible and device schema which ends in 'additionalProperties: false' or 'unevaluatedProperties: false' can mention only the compatible and use here 'additionalProperties: true'. type: object additionalProperties: true properties: compatible: const: vendor,sub-device # Describe the relationship between different properties dependencies: # 'vendor,bool-property' is only allowed when 'vendor,string-array-property' # is present vendor,bool-property: [ 'vendor,string-array-property' ] # Expressing 2 properties in both orders means all of the set of properties # must be present or none of them. vendor,string-array-property: [ 'vendor,bool-property' ] required: - compatible - reg - interrupts - interrupt-controller # if/then schema can be used to handle conditions on a property affecting # another property. A typical case is a specific 'compatible' value changes the # constraints on other properties. # # For multiple 'if' schema, group them under an 'allOf'. # # If the conditionals become too unwieldy, then it may be better to just split # the binding into separate schema documents. allOf: - if: properties: compatible: contains: const: vendor,soc2-ip then: required: - foo-supply else: # If otherwise the property is not allowed: properties: foo-supply: false # Altering schema depending on presence of properties is usually done by # dependencies (see above), however some adjustments might require if: - if: required: - vendor,bool-property then: properties: vendor,int-property: enum: [2, 4, 6] # Ideally, the schema should have this line otherwise any other properties # present are allowed. There's a few common properties such as 'status' and # 'pinctrl-*' which are added automatically by the tooling. # # This can't be used in cases where another schema is referenced # (i.e. allOf: [{$ref: ...}]). # If and only if another schema is referenced and arbitrary children nodes can # appear, "unevaluatedProperties: false" could be used. A typical example is # an I2C controller where no name pattern matching for children can be added. additionalProperties: false examples: # Examples are now compiled with dtc and validated against the schemas # # Examples have a default #address-cells and #size-cells value of 1. This can # be overridden or an appropriate parent bus node should be shown (such as on # i2c buses). # # Any includes used have to be explicitly included. Use 4-space indentation. - | node@1000 { compatible = "vendor,soc4-ip", "vendor,soc1-ip"; reg = <0x1000 0x80>, <0x3000 0x80>; reg-names = "core", "aux"; interrupts = <10>; interrupt-controller; #interrupt-cells = <2>; }; ”h]”hX»%# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright 2018 Linaro Ltd. %YAML 1.2 --- # All the top-level keys are standard json-schema keywords except for # 'maintainers' and 'select' # $id is a unique identifier based on the filename. There may or may not be a # file present at the URL. $id: http://devicetree.org/schemas/example-schema.yaml# # $schema is the meta-schema this schema should be validated with. $schema: http://devicetree.org/meta-schemas/core.yaml# title: An Example Device maintainers: - Rob Herring description: | A more detailed multi-line description of the binding. Details about the hardware device and any links to datasheets can go here. Literal blocks are marked with the '|' at the beginning. The end is marked by indentation less than the first line of the literal block. Lines also cannot begin with a tab character. select: false # 'select' is a schema applied to a DT node to determine if this binding # schema should be applied to the node. It is optional and by default the # possible compatible strings are extracted and used to match. # In this case, a 'false' schema will never match. properties: # A dictionary of DT properties for this binding schema compatible: # More complicated schema can use oneOf (XOR), anyOf (OR), or allOf (AND) # to handle different conditions. # In this case, it's needed to handle a variable number of values as there # isn't another way to express a constraint of the last string value. # The boolean schema must be a list of schemas. oneOf: - items: # items is a list of possible values for the property. The number of # values is determined by the number of elements in the list. # Order in lists is significant, order in dicts is not # Must be one of the 1st enums followed by the 2nd enum # # Each element in items should be 'enum' or 'const' - enum: - vendor,soc4-ip - vendor,soc3-ip - vendor,soc2-ip - const: vendor,soc1-ip # additionalItems being false is implied # minItems/maxItems equal to 2 is implied - items: # 'const' is just a special case of an enum with a single possible value - const: vendor,soc1-ip reg: # The core schema already checks that reg values are numbers, so device # specific schema don't need to do those checks. # The description of each element defines the order and implicitly defines # the number of reg entries. items: - description: core registers - description: aux registers # minItems/maxItems equal to 2 is implied reg-names: # The core schema enforces this (*-names) is a string array items: - const: core - const: aux clocks: # Cases that have only a single entry just need to express that with maxItems maxItems: 1 description: bus clock. A description is only needed for a single item if there's something unique to add. The items should have a fixed order, so pattern matching names are discouraged. clock-names: # For single-entry lists in clocks, resets etc., the xxx-names often do not # bring any value, especially if they copy the IP block name. In such case # just skip the xxx-names. items: - const: bus interrupts: # Either 1 or 2 interrupts can be present minItems: 1 items: - description: tx or combined interrupt - description: rx interrupt description: A variable number of interrupts warrants a description of what conditions affect the number of interrupts. Otherwise, descriptions on standard properties are not necessary. The items should have a fixed order, so pattern matching names are discouraged. interrupt-names: # minItems must be specified here because the default would be 2 minItems: 1 items: - const: tx irq - const: rx irq # Property names starting with '#' must be quoted '#interrupt-cells': # A simple case where the value must always be '2'. # The core schema handles that this must be a single integer. const: 2 interrupt-controller: true # The core checks this is a boolean, so just have to list it here to be # valid for this binding. clock-frequency: # The type is set in the core schema. Per-device schema only need to set # constraints on the possible values. minimum: 100 maximum: 400000 # The value that should be used if the property is not present default: 200 foo-gpios: maxItems: 1 description: A connection of the 'foo' gpio line. # *-supply is always a single phandle, so nothing more to define. foo-supply: true # Vendor-specific properties # # Vendor-specific properties have slightly different schema requirements than # common properties. They must have at least a type definition and # 'description'. vendor,int-property: description: Vendor-specific properties must have a description $ref: /schemas/types.yaml#/definitions/uint32 enum: [2, 4, 6, 8, 10] vendor,bool-property: description: Vendor-specific properties must have a description. Boolean properties are one case where the json-schema 'type' keyword can be used directly. type: boolean vendor,string-array-property: description: Vendor-specific properties should reference a type in the core schema. $ref: /schemas/types.yaml#/definitions/string-array items: - enum: [foo, bar] - enum: [baz, boo] vendor,property-in-standard-units-microvolt: description: Vendor-specific properties having a standard unit suffix don't need a type. enum: [ 100, 200, 300 ] vendor,int-array-variable-length-and-constrained-values: description: Array might define what type of elements might be used (e.g. their range). $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 2 maxItems: 3 items: minimum: 0 maximum: 8 child-node: description: Child nodes are just another property from a json-schema perspective. type: object # DT nodes are json objects # Child nodes also need additionalProperties or unevaluatedProperties, where # 'false' should be used in most cases (see 'child-node-with-own-schema' # below). additionalProperties: false properties: vendor,a-child-node-property: description: Child node properties have all the same schema requirements. type: boolean required: - vendor,a-child-node-property child-node-with-own-schema: description: | Child node with their own compatible and device schema which ends in 'additionalProperties: false' or 'unevaluatedProperties: false' can mention only the compatible and use here 'additionalProperties: true'. type: object additionalProperties: true properties: compatible: const: vendor,sub-device # Describe the relationship between different properties dependencies: # 'vendor,bool-property' is only allowed when 'vendor,string-array-property' # is present vendor,bool-property: [ 'vendor,string-array-property' ] # Expressing 2 properties in both orders means all of the set of properties # must be present or none of them. vendor,string-array-property: [ 'vendor,bool-property' ] required: - compatible - reg - interrupts - interrupt-controller # if/then schema can be used to handle conditions on a property affecting # another property. A typical case is a specific 'compatible' value changes the # constraints on other properties. # # For multiple 'if' schema, group them under an 'allOf'. # # If the conditionals become too unwieldy, then it may be better to just split # the binding into separate schema documents. allOf: - if: properties: compatible: contains: const: vendor,soc2-ip then: required: - foo-supply else: # If otherwise the property is not allowed: properties: foo-supply: false # Altering schema depending on presence of properties is usually done by # dependencies (see above), however some adjustments might require if: - if: required: - vendor,bool-property then: properties: vendor,int-property: enum: [2, 4, 6] # Ideally, the schema should have this line otherwise any other properties # present are allowed. There's a few common properties such as 'status' and # 'pinctrl-*' which are added automatically by the tooling. # # This can't be used in cases where another schema is referenced # (i.e. allOf: [{$ref: ...}]). # If and only if another schema is referenced and arbitrary children nodes can # appear, "unevaluatedProperties: false" could be used. A typical example is # an I2C controller where no name pattern matching for children can be added. additionalProperties: false examples: # Examples are now compiled with dtc and validated against the schemas # # Examples have a default #address-cells and #size-cells value of 1. This can # be overridden or an appropriate parent bus node should be shown (such as on # i2c buses). # # Any includes used have to be explicitly included. Use 4-space indentation. - | node@1000 { compatible = "vendor,soc4-ip", "vendor,soc1-ip"; reg = <0x1000 0x80>, <0x3000 0x80>; reg-names = "core", "aux"; interrupts = <10>; interrupt-controller; #interrupt-cells = <2>; }; ”…””}”hj©sbah}”(h]”h ]”h"]”h$]”h&]”Œsource”ŒQ/var/lib/git/docbuild/linux/Documentation/devicetree/bindings/example-schema.yaml”hÅhÆŒforce”‰Œhighlight_args”}”Œ linenostart”Ksuh1jŠh³hÇh´Mhjhh²hubeh}”(h]”(Œannotated-example-schema”j_eh ]”h"]”(Œannotated example schema”Œexample-schema”eh$]”h&]”uh1hÈhhÊh²hh³hÇh´MŒexpect_referenced_by_name”}”jÃjTsŒexpect_referenced_by_id”}”j_jTsubeh}”(h]”Œ*writing-devicetree-bindings-in-json-schema”ah ]”h"]”Œ*writing devicetree bindings in json-schema”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jõŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”j_]”jTasŒnameids”}”(jÏjÌjLjIj"jjWjTjîjëj×jÔjæjãjejbj"jjJjGjÃj_jÂj¿uŒ nametypes”• }”(jωjL‰j"‰jW‰jî‰j׉jæ‰je‰j"ˆjJˆjÈj‰uh}”(jÌhÊjIj$jjOjTj%jëjZjÔjkjãjÚjbjñjjjGjAj_jhj¿jhuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)”}”(hhh]”hŞ)”}”(hhh]”hŒ4Hyperlink target "example-schema" is not referenced.”…””}”hj_ sbah}”(h]”h ]”h"]”h$]”h&]”uh1hİhj\ ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kşuh1jZ ubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.