xref: /linux/Documentation/devicetree/bindings/mux/gpio-mux.yaml (revision df9c299371054cb725eef730fd0f1d0fe2ed6bb0)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mux/gpio-mux.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: GPIO-based multiplexer controller
8
9maintainers:
10  - Peter Rosin <peda@axentia.se>
11
12description: |+
13  Define what GPIO pins are used to control a multiplexer. Or several
14  multiplexers, if the same pins control more than one multiplexer.
15
16  The multiplexer state is defined as the number represented by the
17  multiplexer GPIO pins, where the first pin is the least significant
18  bit. An active pin is a binary 1, an inactive pin is a binary 0.
19
20properties:
21  compatible:
22    const: gpio-mux
23
24  mux-gpios:
25    description:
26      List of gpios used to control the multiplexer, least significant bit first.
27
28  mux-supply:
29    description:
30      Regulator to power on the multiplexer.
31
32  '#mux-control-cells':
33    enum: [ 0, 1 ]
34
35  '#mux-state-cells':
36    enum: [ 1, 2 ]
37
38  idle-state:
39    default: -1
40
41required:
42  - compatible
43  - mux-gpios
44anyOf:
45  - required:
46      - "#mux-control-cells"
47  - required:
48      - "#mux-state-cells"
49
50additionalProperties: false
51
52examples:
53  - |
54    #include <dt-bindings/gpio/gpio.h>
55
56    mux: mux-controller {
57        compatible = "gpio-mux";
58        #mux-control-cells = <0>;
59
60        mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>,
61              <&pioA 1 GPIO_ACTIVE_HIGH>;
62    };
63
64    adc-mux {
65        compatible = "io-channel-mux";
66        io-channels = <&adc 0>;
67        io-channel-names = "parent";
68
69        mux-controls = <&mux>;
70
71        channels = "sync-1", "in", "out", "sync-2";
72    };
73
74    i2c-mux {
75        compatible = "i2c-mux";
76        i2c-parent = <&i2c1>;
77
78        mux-controls = <&mux>;
79
80        #address-cells = <1>;
81        #size-cells = <0>;
82
83        i2c@0 {
84            reg = <0>;
85            #address-cells = <1>;
86            #size-cells = <0>;
87
88            ssd1307: oled@3c {
89                reg = <0x3c>;
90            };
91        };
92
93        i2c@3 {
94            reg = <3>;
95            #address-cells = <1>;
96            #size-cells = <0>;
97
98            pca9555: pca9555@20 {
99                reg = <0x20>;
100            };
101        };
102    };
103...
104