i2c: mux: demux-pinctrl: add driver
[cascardo/linux.git] / Documentation / devicetree / bindings / i2c / i2c-demux-pinctrl.txt
1 Pinctrl-based I2C Bus DeMux
2
3 This binding describes an I2C bus demultiplexer that uses pin multiplexing to
4 route the I2C signals, and represents the pin multiplexing configuration using
5 the pinctrl device tree bindings. This may be used to select one I2C IP core at
6 runtime which may have a better feature set for a given task than another I2C
7 IP core on the SoC. The most simple example is to fall back to GPIO bitbanging
8 if your current runtime configuration hits an errata of the internal IP core.
9
10     +-------------------------------+
11     | SoC                           |
12     |                               |   +-----+  +-----+
13     |   +------------+              |   | dev |  | dev |
14     |   |I2C IP Core1|--\           |   +-----+  +-----+
15     |   +------------+   \-------+  |      |        |
16     |                    |Pinctrl|--|------+--------+
17     |   +------------+   +-------+  |
18     |   |I2C IP Core2|--/           |
19     |   +------------+              |
20     |                               |
21     +-------------------------------+
22
23 Required properties:
24 - compatible: "i2c-demux-pinctrl"
25 - i2c-parent: List of phandles of I2C masters available for selection. The first
26               one will be used as default.
27 - i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C
28                 parents.
29
30 Furthermore, I2C mux properties and child nodes. See mux.txt in this directory.
31
32 Example:
33
34 Here is a snipplet for a bus to be demuxed. It contains various i2c clients for
35 HDMI, so the bus is named "i2c-hdmi":
36
37         i2chdmi: i2c@8 {
38
39                 compatible = "i2c-demux-pinctrl";
40                 i2c-parent = <&gpioi2c>, <&iic2>, <&i2c2>;
41                 i2c-bus-name = "i2c-hdmi";
42                 #address-cells = <1>;
43                 #size-cells = <0>;
44
45                 ak4643: sound-codec@12 {
46                         compatible = "asahi-kasei,ak4643";
47
48                         #sound-dai-cells = <0>;
49                         reg = <0x12>;
50                 };
51
52                 composite-in@20 {
53                         compatible = "adi,adv7180";
54                         reg = <0x20>;
55                         remote = <&vin1>;
56
57                         port {
58                                 adv7180: endpoint {
59                                         bus-width = <8>;
60                                         remote-endpoint = <&vin1ep0>;
61                                 };
62                         };
63                 };
64
65                 hdmi@39 {
66                         compatible = "adi,adv7511w";
67                         reg = <0x39>;
68                         interrupt-parent = <&gpio1>;
69                         interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
70
71                         adi,input-depth = <8>;
72                         adi,input-colorspace = "rgb";
73                         adi,input-clock = "1x";
74                         adi,input-style = <1>;
75                         adi,input-justification = "evenly";
76
77                         ports {
78                                 #address-cells = <1>;
79                                 #size-cells = <0>;
80
81                                 port@0 {
82                                         reg = <0>;
83                                         adv7511_in: endpoint {
84                                                 remote-endpoint = <&du_out_lvds0>;
85                                         };
86                                 };
87
88                                 port@1 {
89                                         reg = <1>;
90                                         adv7511_out: endpoint {
91                                                 remote-endpoint = <&hdmi_con>;
92                                         };
93                                 };
94                         };
95                 };
96         };
97
98 And for clarification, here are the snipplets for the i2c-parents:
99
100         gpioi2c: i2c@9 {
101                 #address-cells = <1>;
102                 #size-cells = <0>;
103                 compatible = "i2c-gpio";
104                 status = "disabled";
105                 gpios = <&gpio5 6 GPIO_ACTIVE_HIGH /* sda */
106                          &gpio5 5 GPIO_ACTIVE_HIGH /* scl */
107                         >;
108                 i2c-gpio,delay-us = <5>;
109         };
110
111 ...
112
113 &i2c2   {
114         pinctrl-0 = <&i2c2_pins>;
115         pinctrl-names = "i2c-hdmi";
116
117         clock-frequency = <100000>;
118 };
119
120 ...
121
122 &iic2   {
123         pinctrl-0 = <&iic2_pins>;
124         pinctrl-names = "i2c-hdmi";
125
126         clock-frequency = <100000>;
127 };
128
129 Please note:
130
131 - pinctrl properties for the parent I2C controllers need a pinctrl state
132   with the same name as i2c-bus-name, not "default"!
133
134 - the i2c masters must have their status "disabled". This driver will
135   enable them at runtime when needed.