1# SPDX-License-Identifier: GPL-2.0 2%YAML 1.2 3--- 4$id: http://devicetree.org/schemas/mux/mux-controller.yaml# 5$schema: http://devicetree.org/meta-schemas/core.yaml# 6 7title: Common multiplexer controller provider 8 9maintainers: 10 - Peter Rosin <peda@axentia.se> 11 12description: | 13 A multiplexer (or mux) controller will have one, or several, consumer devices 14 that uses the mux controller. Thus, a mux controller can possibly control 15 several parallel multiplexers. Presumably there will be at least one 16 multiplexer needed by each consumer, but a single mux controller can of course 17 control several multiplexers for a single consumer. 18 19 A mux controller provides a number of states to its consumers, and the state 20 space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer, 21 0-7 for an 8-way multiplexer, etc. 22 23 Mux controller nodes 24 -------------------- 25 26 Mux controller nodes must specify the number of cells used for the 27 specifier using the '#mux-control-cells' or '#mux-state-cells' property. 28 The value of '#mux-state-cells' will always be one greater than the value 29 of '#mux-control-cells'. 30 31 Optionally, mux controller nodes can also specify the state the mux should 32 have when it is idle. The idle-state property is used for this. If the 33 idle-state is not present, the mux controller is typically left as is when 34 it is idle. For multiplexer chips that expose several mux controllers, the 35 idle-state property is an array with one idle state for each mux controller. 36 37 The special value (-1) may be used to indicate that the mux should be left 38 as is when it is idle. This is the default, but can still be useful for 39 mux controller chips with more than one mux controller, particularly when 40 there is a need to "step past" a mux controller and set some other idle 41 state for a mux controller with a higher index. 42 43 Some mux controllers have the ability to disconnect the input/output of the 44 multiplexer. Using this disconnected high-impedance state as the idle state 45 is indicated with idle state (-2). 46 47 These constants are available in 48 49 #include <dt-bindings/mux/mux.h> 50 51 as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2). 52 53 An example mux controller node look like this (the adg972a chip is a triple 54 4-way multiplexer): 55 56 mux: mux-controller@50 { 57 compatible = "adi,adg792a"; 58 reg = <0x50>; 59 #mux-control-cells = <1>; 60 61 idle-state = <MUX_IDLE_DISCONNECT MUX_IDLE_AS_IS 2>; 62 }; 63 64select: 65 anyOf: 66 - required: 67 - '#mux-control-cells' 68 - required: 69 - '#mux-state-cells' 70 71properties: 72 '#mux-control-cells': 73 enum: [ 0, 1 ] 74 75 '#mux-state-cells': 76 enum: [ 1, 2 ] 77 78 idle-state: 79 $ref: /schemas/types.yaml#/definitions/int32 80 minimum: -2 81 82 idle-states: 83 description: | 84 Mux controller nodes can specify the state the mux should have when it is 85 idle. If the idle-state is not present, the mux controller is typically 86 left as is when it is idle. For multiplexer chips that expose several mux 87 controllers, the idle-state property is an array with one idle state for 88 each mux controller. 89 90 The special value (-1) may be used to indicate that the mux should be left 91 as is when it is idle. This is the default, but can still be useful for 92 mux controller chips with more than one mux controller, particularly when 93 there is a need to "step past" a mux controller and set some other idle 94 state for a mux controller with a higher index. 95 96 Some mux controllers have the ability to disconnect the input/output of the 97 multiplexer. Using this disconnected high-impedance state as the idle state 98 is indicated with idle state (-2). 99 $ref: /schemas/types.yaml#/definitions/int32-array 100 items: 101 minimum: -2 102 103additionalProperties: true 104 105examples: 106 - | 107 #include <dt-bindings/gpio/gpio.h> 108 109 /* One consumer of a 2-way mux controller (one GPIO-line) */ 110 mux: mux-controller { 111 compatible = "gpio-mux"; 112 #mux-control-cells = <0>; 113 114 mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>; 115 }; 116 117 adc-mux { 118 compatible = "io-channel-mux"; 119 io-channels = <&adc 0>; 120 io-channel-names = "parent"; 121 122 mux-controls = <&mux>; 123 mux-control-names = "adc"; 124 125 channels = "sync", "in"; 126 }; 127 128 - | 129 #include <dt-bindings/gpio/gpio.h> 130 131 /* 132 * Two consumers (one for an ADC line and one for an i2c bus) of 133 * parallel 4-way multiplexers controlled by the same two GPIO-lines. 134 */ 135 mux2: mux-controller { 136 compatible = "gpio-mux"; 137 #mux-control-cells = <0>; 138 139 mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, 140 <&pioA 1 GPIO_ACTIVE_HIGH>; 141 }; 142 143 adc-mux { 144 compatible = "io-channel-mux"; 145 io-channels = <&adc 0>; 146 io-channel-names = "parent"; 147 148 mux-controls = <&mux2>; 149 150 channels = "sync-1", "in", "out", "sync-2"; 151 }; 152 153 i2c-mux { 154 compatible = "i2c-mux"; 155 i2c-parent = <&i2c1>; 156 157 mux-controls = <&mux2>; 158 159 #address-cells = <1>; 160 #size-cells = <0>; 161 162 i2c@0 { 163 reg = <0>; 164 #address-cells = <1>; 165 #size-cells = <0>; 166 167 ssd1307: oled@3c { 168 reg = <0x3c>; 169 }; 170 }; 171 172 i2c@3 { 173 reg = <3>; 174 #address-cells = <1>; 175 #size-cells = <0>; 176 177 pca9555: pca9555@20 { 178 reg = <0x20>; 179 }; 180 }; 181 }; 182 183 - | 184 #include <dt-bindings/gpio/gpio.h> 185 186 mux1: mux-controller { 187 compatible = "gpio-mux"; 188 #mux-state-cells = <1>; 189 mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>; 190 }; 191 192 transceiver4: can-phy4 { 193 compatible = "ti,tcan1042"; 194 #phy-cells = <0>; 195 max-bitrate = <5000000>; 196 standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>; 197 mux-states = <&mux1 1>; 198 }; 199... 200