# Pinctrl-based I2C Bus Demultiplexer

_Peios Kernel / Hardware and drivers / Device-tree binding reference / I2C bindings_

> Device-tree binding reference for Pinctrl-based I2C Bus Demultiplexer.

<!-- SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;i2c&#47;i2c&#45;demux&#45;pinctrl&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;core&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Wolfram Sang &#60;wsa&#43;renesas&#64;sang&#45;engineering&#46;com&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">This binding describes an I2C bus demultiplexer that uses pin multiplexing to
route the I2C signals, and represents the pin multiplexing configuration
using the pinctrl device tree bindings.  This may be used to select one I2C
IP core at runtime which may have a better feature set for a given task than
another I2C IP core on the SoC.  The most simple example is to fall back to
GPIO bitbanging if your current runtime configuration hits an errata of the
internal IP core.</p>
<pre><code>    +-------------------------------+
    | SoC                           |
    |                               |   +-----+  +-----+
    |   +------------+              |   | dev |  | dev |
    |   |I2C IP Core1|--\           |   +-----+  +-----+
    |   +------------+   \-------+  |      |        |
    |                    |Pinctrl|--|------+--------+
    |   +------------+   +-------+  |
    |   |I2C IP Core2|--/           |
    |   +------------+              |
    |                               |
    +-------------------------------+</code></pre>
</div>

<a id="dt-935ee547587f3e75de61"></a>

## All of these rules must match (<code>allOf</code>)

<a id="dt-d33de94ac1d3652cd22a"></a>

### Rule 1

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-95c8874f25311f4b1ab1">[<code>&#47;schemas&#47;i2c&#47;i2c&#45;controller&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-shared/i2c/i2c-controller.md#dt-root>)</span>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-5c1d81699dcbe840de83"></a>

### <code>compatible</code> — required here

**Exact value (<code>const</code>):** <span id="dt-1765195bf8e86c3ccec6"><code>&#34;i2c&#45;demux&#45;pinctrl&#34;</code></span>

<a id="dt-c6eea454035b5f9302a4"></a>

### <code>i2c&#45;parent</code> — required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-483fdd435500ca1c14bd">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;phandle&#45;array</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-8f5710c4314b4caa4970>)</span>

<a id="dt-8b8cbe24308b044b9cf5"></a>

#### Array item rules (<code>items</code>)

> **Maximum number of items (<code>maxItems</code>):** <span id="dt-e434b050915a0c9d84d2"><code>1</code></span>

<div id="dt-de3c238d7401b2094729">
<p style="white-space: pre-wrap">List of phandles of I2C masters available for selection.  The first one will be used as default.</p>
</div>

<a id="dt-fa3205ef3b34746aa163"></a>

### <code>i2c&#45;bus&#45;name</code> — required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-2f0f9509994ff425c7ce">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;string</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-2c695d502852c3a1e1b7>)</span>

<div id="dt-6574ea761841cc9b1dd2">
<p style="white-space: pre-wrap">The name of this bus.  Also needed as pinctrl-name for the I2C parents.</p>
</div>

**Required in this object (<code>required</code>):** <a id="dt-8313173ff1c9b300d560"></a> <span id="dt-048b70ee865d6847aa3d"><code>&#34;compatible&#34;</code></span>, <span id="dt-ee7433925c1528c16b99"><code>&#34;i2c&#45;parent&#34;</code></span>, <span id="dt-f3765998c4e103e45f2f"><code>&#34;i2c&#45;bus&#45;name&#34;</code></span>

<a id="dt-63ab525a9812ac23c446"></a>

## Properties not evaluated by applicable rules (<code>unevaluatedProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">#include &lt;dt-bindings/gpio/gpio.h&gt;
#include &lt;dt-bindings/interrupt-controller/irq.h&gt;

gpioi2c2: i2c-9 {
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;
    compatible = "i2c-gpio";
    scl-gpios = &lt;&amp;gpio5 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)&gt;;
    sda-gpios = &lt;&amp;gpio5 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)&gt;;
    i2c-gpio,delay-us = &lt;5&gt;;

    // The I2C controller must have its status "disabled".  The I2C bus
    // demultiplexer will enable it at runtime when needed.
    status = "disabled";
};

iic2: i2c@e6520000 {
    reg = &lt;0xe6520000 0x425&gt;;
    pinctrl-0 = &lt;&amp;iic2_pins&gt;;
    // The pinctrl property for the parent I2C controller needs a pinctrl
    // state with the same name as i2c-bus-name in the I2C bus demultiplexer
    // node, not "default"!
    pinctrl-names = "i2c-hdmi";

    clock-frequency = &lt;100000&gt;;

    // The I2C controller must have its status "disabled".  The I2C bus
    // demultiplexer will enable it at runtime when needed.
    status = "disabled";
};

i2c2: i2c@e6530000 {
    reg = &lt;0 0xe6530000 0 0x40&gt;;
    pinctrl-0 = &lt;&amp;i2c2_pins&gt;;
    // The pinctrl property for the parent I2C controller needs a pinctrl
    // state with the same name as i2c-bus-name in the I2C bus demultiplexer
    // node, not "default"!
    pinctrl-names = "i2c-hdmi";

    clock-frequency = &lt;100000&gt;;

    // The I2C controller must have its status "disabled".  The I2C bus
    // demultiplexer will enable it at runtime when needed.
    status = "disabled";
};

// Example for a bus to be demuxed.  It contains various I2C clients for
// HDMI, so the bus is named "i2c-hdmi":
i2chdmi: i2c-mux3 {
    compatible = "i2c-demux-pinctrl";
    i2c-parent = &lt;&amp;iic2&gt;, &lt;&amp;i2c2&gt;, &lt;&amp;gpioi2c2&gt;;
    i2c-bus-name = "i2c-hdmi";
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;

    ak4643: codec@12 {
        compatible = "asahi-kasei,ak4643";
        #sound-dai-cells = &lt;0&gt;;
        reg = &lt;0x12&gt;;
    };

    composite-in@20 {
        compatible = "adi,adv7180";
        reg = &lt;0x20&gt;;

        port {
            adv7180: endpoint {
                bus-width = &lt;8&gt;;
                remote-endpoint = &lt;&amp;vin1ep0&gt;;
            };
        };
    };

    hdmi@39 {
        compatible = "adi,adv7511w";
        reg = &lt;0x39&gt;;
        interrupt-parent = &lt;&amp;gpio1&gt;;
        interrupts = &lt;15 IRQ_TYPE_LEVEL_LOW&gt;;
        clocks = &lt;&amp;cec_clock&gt;;
        clock-names = "cec";

        avdd-supply = &lt;&amp;fixedregulator1v8&gt;;
        dvdd-supply = &lt;&amp;fixedregulator1v8&gt;;
        pvdd-supply = &lt;&amp;fixedregulator1v8&gt;;
        dvdd-3v-supply = &lt;&amp;fixedregulator3v3&gt;;
        bgvdd-supply = &lt;&amp;fixedregulator1v8&gt;;

        adi,input-depth = &lt;8&gt;;
        adi,input-colorspace = "rgb";
        adi,input-clock = "1x";

        ports {
            #address-cells = &lt;1&gt;;
            #size-cells = &lt;0&gt;;

            port@0 {
                reg = &lt;0&gt;;
                adv7511_in: endpoint {
                    remote-endpoint = &lt;&amp;lvds0_out&gt;;
                };
            };

            port@1 {
                reg = &lt;1&gt;;
                adv7511_out: endpoint {
                    remote-endpoint = &lt;&amp;hdmi_con_out&gt;;
                };
            };
        };
    };
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)</span></p>

</details>
