Merge tag 'v5.15.57' into rpi-5.15.y
[platform/kernel/linux-rpi.git] / arch / arm / boot / dts / overlays / camera-mux-2port-overlay.dts
1 // SPDX-License-Identifier: GPL-2.0-only
2 // Overlay to configure a 2 port camera multiplexer
3 //
4 // Configuration is based on the Arducam Doubleplexer
5 // which uses a PCA9543 I2C multiplexer to handle the
6 // I2C, and GPIO 4 to control the MIPI mux, and GPIO 17
7 // to enable the CSI-2 mux output (gpio-hog).
8
9 /dts-v1/;
10 /plugin/;
11
12 #include <dt-bindings/gpio/gpio.h>
13
14 /{
15         compatible = "brcm,bcm2835";
16
17         /* Fragments that complete the individual sensor fragments */
18         /* IMX290 */
19         fragment@0 {
20                 target = <&imx290_0_ep>;
21                 __overlay__ {
22                         data-lanes = <1 2>;
23                         link-frequencies =
24                                 /bits/ 64 <445500000 297000000>;
25                 };
26         };
27
28         fragment@1 {
29                 target = <&imx290_1_ep>;
30                 __overlay__ {
31                         data-lanes = <1 2>;
32                         link-frequencies =
33                                 /bits/ 64 <445500000 297000000>;
34                 };
35         };
36
37         /* IMX477 */
38         fragment@10 {
39                 target = <&imx477_0>;
40                 __overlay__ {
41                         compatible = "sony,imx477";
42                 };
43         };
44
45         fragment@11 {
46                 target = <&imx477_1>;
47                 __overlay__ {
48                         compatible = "sony,imx477";
49                 };
50         };
51
52         /* Additional fragments affecting the mux nodes */
53         fragment@100 {
54                 target = <&mux_in0>;
55                 __dormant__ {
56                         data-lanes = <1>;
57                 };
58         };
59         fragment@101 {
60                 target = <&mux_in0>;
61                 __overlay__ {
62                         data-lanes = <1 2>;
63                 };
64         };
65
66         fragment@102 {
67                 target = <&mux_in1>;
68                 __dormant__ {
69                         data-lanes = <1>;
70                 };
71         };
72         fragment@103 {
73                 target = <&mux_in1>;
74                 __overlay__ {
75                         data-lanes = <1 2>;
76                 };
77         };
78
79         /* Mux define */
80         fragment@200 {
81                 target = <&i2c_csi_dsi>;
82                 __overlay__ {
83                         #address-cells = <1>;
84                         #size-cells = <0>;
85                         status = "okay";
86
87                         pca@70 {
88                                 reg = <0x70>;
89                                 compatible = "nxp,pca9543";
90
91                                 #address-cells = <1>;
92                                 #size-cells = <0>;
93
94                                 i2c@0 {
95                                         reg = <0>;
96                                         #address-cells = <1>;
97                                         #size-cells = <0>;
98
99                                         #define cam_node imx219_0
100                                         #define cam_endpoint imx219_0_ep
101                                         #define cam1_clk clk_24mhz
102                                         #include "imx219.dtsi"
103                                         #undef cam_node
104                                         #undef cam_endpoint
105                                         #undef cam1_clk
106
107                                         #define cam_node imx477_0
108                                         #define cam_endpoint imx477_0_ep
109                                         #define cam1_clk clk_24mhz
110                                         #include "imx477_378.dtsi"
111                                         #undef cam_node
112                                         #undef cam_endpoint
113                                         #undef cam1_clk
114
115                                         #define cam_node ov5647_0
116                                         #define cam_endpoint ov5647_0_ep
117                                         #define cam1_clk clk_25mhz
118                                         #include "ov5647.dtsi"
119                                         #undef cam_node
120                                         #undef cam_endpoint
121                                         #undef cam1_clk
122
123                                         #define cam_node ov7251_0
124                                         #define cam_endpoint ov7251_0_ep
125                                         #define cam1_clk clk_24mhz
126                                         #include "ov7251.dtsi"
127                                         #undef cam_node
128                                         #undef cam_endpoint
129                                         #undef cam1_clk
130
131                                         #define cam_node ov9281_0
132                                         #define cam_endpoint ov9281_0_ep
133                                         #define cam1_clk clk_24mhz
134                                         #include "ov9281.dtsi"
135                                         #undef cam_node
136                                         #undef cam_endpoint
137                                         #undef cam1_clk
138
139                                         #define cam_node imx258_0
140                                         #define cam_endpoint imx258_0_ep
141                                         #define cam1_clk clk_24mhz
142                                         #include "imx258.dtsi"
143                                         #undef cam_node
144                                         #undef cam_endpoint
145                                         #undef cam1_clk
146
147                                         #define cam_node imx290_0
148                                         #define cam_endpoint imx290_0_ep
149                                         #define cam1_clk clk_imx290
150                                         #include "imx290_327.dtsi"
151                                         #undef cam_node
152                                         #undef cam_endpoint
153                                         #undef cam1_clk
154
155                                         #define cam_node ov2311_0
156                                         #define cam_endpoint ov2311_0_ep
157                                         #define cam1_clk clk_24mhz
158                                         #include "ov2311.dtsi"
159                                         #undef cam_node
160                                         #undef cam_endpoint
161                                         #undef cam1_clk
162                                 };
163
164                                 i2c@1 {
165                                         reg = <1>;
166                                         #address-cells = <1>;
167                                         #size-cells = <0>;
168
169                                         #define cam_node imx219_1
170                                         #define cam_endpoint imx219_1_ep
171                                         #define cam1_clk clk_24mhz
172                                         #include "imx219.dtsi"
173                                         #undef cam_node
174                                         #undef cam_endpoint
175                                         #undef cam1_clk
176
177                                         #define cam_node imx477_1
178                                         #define cam_endpoint imx477_1_ep
179                                         #define cam1_clk clk_24mhz
180                                         #include "imx477_378.dtsi"
181                                         #undef cam_node
182                                         #undef cam_endpoint
183                                         #undef cam1_clk
184
185                                         #define cam_node ov5647_1
186                                         #define cam_endpoint ov5647_1_ep
187                                         #define cam1_clk clk_25mhz
188                                         #include "ov5647.dtsi"
189                                         #undef cam_node
190                                         #undef cam_endpoint
191                                         #undef cam1_clk
192
193                                         #define cam_node ov7251_1
194                                         #define cam_endpoint ov7251_1_ep
195                                         #define cam1_clk clk_24mhz
196                                         #include "ov7251.dtsi"
197                                         #undef cam_node
198                                         #undef cam_endpoint
199                                         #undef cam1_clk
200
201                                         #define cam_node ov9281_1
202                                         #define cam_endpoint ov9281_1_ep
203                                         #define cam1_clk clk_24mhz
204                                         #include "ov9281.dtsi"
205                                         #undef cam_node
206                                         #undef cam_endpoint
207                                         #undef cam1_clk
208
209                                         #define cam_node imx258_1
210                                         #define cam_endpoint imx258_1_ep
211                                         #define cam1_clk clk_24mhz
212                                         #include "imx258.dtsi"
213                                         #undef cam_node
214                                         #undef cam_endpoint
215                                         #undef cam1_clk
216
217                                         #define cam_node imx290_1
218                                         #define cam_endpoint imx290_1_ep
219                                         #define cam1_clk clk_imx290
220                                         #include "imx290_327.dtsi"
221                                         #undef cam_node
222                                         #undef cam_endpoint
223                                         #undef cam1_clk
224
225                                         #define cam_node ov2311_1
226                                         #define cam_endpoint ov2311_1_ep
227                                         #define cam1_clk clk_24mhz
228                                         #include "ov2311.dtsi"
229                                         #undef cam_node
230                                         #undef cam_endpoint
231                                         #undef cam1_clk
232                                 };
233                         };
234                 };
235         };
236
237         fragment@201 {
238                 target = <&csi1>;
239                 __overlay__ {
240                         status = "okay";
241
242                         brcm,media-controller;
243
244                         port {
245                                 csi1_ep: endpoint {
246                                         remote-endpoint = <&mux_out>;
247                                         clock-lanes = <0>;
248                                         data-lanes = <1 2>;
249                                 };
250                         };
251                 };
252         };
253
254         fragment@202 {
255                 target = <&i2c0if>;
256                 __overlay__ {
257                         status = "okay";
258                 };
259         };
260
261         fragment@203 {
262                 target-path="/";
263                 __overlay__ {
264                         mux: mux-controller {
265                                 compatible = "gpio-mux";
266                                 #mux-control-cells = <0>;
267
268                                 mux-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
269                         };
270
271                         video-mux {
272                                 compatible = "video-mux";
273                                 mux-controls = <&mux>;
274                                 #address-cells = <1>;
275                                 #size-cells = <0>;
276
277                                 port@0 {
278                                         reg = <0>;
279
280                                         mux_in0: endpoint {
281                                                 clock-lanes = <0>;
282                                         };
283                                 };
284
285                                 port@1 {
286                                         reg = <1>;
287
288                                         mux_in1: endpoint {
289                                                 clock-lanes = <0>;
290                                         };
291                                 };
292
293                                 port@2 {
294                                         reg = <2>;
295
296                                         mux_out: endpoint {
297                                                 remote-endpoint = <&csi1_ep>;
298                                                 clock-lanes = <0>;
299                                         };
300                                 };
301                         };
302
303                         clk_24mhz: clk_24mhz {
304                                 compatible = "fixed-clock";
305                                 #clock-cells = <0>;
306
307                                 clock-frequency = <24000000>;
308                                 status = "okay";
309                         };
310
311                         clk_25mhz: clk_25mhz {
312                                 compatible = "fixed-clock";
313                                 #clock-cells = <0>;
314
315                                 clock-frequency = <25000000>;
316                                 status = "okay";
317                         };
318
319                         clk_imx290: clk_imx290 {
320                                 compatible = "fixed-clock";
321                                 #clock-cells = <0>;
322
323                                 clock-frequency = <37125000>;
324                                 status = "okay";
325                         };
326                 };
327         };
328
329         fragment@204 {
330                 target = <&i2c0mux>;
331                 __overlay__ {
332                         status = "okay";
333                 };
334         };
335
336         fragment@205 {
337                 target = <&gpio>;
338                 __overlay__ {
339                         mipi_sw_oe_hog {
340                                 gpio-hog;
341                                 gpios = <17 GPIO_ACTIVE_LOW>;
342                                 output-high;
343                         };
344                 };
345         };
346
347         __overrides__ {
348                 cam0-imx219 = <&mux_in0>, "remote-endpoint:0=",<&imx219_0_ep>,
349                               <&imx219_0_ep>, "remote-endpoint:0=",<&mux_in0>,
350                               <&mux_in0>, "clock-noncontinuous?",
351                               <&imx219_0>, "status=okay";
352                 cam0-imx477 = <&mux_in0>, "remote-endpoint:0=",<&imx477_0_ep>,
353                               <&imx477_0_ep>, "remote-endpoint:0=",<&mux_in0>,
354                               <&mux_in0>, "clock-noncontinuous?",
355                               <&imx477_0>, "status=okay";
356                 cam0-ov5647 = <&mux_in0>, "remote-endpoint:0=",<&ov5647_0_ep>,
357                               <&ov5647_0_ep>, "remote-endpoint:0=",<&mux_in0>,
358                               <&ov5647_0>, "status=okay";
359                 cam0-ov7251 = <&mux_in0>, "remote-endpoint:0=",<&ov7251_0_ep>,
360                               <&ov7251_0_ep>, "remote-endpoint:0=",<&mux_in0>,
361                               <&ov7251_0>, "status=okay",
362                               <0>,"+100-101";
363                 cam0-ov9281 = <&mux_in0>, "remote-endpoint:0=",<&ov9281_0_ep>,
364                               <&ov9281_0_ep>, "remote-endpoint:0=",<&mux_in0>,
365                               <&ov9281_0>, "status=okay";
366                 cam0-imx258 = <&mux_in0>, "remote-endpoint:0=",<&imx258_0_ep>,
367                               <&imx258_0_ep>, "remote-endpoint:0=",<&mux_in0>,
368                               <&imx258_0>, "status=okay";
369                 cam0-imx290 = <&mux_in0>, "remote-endpoint:0=",<&imx290_0_ep>,
370                               <&imx290_0_ep>, "remote-endpoint:0=",<&mux_in0>,
371                               <&imx290_0>, "status=okay";
372                 cam0-ov2311 = <&mux_in0>, "remote-endpoint:0=",<&ov2311_0_ep>,
373                               <&ov2311_0_ep>, "remote-endpoint:0=",<&mux_in0>,
374                               <&ov2311_0>, "status=okay";
375
376                 cam1-imx219 = <&mux_in1>, "remote-endpoint:0=",<&imx219_1_ep>,
377                               <&imx219_1_ep>, "remote-endpoint:0=",<&mux_in1>,
378                               <&mux_in1>, "clock-noncontinuous?",
379                               <&imx219_1>, "status=okay";
380                 cam1-imx477 = <&mux_in1>, "remote-endpoint:0=",<&imx477_1_ep>,
381                               <&imx477_1_ep>, "remote-endpoint:0=",<&mux_in1>,
382                               <&mux_in1>, "clock-noncontinuous?",
383                               <&imx477_1>, "status=okay";
384                 cam1-ov5647 = <&mux_in1>, "remote-endpoint:0=",<&ov5647_1_ep>,
385                               <&ov5647_1_ep>, "remote-endpoint:0=",<&mux_in1>,
386                               <&ov5647_1>, "status=okay";
387                 cam1-ov7251 = <&mux_in1>, "remote-endpoint:0=",<&ov7251_1_ep>,
388                               <&ov7251_1_ep>, "remote-endpoint:0=",<&mux_in1>,
389                               <&ov7251_1>, "status=okay",
390                               <0>,"+102-103";
391                 cam1-ov9281 = <&mux_in1>, "remote-endpoint:0=",<&ov9281_1_ep>,
392                               <&ov9281_1_ep>, "remote-endpoint:0=",<&mux_in1>,
393                               <&ov9281_1>, "status=okay";
394                 cam1-imx258 = <&mux_in1>, "remote-endpoint:0=",<&imx258_1_ep>,
395                               <&imx258_1_ep>, "remote-endpoint:0=",<&mux_in1>,
396                               <&imx258_1>, "status=okay";
397                 cam1-imx290 = <&mux_in1>, "remote-endpoint:0=",<&imx290_1_ep>,
398                               <&imx290_1_ep>, "remote-endpoint:0=",<&mux_in1>,
399                               <&imx290_1>, "status=okay";
400                 cam1-ov2311 = <&mux_in1>, "remote-endpoint:0=",<&ov2311_1_ep>,
401                               <&ov2311_1_ep>, "remote-endpoint:0=",<&mux_in1>,
402                               <&ov2311_1>, "status=okay";
403
404                 cam0-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
405                                        <&imx290_0>,"clock-frequency:0";
406                 cam1-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
407                                        <&imx290_1>,"clock-frequency:0";
408         };
409 };