15956d97fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0 25956d97fSEmmanuel Vadot%YAML 1.2 35956d97fSEmmanuel Vadot--- 45956d97fSEmmanuel Vadot$id: http://devicetree.org/schemas/mux/mux-controller.yaml# 55956d97fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 65956d97fSEmmanuel Vadot 78bab661aSEmmanuel Vadottitle: Common multiplexer controller provider 85956d97fSEmmanuel Vadot 95956d97fSEmmanuel Vadotmaintainers: 105956d97fSEmmanuel Vadot - Peter Rosin <peda@axentia.se> 115956d97fSEmmanuel Vadot 125956d97fSEmmanuel Vadotdescription: | 135956d97fSEmmanuel Vadot A multiplexer (or mux) controller will have one, or several, consumer devices 145956d97fSEmmanuel Vadot that uses the mux controller. Thus, a mux controller can possibly control 155956d97fSEmmanuel Vadot several parallel multiplexers. Presumably there will be at least one 165956d97fSEmmanuel Vadot multiplexer needed by each consumer, but a single mux controller can of course 175956d97fSEmmanuel Vadot control several multiplexers for a single consumer. 185956d97fSEmmanuel Vadot 195956d97fSEmmanuel Vadot A mux controller provides a number of states to its consumers, and the state 205956d97fSEmmanuel Vadot space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer, 215956d97fSEmmanuel Vadot 0-7 for an 8-way multiplexer, etc. 225956d97fSEmmanuel Vadot 235956d97fSEmmanuel Vadot 245956d97fSEmmanuel Vadot Mux controller nodes 255956d97fSEmmanuel Vadot -------------------- 265956d97fSEmmanuel Vadot 275956d97fSEmmanuel Vadot Mux controller nodes must specify the number of cells used for the 28e67e8565SEmmanuel Vadot specifier using the '#mux-control-cells' or '#mux-state-cells' property. 29e67e8565SEmmanuel Vadot The value of '#mux-state-cells' will always be one greater than the value 30e67e8565SEmmanuel Vadot of '#mux-control-cells'. 315956d97fSEmmanuel Vadot 325956d97fSEmmanuel Vadot Optionally, mux controller nodes can also specify the state the mux should 335956d97fSEmmanuel Vadot have when it is idle. The idle-state property is used for this. If the 345956d97fSEmmanuel Vadot idle-state is not present, the mux controller is typically left as is when 355956d97fSEmmanuel Vadot it is idle. For multiplexer chips that expose several mux controllers, the 365956d97fSEmmanuel Vadot idle-state property is an array with one idle state for each mux controller. 375956d97fSEmmanuel Vadot 385956d97fSEmmanuel Vadot The special value (-1) may be used to indicate that the mux should be left 395956d97fSEmmanuel Vadot as is when it is idle. This is the default, but can still be useful for 405956d97fSEmmanuel Vadot mux controller chips with more than one mux controller, particularly when 415956d97fSEmmanuel Vadot there is a need to "step past" a mux controller and set some other idle 425956d97fSEmmanuel Vadot state for a mux controller with a higher index. 435956d97fSEmmanuel Vadot 445956d97fSEmmanuel Vadot Some mux controllers have the ability to disconnect the input/output of the 455956d97fSEmmanuel Vadot multiplexer. Using this disconnected high-impedance state as the idle state 465956d97fSEmmanuel Vadot is indicated with idle state (-2). 475956d97fSEmmanuel Vadot 485956d97fSEmmanuel Vadot These constants are available in 495956d97fSEmmanuel Vadot 505956d97fSEmmanuel Vadot #include <dt-bindings/mux/mux.h> 515956d97fSEmmanuel Vadot 525956d97fSEmmanuel Vadot as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2). 535956d97fSEmmanuel Vadot 545956d97fSEmmanuel Vadot An example mux controller node look like this (the adg972a chip is a triple 555956d97fSEmmanuel Vadot 4-way multiplexer): 565956d97fSEmmanuel Vadot 575956d97fSEmmanuel Vadot mux: mux-controller@50 { 585956d97fSEmmanuel Vadot compatible = "adi,adg792a"; 595956d97fSEmmanuel Vadot reg = <0x50>; 605956d97fSEmmanuel Vadot #mux-control-cells = <1>; 615956d97fSEmmanuel Vadot 625956d97fSEmmanuel Vadot idle-state = <MUX_IDLE_DISCONNECT MUX_IDLE_AS_IS 2>; 635956d97fSEmmanuel Vadot }; 645956d97fSEmmanuel Vadot 655956d97fSEmmanuel Vadotselect: 665956d97fSEmmanuel Vadot anyOf: 675956d97fSEmmanuel Vadot - properties: 685956d97fSEmmanuel Vadot $nodename: 695956d97fSEmmanuel Vadot pattern: '^mux-controller' 705956d97fSEmmanuel Vadot - required: 715956d97fSEmmanuel Vadot - '#mux-control-cells' 72e67e8565SEmmanuel Vadot - required: 73e67e8565SEmmanuel Vadot - '#mux-state-cells' 745956d97fSEmmanuel Vadot 755956d97fSEmmanuel Vadotproperties: 765956d97fSEmmanuel Vadot $nodename: 77*01950c46SEmmanuel Vadot pattern: '^mux-controller(@.*|-([0-9]|[1-9][0-9]+))?$' 785956d97fSEmmanuel Vadot 795956d97fSEmmanuel Vadot '#mux-control-cells': 805956d97fSEmmanuel Vadot enum: [ 0, 1 ] 815956d97fSEmmanuel Vadot 82e67e8565SEmmanuel Vadot '#mux-state-cells': 83e67e8565SEmmanuel Vadot enum: [ 1, 2 ] 84e67e8565SEmmanuel Vadot 855956d97fSEmmanuel Vadot idle-state: 865956d97fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/int32 875956d97fSEmmanuel Vadot minimum: -2 885956d97fSEmmanuel Vadot 895956d97fSEmmanuel Vadot idle-states: 905956d97fSEmmanuel Vadot description: | 915956d97fSEmmanuel Vadot Mux controller nodes can specify the state the mux should have when it is 925956d97fSEmmanuel Vadot idle. If the idle-state is not present, the mux controller is typically 935956d97fSEmmanuel Vadot left as is when it is idle. For multiplexer chips that expose several mux 945956d97fSEmmanuel Vadot controllers, the idle-state property is an array with one idle state for 955956d97fSEmmanuel Vadot each mux controller. 965956d97fSEmmanuel Vadot 975956d97fSEmmanuel Vadot The special value (-1) may be used to indicate that the mux should be left 985956d97fSEmmanuel Vadot as is when it is idle. This is the default, but can still be useful for 995956d97fSEmmanuel Vadot mux controller chips with more than one mux controller, particularly when 1005956d97fSEmmanuel Vadot there is a need to "step past" a mux controller and set some other idle 1015956d97fSEmmanuel Vadot state for a mux controller with a higher index. 1025956d97fSEmmanuel Vadot 1035956d97fSEmmanuel Vadot Some mux controllers have the ability to disconnect the input/output of the 1045956d97fSEmmanuel Vadot multiplexer. Using this disconnected high-impedance state as the idle state 1055956d97fSEmmanuel Vadot is indicated with idle state (-2). 1065956d97fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/int32-array 1075956d97fSEmmanuel Vadot items: 1085956d97fSEmmanuel Vadot minimum: -2 1095956d97fSEmmanuel Vadot 1105956d97fSEmmanuel VadotadditionalProperties: true 1115956d97fSEmmanuel Vadot 1125956d97fSEmmanuel Vadotexamples: 1135956d97fSEmmanuel Vadot - | 1145956d97fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 1155956d97fSEmmanuel Vadot 1165956d97fSEmmanuel Vadot /* One consumer of a 2-way mux controller (one GPIO-line) */ 1175956d97fSEmmanuel Vadot mux: mux-controller { 1185956d97fSEmmanuel Vadot compatible = "gpio-mux"; 1195956d97fSEmmanuel Vadot #mux-control-cells = <0>; 1205956d97fSEmmanuel Vadot 1215956d97fSEmmanuel Vadot mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>; 1225956d97fSEmmanuel Vadot }; 1235956d97fSEmmanuel Vadot 1245956d97fSEmmanuel Vadot adc-mux { 1255956d97fSEmmanuel Vadot compatible = "io-channel-mux"; 1265956d97fSEmmanuel Vadot io-channels = <&adc 0>; 1275956d97fSEmmanuel Vadot io-channel-names = "parent"; 1285956d97fSEmmanuel Vadot 1295956d97fSEmmanuel Vadot mux-controls = <&mux>; 1305956d97fSEmmanuel Vadot mux-control-names = "adc"; 1315956d97fSEmmanuel Vadot 1325956d97fSEmmanuel Vadot channels = "sync", "in"; 1335956d97fSEmmanuel Vadot }; 1345956d97fSEmmanuel Vadot 1355956d97fSEmmanuel Vadot - | 1365956d97fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 1375956d97fSEmmanuel Vadot 1385956d97fSEmmanuel Vadot /* 1395956d97fSEmmanuel Vadot * Two consumers (one for an ADC line and one for an i2c bus) of 1405956d97fSEmmanuel Vadot * parallel 4-way multiplexers controlled by the same two GPIO-lines. 1415956d97fSEmmanuel Vadot */ 1425956d97fSEmmanuel Vadot mux2: mux-controller { 1435956d97fSEmmanuel Vadot compatible = "gpio-mux"; 1445956d97fSEmmanuel Vadot #mux-control-cells = <0>; 1455956d97fSEmmanuel Vadot 1465956d97fSEmmanuel Vadot mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, 1475956d97fSEmmanuel Vadot <&pioA 1 GPIO_ACTIVE_HIGH>; 1485956d97fSEmmanuel Vadot }; 1495956d97fSEmmanuel Vadot 1505956d97fSEmmanuel Vadot adc-mux { 1515956d97fSEmmanuel Vadot compatible = "io-channel-mux"; 1525956d97fSEmmanuel Vadot io-channels = <&adc 0>; 1535956d97fSEmmanuel Vadot io-channel-names = "parent"; 1545956d97fSEmmanuel Vadot 1555956d97fSEmmanuel Vadot mux-controls = <&mux2>; 1565956d97fSEmmanuel Vadot 1575956d97fSEmmanuel Vadot channels = "sync-1", "in", "out", "sync-2"; 1585956d97fSEmmanuel Vadot }; 1595956d97fSEmmanuel Vadot 1605956d97fSEmmanuel Vadot i2c-mux { 1615956d97fSEmmanuel Vadot compatible = "i2c-mux"; 1625956d97fSEmmanuel Vadot i2c-parent = <&i2c1>; 1635956d97fSEmmanuel Vadot 1645956d97fSEmmanuel Vadot mux-controls = <&mux2>; 1655956d97fSEmmanuel Vadot 1665956d97fSEmmanuel Vadot #address-cells = <1>; 1675956d97fSEmmanuel Vadot #size-cells = <0>; 1685956d97fSEmmanuel Vadot 1695956d97fSEmmanuel Vadot i2c@0 { 1705956d97fSEmmanuel Vadot reg = <0>; 1715956d97fSEmmanuel Vadot #address-cells = <1>; 1725956d97fSEmmanuel Vadot #size-cells = <0>; 1735956d97fSEmmanuel Vadot 1745956d97fSEmmanuel Vadot ssd1307: oled@3c { 1755956d97fSEmmanuel Vadot reg = <0x3c>; 1765956d97fSEmmanuel Vadot }; 1775956d97fSEmmanuel Vadot }; 1785956d97fSEmmanuel Vadot 1795956d97fSEmmanuel Vadot i2c@3 { 1805956d97fSEmmanuel Vadot reg = <3>; 1815956d97fSEmmanuel Vadot #address-cells = <1>; 1825956d97fSEmmanuel Vadot #size-cells = <0>; 1835956d97fSEmmanuel Vadot 1845956d97fSEmmanuel Vadot pca9555: pca9555@20 { 1855956d97fSEmmanuel Vadot reg = <0x20>; 1865956d97fSEmmanuel Vadot }; 1875956d97fSEmmanuel Vadot }; 1885956d97fSEmmanuel Vadot }; 189e67e8565SEmmanuel Vadot 190e67e8565SEmmanuel Vadot - | 191e67e8565SEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 192e67e8565SEmmanuel Vadot 193e67e8565SEmmanuel Vadot mux1: mux-controller { 194e67e8565SEmmanuel Vadot compatible = "gpio-mux"; 195e67e8565SEmmanuel Vadot #mux-state-cells = <1>; 196e67e8565SEmmanuel Vadot mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>; 197e67e8565SEmmanuel Vadot }; 198e67e8565SEmmanuel Vadot 199e67e8565SEmmanuel Vadot transceiver4: can-phy4 { 200e67e8565SEmmanuel Vadot compatible = "ti,tcan1042"; 201e67e8565SEmmanuel Vadot #phy-cells = <0>; 202e67e8565SEmmanuel Vadot max-bitrate = <5000000>; 203e67e8565SEmmanuel Vadot standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>; 204e67e8565SEmmanuel Vadot mux-states = <&mux1 1>; 205e67e8565SEmmanuel Vadot }; 2065956d97fSEmmanuel Vadot... 207