From 705d01cab40846eb14eb8c29091be6fa6059d5d8 Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Sat, 14 Feb 2026 13:30:13 -0700 Subject: [PATCH] schemas: gpio: Add gpio-line schema and gpio-line-name for hogs Add a schema for gpio-line child nodes used to configure GPIO lines without hogging them. Allow the optional gpio-line-name property on gpio-hog nodes. Also treat gpio-line child nodes like gpio-hog nodes in the consumer schema selector and DTB GPIO fixups, since their gpios property is local and not a phandle array. Signed-off-by: James Hilliard --- dtschema/dtb.py | 2 +- dtschema/schemas/gpio/gpio-consumer.yaml | 3 +- dtschema/schemas/gpio/gpio-hog.yaml | 3 ++ dtschema/schemas/gpio/gpio-line.yaml | 48 ++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 dtschema/schemas/gpio/gpio-line.yaml diff --git a/dtschema/dtb.py b/dtschema/dtb.py index 909531b8..6973d0b3 100644 --- a/dtschema/dtb.py +++ b/dtschema/dtb.py @@ -415,7 +415,7 @@ def fixup_phandles(validator, dt, path=''): def fixup_gpios(dt): - if 'gpio-hog' in dt: + if 'gpio-hog' in dt or 'gpio-line' in dt: return for k, v in dt.items(): if isinstance(v, dict): diff --git a/dtschema/schemas/gpio/gpio-consumer.yaml b/dtschema/schemas/gpio/gpio-consumer.yaml index b307c621..099182e2 100644 --- a/dtschema/schemas/gpio/gpio-consumer.yaml +++ b/dtschema/schemas/gpio/gpio-consumer.yaml @@ -12,10 +12,11 @@ description: Schema for GPIO consumer devicetree bindings maintainers: - Rob Herring -# do not select this schema for GPIO hogs +# do not select this schema for GPIO hog/line child nodes select: properties: gpio-hog: false + gpio-line: false properties: gpios: diff --git a/dtschema/schemas/gpio/gpio-hog.yaml b/dtschema/schemas/gpio/gpio-hog.yaml index bc1a72e5..4cf40996 100644 --- a/dtschema/schemas/gpio/gpio-hog.yaml +++ b/dtschema/schemas/gpio/gpio-hog.yaml @@ -36,6 +36,9 @@ properties: line-name: $ref: /schemas/types.yaml#/definitions/string + gpio-line-name: + $ref: /schemas/types.yaml#/definitions/string + output-high: $ref: /schemas/types.yaml#/definitions/flag diff --git a/dtschema/schemas/gpio/gpio-line.yaml b/dtschema/schemas/gpio/gpio-line.yaml new file mode 100644 index 00000000..b6335c1e --- /dev/null +++ b/dtschema/schemas/gpio/gpio-line.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/gpio-line.yaml# +$schema: http://devicetree.org/meta-schemas/base.yaml# + +title: GPIO Line Nodes + +description: Schema for GPIO line initialization devicetree bindings + +maintainers: + - Rob Herring + +# select this schema for GPIO line setup nodes +select: + properties: + gpio-line: true + + required: + - gpio-line + +properties: + $nodename: + pattern: "-line(-[0-9]+)?$" + + gpio-line: + $ref: /schemas/types.yaml#/definitions/flag + + gpios: + $ref: /schemas/types.yaml#/definitions/uint32-matrix + + input: + $ref: /schemas/types.yaml#/definitions/flag + + output-high: + $ref: /schemas/types.yaml#/definitions/flag + + output-low: + $ref: /schemas/types.yaml#/definitions/flag + + gpio-line-name: + $ref: /schemas/types.yaml#/definitions/string + +required: + - gpio-line + - gpios + +additionalProperties: false