0001 # SPDX-License-Identifier: GPL-2.0
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/mux/mux-controller.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006
0007 title: Common multiplexer controller provider bindings
0008
0009 maintainers:
0010 - Peter Rosin <peda@axentia.se>
0011
0012 description: |
0013 A multiplexer (or mux) controller will have one, or several, consumer devices
0014 that uses the mux controller. Thus, a mux controller can possibly control
0015 several parallel multiplexers. Presumably there will be at least one
0016 multiplexer needed by each consumer, but a single mux controller can of course
0017 control several multiplexers for a single consumer.
0018
0019 A mux controller provides a number of states to its consumers, and the state
0020 space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer,
0021 0-7 for an 8-way multiplexer, etc.
0022
0023
0024 Mux controller nodes
0025 --------------------
0026
0027 Mux controller nodes must specify the number of cells used for the
0028 specifier using the '#mux-control-cells' or '#mux-state-cells' property.
0029 The value of '#mux-state-cells' will always be one greater than the value
0030 of '#mux-control-cells'.
0031
0032 Optionally, mux controller nodes can also specify the state the mux should
0033 have when it is idle. The idle-state property is used for this. If the
0034 idle-state is not present, the mux controller is typically left as is when
0035 it is idle. For multiplexer chips that expose several mux controllers, the
0036 idle-state property is an array with one idle state for each mux controller.
0037
0038 The special value (-1) may be used to indicate that the mux should be left
0039 as is when it is idle. This is the default, but can still be useful for
0040 mux controller chips with more than one mux controller, particularly when
0041 there is a need to "step past" a mux controller and set some other idle
0042 state for a mux controller with a higher index.
0043
0044 Some mux controllers have the ability to disconnect the input/output of the
0045 multiplexer. Using this disconnected high-impedance state as the idle state
0046 is indicated with idle state (-2).
0047
0048 These constants are available in
0049
0050 #include <dt-bindings/mux/mux.h>
0051
0052 as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2).
0053
0054 An example mux controller node look like this (the adg972a chip is a triple
0055 4-way multiplexer):
0056
0057 mux: mux-controller@50 {
0058 compatible = "adi,adg792a";
0059 reg = <0x50>;
0060 #mux-control-cells = <1>;
0061
0062 idle-state = <MUX_IDLE_DISCONNECT MUX_IDLE_AS_IS 2>;
0063 };
0064
0065 select:
0066 anyOf:
0067 - properties:
0068 $nodename:
0069 pattern: '^mux-controller'
0070 - required:
0071 - '#mux-control-cells'
0072 - required:
0073 - '#mux-state-cells'
0074
0075 properties:
0076 $nodename:
0077 pattern: '^mux-controller(@.*|-[0-9a-f]+)?$'
0078
0079 '#mux-control-cells':
0080 enum: [ 0, 1 ]
0081
0082 '#mux-state-cells':
0083 enum: [ 1, 2 ]
0084
0085 idle-state:
0086 $ref: /schemas/types.yaml#/definitions/int32
0087 minimum: -2
0088
0089 idle-states:
0090 description: |
0091 Mux controller nodes can specify the state the mux should have when it is
0092 idle. If the idle-state is not present, the mux controller is typically
0093 left as is when it is idle. For multiplexer chips that expose several mux
0094 controllers, the idle-state property is an array with one idle state for
0095 each mux controller.
0096
0097 The special value (-1) may be used to indicate that the mux should be left
0098 as is when it is idle. This is the default, but can still be useful for
0099 mux controller chips with more than one mux controller, particularly when
0100 there is a need to "step past" a mux controller and set some other idle
0101 state for a mux controller with a higher index.
0102
0103 Some mux controllers have the ability to disconnect the input/output of the
0104 multiplexer. Using this disconnected high-impedance state as the idle state
0105 is indicated with idle state (-2).
0106 $ref: /schemas/types.yaml#/definitions/int32-array
0107 items:
0108 minimum: -2
0109
0110 additionalProperties: true
0111
0112 examples:
0113 - |
0114 #include <dt-bindings/gpio/gpio.h>
0115
0116 /* One consumer of a 2-way mux controller (one GPIO-line) */
0117 mux: mux-controller {
0118 compatible = "gpio-mux";
0119 #mux-control-cells = <0>;
0120
0121 mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>;
0122 };
0123
0124 adc-mux {
0125 compatible = "io-channel-mux";
0126 io-channels = <&adc 0>;
0127 io-channel-names = "parent";
0128
0129 mux-controls = <&mux>;
0130 mux-control-names = "adc";
0131
0132 channels = "sync", "in";
0133 };
0134
0135 - |
0136 #include <dt-bindings/gpio/gpio.h>
0137
0138 /*
0139 * Two consumers (one for an ADC line and one for an i2c bus) of
0140 * parallel 4-way multiplexers controlled by the same two GPIO-lines.
0141 */
0142 mux2: mux-controller {
0143 compatible = "gpio-mux";
0144 #mux-control-cells = <0>;
0145
0146 mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>,
0147 <&pioA 1 GPIO_ACTIVE_HIGH>;
0148 };
0149
0150 adc-mux {
0151 compatible = "io-channel-mux";
0152 io-channels = <&adc 0>;
0153 io-channel-names = "parent";
0154
0155 mux-controls = <&mux2>;
0156
0157 channels = "sync-1", "in", "out", "sync-2";
0158 };
0159
0160 i2c-mux {
0161 compatible = "i2c-mux";
0162 i2c-parent = <&i2c1>;
0163
0164 mux-controls = <&mux2>;
0165
0166 #address-cells = <1>;
0167 #size-cells = <0>;
0168
0169 i2c@0 {
0170 reg = <0>;
0171 #address-cells = <1>;
0172 #size-cells = <0>;
0173
0174 ssd1307: oled@3c {
0175 reg = <0x3c>;
0176 };
0177 };
0178
0179 i2c@3 {
0180 reg = <3>;
0181 #address-cells = <1>;
0182 #size-cells = <0>;
0183
0184 pca9555: pca9555@20 {
0185 reg = <0x20>;
0186 };
0187 };
0188 };
0189
0190 - |
0191 #include <dt-bindings/gpio/gpio.h>
0192
0193 mux1: mux-controller {
0194 compatible = "gpio-mux";
0195 #mux-state-cells = <1>;
0196 mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>;
0197 };
0198
0199 transceiver4: can-phy4 {
0200 compatible = "ti,tcan1042";
0201 #phy-cells = <0>;
0202 max-bitrate = <5000000>;
0203 standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>;
0204 mux-states = <&mux1 1>;
0205 };
0206 ...