162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci%YAML 1.2 362306a36Sopenharmony_ci--- 462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/mux/mux-controller.yaml# 562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 662306a36Sopenharmony_ci 762306a36Sopenharmony_cititle: Common multiplexer controller provider 862306a36Sopenharmony_ci 962306a36Sopenharmony_cimaintainers: 1062306a36Sopenharmony_ci - Peter Rosin <peda@axentia.se> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_cidescription: | 1362306a36Sopenharmony_ci A multiplexer (or mux) controller will have one, or several, consumer devices 1462306a36Sopenharmony_ci that uses the mux controller. Thus, a mux controller can possibly control 1562306a36Sopenharmony_ci several parallel multiplexers. Presumably there will be at least one 1662306a36Sopenharmony_ci multiplexer needed by each consumer, but a single mux controller can of course 1762306a36Sopenharmony_ci control several multiplexers for a single consumer. 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci A mux controller provides a number of states to its consumers, and the state 2062306a36Sopenharmony_ci space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer, 2162306a36Sopenharmony_ci 0-7 for an 8-way multiplexer, etc. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci Mux controller nodes 2562306a36Sopenharmony_ci -------------------- 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci Mux controller nodes must specify the number of cells used for the 2862306a36Sopenharmony_ci specifier using the '#mux-control-cells' or '#mux-state-cells' property. 2962306a36Sopenharmony_ci The value of '#mux-state-cells' will always be one greater than the value 3062306a36Sopenharmony_ci of '#mux-control-cells'. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci Optionally, mux controller nodes can also specify the state the mux should 3362306a36Sopenharmony_ci have when it is idle. The idle-state property is used for this. If the 3462306a36Sopenharmony_ci idle-state is not present, the mux controller is typically left as is when 3562306a36Sopenharmony_ci it is idle. For multiplexer chips that expose several mux controllers, the 3662306a36Sopenharmony_ci idle-state property is an array with one idle state for each mux controller. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci The special value (-1) may be used to indicate that the mux should be left 3962306a36Sopenharmony_ci as is when it is idle. This is the default, but can still be useful for 4062306a36Sopenharmony_ci mux controller chips with more than one mux controller, particularly when 4162306a36Sopenharmony_ci there is a need to "step past" a mux controller and set some other idle 4262306a36Sopenharmony_ci state for a mux controller with a higher index. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci Some mux controllers have the ability to disconnect the input/output of the 4562306a36Sopenharmony_ci multiplexer. Using this disconnected high-impedance state as the idle state 4662306a36Sopenharmony_ci is indicated with idle state (-2). 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci These constants are available in 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci #include <dt-bindings/mux/mux.h> 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2). 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci An example mux controller node look like this (the adg972a chip is a triple 5562306a36Sopenharmony_ci 4-way multiplexer): 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci mux: mux-controller@50 { 5862306a36Sopenharmony_ci compatible = "adi,adg792a"; 5962306a36Sopenharmony_ci reg = <0x50>; 6062306a36Sopenharmony_ci #mux-control-cells = <1>; 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci idle-state = <MUX_IDLE_DISCONNECT MUX_IDLE_AS_IS 2>; 6362306a36Sopenharmony_ci }; 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ciselect: 6662306a36Sopenharmony_ci anyOf: 6762306a36Sopenharmony_ci - properties: 6862306a36Sopenharmony_ci $nodename: 6962306a36Sopenharmony_ci pattern: '^mux-controller' 7062306a36Sopenharmony_ci - required: 7162306a36Sopenharmony_ci - '#mux-control-cells' 7262306a36Sopenharmony_ci - required: 7362306a36Sopenharmony_ci - '#mux-state-cells' 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciproperties: 7662306a36Sopenharmony_ci $nodename: 7762306a36Sopenharmony_ci pattern: '^mux-controller(@.*|-[0-9a-f]+)?$' 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci '#mux-control-cells': 8062306a36Sopenharmony_ci enum: [ 0, 1 ] 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci '#mux-state-cells': 8362306a36Sopenharmony_ci enum: [ 1, 2 ] 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci idle-state: 8662306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/int32 8762306a36Sopenharmony_ci minimum: -2 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci idle-states: 9062306a36Sopenharmony_ci description: | 9162306a36Sopenharmony_ci Mux controller nodes can specify the state the mux should have when it is 9262306a36Sopenharmony_ci idle. If the idle-state is not present, the mux controller is typically 9362306a36Sopenharmony_ci left as is when it is idle. For multiplexer chips that expose several mux 9462306a36Sopenharmony_ci controllers, the idle-state property is an array with one idle state for 9562306a36Sopenharmony_ci each mux controller. 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci The special value (-1) may be used to indicate that the mux should be left 9862306a36Sopenharmony_ci as is when it is idle. This is the default, but can still be useful for 9962306a36Sopenharmony_ci mux controller chips with more than one mux controller, particularly when 10062306a36Sopenharmony_ci there is a need to "step past" a mux controller and set some other idle 10162306a36Sopenharmony_ci state for a mux controller with a higher index. 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci Some mux controllers have the ability to disconnect the input/output of the 10462306a36Sopenharmony_ci multiplexer. Using this disconnected high-impedance state as the idle state 10562306a36Sopenharmony_ci is indicated with idle state (-2). 10662306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/int32-array 10762306a36Sopenharmony_ci items: 10862306a36Sopenharmony_ci minimum: -2 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ciadditionalProperties: true 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ciexamples: 11362306a36Sopenharmony_ci - | 11462306a36Sopenharmony_ci #include <dt-bindings/gpio/gpio.h> 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci /* One consumer of a 2-way mux controller (one GPIO-line) */ 11762306a36Sopenharmony_ci mux: mux-controller { 11862306a36Sopenharmony_ci compatible = "gpio-mux"; 11962306a36Sopenharmony_ci #mux-control-cells = <0>; 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>; 12262306a36Sopenharmony_ci }; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci adc-mux { 12562306a36Sopenharmony_ci compatible = "io-channel-mux"; 12662306a36Sopenharmony_ci io-channels = <&adc 0>; 12762306a36Sopenharmony_ci io-channel-names = "parent"; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci mux-controls = <&mux>; 13062306a36Sopenharmony_ci mux-control-names = "adc"; 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci channels = "sync", "in"; 13362306a36Sopenharmony_ci }; 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci - | 13662306a36Sopenharmony_ci #include <dt-bindings/gpio/gpio.h> 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci /* 13962306a36Sopenharmony_ci * Two consumers (one for an ADC line and one for an i2c bus) of 14062306a36Sopenharmony_ci * parallel 4-way multiplexers controlled by the same two GPIO-lines. 14162306a36Sopenharmony_ci */ 14262306a36Sopenharmony_ci mux2: mux-controller { 14362306a36Sopenharmony_ci compatible = "gpio-mux"; 14462306a36Sopenharmony_ci #mux-control-cells = <0>; 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, 14762306a36Sopenharmony_ci <&pioA 1 GPIO_ACTIVE_HIGH>; 14862306a36Sopenharmony_ci }; 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci adc-mux { 15162306a36Sopenharmony_ci compatible = "io-channel-mux"; 15262306a36Sopenharmony_ci io-channels = <&adc 0>; 15362306a36Sopenharmony_ci io-channel-names = "parent"; 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci mux-controls = <&mux2>; 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci channels = "sync-1", "in", "out", "sync-2"; 15862306a36Sopenharmony_ci }; 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci i2c-mux { 16162306a36Sopenharmony_ci compatible = "i2c-mux"; 16262306a36Sopenharmony_ci i2c-parent = <&i2c1>; 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci mux-controls = <&mux2>; 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci #address-cells = <1>; 16762306a36Sopenharmony_ci #size-cells = <0>; 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci i2c@0 { 17062306a36Sopenharmony_ci reg = <0>; 17162306a36Sopenharmony_ci #address-cells = <1>; 17262306a36Sopenharmony_ci #size-cells = <0>; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci ssd1307: oled@3c { 17562306a36Sopenharmony_ci reg = <0x3c>; 17662306a36Sopenharmony_ci }; 17762306a36Sopenharmony_ci }; 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci i2c@3 { 18062306a36Sopenharmony_ci reg = <3>; 18162306a36Sopenharmony_ci #address-cells = <1>; 18262306a36Sopenharmony_ci #size-cells = <0>; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci pca9555: pca9555@20 { 18562306a36Sopenharmony_ci reg = <0x20>; 18662306a36Sopenharmony_ci }; 18762306a36Sopenharmony_ci }; 18862306a36Sopenharmony_ci }; 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci - | 19162306a36Sopenharmony_ci #include <dt-bindings/gpio/gpio.h> 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci mux1: mux-controller { 19462306a36Sopenharmony_ci compatible = "gpio-mux"; 19562306a36Sopenharmony_ci #mux-state-cells = <1>; 19662306a36Sopenharmony_ci mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>; 19762306a36Sopenharmony_ci }; 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci transceiver4: can-phy4 { 20062306a36Sopenharmony_ci compatible = "ti,tcan1042"; 20162306a36Sopenharmony_ci #phy-cells = <0>; 20262306a36Sopenharmony_ci max-bitrate = <5000000>; 20362306a36Sopenharmony_ci standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>; 20462306a36Sopenharmony_ci mux-states = <&mux1 1>; 20562306a36Sopenharmony_ci }; 20662306a36Sopenharmony_ci... 207