new file mode 100644
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-shared.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bindings for shared GPIO lines in board level
+
+maintainers:
+ - Linus Walleij <linus.walleij@linaro.org>
+ - Bartosz Golaszewski <bgolaszewski@baylibre.com>
+ - Peter Ujfalusi <peter.ujfalusi@ti.com>
+
+description: |
+ Some board design opts to use the same GPIO line routed to different
+ onboard components.
+
+ The GPIO in question might be a reset line, enable line or mode selection
+ line, etc.
+ The drivers for the components do not know if in some board they have
+ dedicated GPIO on other boards they might share a GPIO line with other
+ entities, not necessary from the same class:
+
+ Two codec sharing the same enable line
+ One codec and one amplifier sharing the same line
+ Regulators sharing the same line
+ Display panels, backlights and touchscreen controllers
+
+ And any variation of these.
+
+ There is one thing usually the board designers make sure that the level
+ needed for the GPIO is matching for the components.
+
+ The shared GPIO bindings can be used to describe the board level split of a
+ single GPIO line.
+
+ We have two cases to take care:
+ 1. GPIO line should be LOW to enable any of the components
+ if any of the shared line is requested to be LOW, set the GPIO line low
+
+ 2. GPIO line should be HIGH to enable any of the components
+ if any of the shared line is requested to be HIGH, set the GPIO line high
+
+ At the end it is:
+ 1. logical AND for the shared lines
+ 2. logical OR for the shared lines
+
+properties:
+ compatible:
+ items:
+ - const: gpio-shared
+
+ "#gpio-cells":
+ const: 2
+
+ gpio-controller: true
+
+ root-gpios:
+ description: |
+ The shared GPIO line
+ maxItems: 1
+
+ branch-count:
+ description: |
+ Number of users of the shared GPIO line
+ maxItems: 1
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32
+
+ hold-active-state:
+ description: |
+ The active level of the GPIO line for all of the clients:
+ GPIO_ACTIVE_HIGH: if the GPIO must be high for the components,
+ GPIO_ACTIVE_LOW: if the GPIO must be low for the components
+ to enable them.
+ maxItems: 1
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+ - compatible
+ - "#gpio-cells"
+ - gpio-controller
+ - root-gpios
+ - branch-count
+ - hold-active-state
+
+examples:
+ - |+
+ #include <dt-bindings/gpio/gpio.h>
+ codec_reset: gpio-shared0 {
+ compatible = "gpio-shared";
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ root-gpios = <&audio_exp 0 GPIO_ACTIVE_HIGH>;
+
+ branch-count = <2>;
+ hold-active-state = <GPIO_ACTIVE_HIGH>;
+ };
Some board design opts to use the same GPIO line routed to different onboard components. The GPIO in question might be a reset line, enable line or mode selection line, etc. The drivers for the components do not know if in some board they have dedicated GPIO on other boards they might share a GPIO line with other entities, not necessary from the same class: Two codec sharing the same enable line One codec and one amplifier sharing the same line Regulators sharing the same line Display panels, backlights and touchscreen controllers And any variation of these. There is one thing usually the board designers make sure that the level needed for the GPIO is matching for the components. The shared GPIO bindings can be used to describe the board level split of a single GPIO line. We have two cases to take care: 1. GPIO line should be LOW to enable any of the components if any of the shared line is requested to be LOW, set the GPIO line low 2. GPIO line should be HIGH to enable any of the components if any of the shared line is requested to be HIGH, set the GPIO line high At the end it is: 1. logical AND for the shared lines 2. logical OR for the shared lines Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> --- .../devicetree/bindings/gpio/gpio-shared.yaml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-shared.yaml -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki