Skip to contentSkip to conversation

gpio: aggregator: add gpio-aggregator DT compatible

PATCH In review James Hilliard 2 participants 2 messages Feb 11

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: aggregator: add gpio-aggregator DT compatible

Add an OF match entry for gpio-aggregator so the forwarder can be instantiated without using the delay-specific compatible.

Add a minimal DT schema for gpio-aggregator documenting compatible.

---
 .../bindings/gpio/gpio-aggregator.yaml        | 57 +++++++++++++++++++
 drivers/gpio/gpio-aggregator.c                |  3 +
 2 files changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml
Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml new file +57 -0
new file mode 100644
index 000000000000..ec1d08f3db2c
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-aggregator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO aggregator controller
+
+maintainers:
+  - Alexander Stein <[email protected]>
+
+description: |
+  This binding describes a GPIO forwarder that exposes selected GPIO
+  lines as a virtual GPIO controller.
+
+properties:
+  compatible:
+    const: gpio-aggregator
+
+  "#gpio-cells":
+    description: Specifies the line offset and GPIO flags.
+    const: 2
+
+  gpios:
+    description: Array of GPIOs to aggregate
+    minItems: 1
+    maxItems: 32
+
+  gpio-controller: true
+
+  gpio-line-names:
+    minItems: 1
+    maxItems: 32
+
+required:
+  - compatible
+  - "#gpio-cells"
+  - gpio-controller
+  - gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    gpio_agg: gpio-aggregator {
+        compatible = "gpio-aggregator";
+        #gpio-cells = <2>;
+        gpio-controller;
+        gpios = <&gpio0 3 GPIO_ACTIVE_LOW>,
+                <&gpio3 1 GPIO_ACTIVE_HIGH>;
+    };
+
+    consumer {
+        enable-gpios = <&gpio_agg 0 GPIO_ACTIVE_LOW>;
+    };
drivers/gpio/gpio-aggregator.c +3 -0
index 416f265d09d0..a09752fc5fe2 100644
@@ -1635,6 +1635,9 @@ static int gpio_aggregator_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id gpio_aggregator_dt_ids[] = {
+	{
+		.compatible = "gpio-aggregator",
+	},
 	{
 		.compatible = "gpio-delay",
 		.data = (void *)FWD_FEATURE_DELAY,
Signature · 1 line
2.43.0
#1 lore raw
Quoted 2 lines · James Hilliard

Add an OF match entry for gpio-aggregator so the forwarder can be instantiated without using the delay-specific compatible.

Why? What problems or real hardware are you solving here?

Quoted 6 lines

Add a minimal DT schema for gpio-aggregator documenting compatible.

---
 .../bindings/gpio/gpio-aggregator.yaml        | 57 +++++++++++++++++++

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Quoted 12 lines
 drivers/gpio/gpio-aggregator.c                |  3 +
 2 files changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml
Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml new file +2 -0
new file mode 100644
index 000000000000..ec1d08f3db2c
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2

Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/gpio/gpio-aggregator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO aggregator controller
+
+maintainers:
+  - Alexander Stein <[email protected]>
+
+description: |

Do not need '|' unless you need to preserve formatting.

Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml line 13

Quoted 1 line
Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml new file +1 -0
+  This binding describes a GPIO forwarder that exposes selected GPIO

Explain the hardware, not the binding. Drop "this binding ......"

Quoted 34 lines
Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml new file +34 -0
+  lines as a virtual GPIO controller.
+
+properties:
+  compatible:
+    const: gpio-aggregator
+
+  "#gpio-cells":
+    description: Specifies the line offset and GPIO flags.
+    const: 2
+
+  gpios:
+    description: Array of GPIOs to aggregate
+    minItems: 1
+    maxItems: 32
+
+  gpio-controller: true
+
+  gpio-line-names:
+    minItems: 1
+    maxItems: 32
+
+required:
+  - compatible
+  - "#gpio-cells"
+  - gpio-controller
+  - gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    gpio_agg: gpio-aggregator {

Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-aggregator.yaml new file +10 -0
+        compatible = "gpio-aggregator";
+        #gpio-cells = <2>;
+        gpio-controller;
+        gpios = <&gpio0 3 GPIO_ACTIVE_LOW>,
+                <&gpio3 1 GPIO_ACTIVE_HIGH>;
+    };
+
+    consumer {
+        enable-gpios = <&gpio_agg 0 GPIO_ACTIVE_LOW>;
+    };

Drop node, not relevant. Anyway, I do not see any point in referencing "gpio_agg 0" instead of "gpio0 3" and your commit msg fails to explain that.

Best regards,
Krzysztof