dtoverlays: Add overlays for the IMX708 image sensor
[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 imx708_0
116                                         #define cam_endpoint imx708_0_ep
117                                         #define vcm_node imx708_0_vcm
118                                         #define cam1_clk clk_24mhz
119                                         #include "imx708.dtsi"
120                                         #undef cam_node
121                                         #undef cam_endpoint
122                                         #undef vcm_node
123                                         #undef cam1_clk
124
125                                         #define cam_node ov5647_0
126                                         #define cam_endpoint ov5647_0_ep
127                                         #define cam1_clk clk_25mhz
128                                         #include "ov5647.dtsi"
129                                         #undef cam_node
130                                         #undef cam_endpoint
131                                         #undef cam1_clk
132
133                                         #define cam_node ov7251_0
134                                         #define cam_endpoint ov7251_0_ep
135                                         #define cam1_clk clk_24mhz
136                                         #include "ov7251.dtsi"
137                                         #undef cam_node
138                                         #undef cam_endpoint
139                                         #undef cam1_clk
140
141                                         #define cam_node ov9281_0
142                                         #define cam_endpoint ov9281_0_ep
143                                         #define cam1_clk clk_24mhz
144                                         #include "ov9281.dtsi"
145                                         #undef cam_node
146                                         #undef cam_endpoint
147                                         #undef cam1_clk
148
149                                         #define cam_node imx258_0
150                                         #define cam_endpoint imx258_0_ep
151                                         #define cam1_clk clk_24mhz
152                                         #include "imx258.dtsi"
153                                         #undef cam_node
154                                         #undef cam_endpoint
155                                         #undef cam1_clk
156
157                                         #define cam_node imx290_0
158                                         #define cam_endpoint imx290_0_ep
159                                         #define cam1_clk clk_imx290
160                                         #include "imx290_327.dtsi"
161                                         #undef cam_node
162                                         #undef cam_endpoint
163                                         #undef cam1_clk
164
165                                         #define cam_node ov2311_0
166                                         #define cam_endpoint ov2311_0_ep
167                                         #define cam1_clk clk_24mhz
168                                         #include "ov2311.dtsi"
169                                         #undef cam_node
170                                         #undef cam_endpoint
171                                         #undef cam1_clk
172                                 };
173
174                                 i2c@1 {
175                                         reg = <1>;
176                                         #address-cells = <1>;
177                                         #size-cells = <0>;
178
179                                         #define cam_node imx219_1
180                                         #define cam_endpoint imx219_1_ep
181                                         #define cam1_clk clk_24mhz
182                                         #include "imx219.dtsi"
183                                         #undef cam_node
184                                         #undef cam_endpoint
185                                         #undef cam1_clk
186
187                                         #define cam_node imx477_1
188                                         #define cam_endpoint imx477_1_ep
189                                         #define cam1_clk clk_24mhz
190                                         #include "imx477_378.dtsi"
191                                         #undef cam_node
192                                         #undef cam_endpoint
193                                         #undef cam1_clk
194
195                                         #define cam_node imx708_1
196                                         #define cam_endpoint imx708_1_ep
197                                         #define vcm_node imx708_1_vcm
198                                         #define cam1_clk clk_24mhz
199                                         #include "imx708.dtsi"
200                                         #undef cam_node
201                                         #undef cam_endpoint
202                                         #undef vcm_node
203                                         #undef cam1_clk
204
205                                         #define cam_node ov5647_1
206                                         #define cam_endpoint ov5647_1_ep
207                                         #define cam1_clk clk_25mhz
208                                         #include "ov5647.dtsi"
209                                         #undef cam_node
210                                         #undef cam_endpoint
211                                         #undef cam1_clk
212
213                                         #define cam_node ov7251_1
214                                         #define cam_endpoint ov7251_1_ep
215                                         #define cam1_clk clk_24mhz
216                                         #include "ov7251.dtsi"
217                                         #undef cam_node
218                                         #undef cam_endpoint
219                                         #undef cam1_clk
220
221                                         #define cam_node ov9281_1
222                                         #define cam_endpoint ov9281_1_ep
223                                         #define cam1_clk clk_24mhz
224                                         #include "ov9281.dtsi"
225                                         #undef cam_node
226                                         #undef cam_endpoint
227                                         #undef cam1_clk
228
229                                         #define cam_node imx258_1
230                                         #define cam_endpoint imx258_1_ep
231                                         #define cam1_clk clk_24mhz
232                                         #include "imx258.dtsi"
233                                         #undef cam_node
234                                         #undef cam_endpoint
235                                         #undef cam1_clk
236
237                                         #define cam_node imx290_1
238                                         #define cam_endpoint imx290_1_ep
239                                         #define cam1_clk clk_imx290
240                                         #include "imx290_327.dtsi"
241                                         #undef cam_node
242                                         #undef cam_endpoint
243                                         #undef cam1_clk
244
245                                         #define cam_node ov2311_1
246                                         #define cam_endpoint ov2311_1_ep
247                                         #define cam1_clk clk_24mhz
248                                         #include "ov2311.dtsi"
249                                         #undef cam_node
250                                         #undef cam_endpoint
251                                         #undef cam1_clk
252                                 };
253                         };
254                 };
255         };
256
257         fragment@201 {
258                 target = <&csi1>;
259                 __overlay__ {
260                         status = "okay";
261
262                         brcm,media-controller;
263
264                         port {
265                                 csi1_ep: endpoint {
266                                         remote-endpoint = <&mux_out>;
267                                         clock-lanes = <0>;
268                                         data-lanes = <1 2>;
269                                 };
270                         };
271                 };
272         };
273
274         fragment@202 {
275                 target = <&i2c0if>;
276                 __overlay__ {
277                         status = "okay";
278                 };
279         };
280
281         fragment@203 {
282                 target-path="/";
283                 __overlay__ {
284                         mux: mux-controller {
285                                 compatible = "gpio-mux";
286                                 #mux-control-cells = <0>;
287
288                                 mux-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
289                         };
290
291                         video-mux {
292                                 compatible = "video-mux";
293                                 mux-controls = <&mux>;
294                                 #address-cells = <1>;
295                                 #size-cells = <0>;
296
297                                 port@0 {
298                                         reg = <0>;
299
300                                         mux_in0: endpoint {
301                                                 clock-lanes = <0>;
302                                         };
303                                 };
304
305                                 port@1 {
306                                         reg = <1>;
307
308                                         mux_in1: endpoint {
309                                                 clock-lanes = <0>;
310                                         };
311                                 };
312
313                                 port@2 {
314                                         reg = <2>;
315
316                                         mux_out: endpoint {
317                                                 remote-endpoint = <&csi1_ep>;
318                                                 clock-lanes = <0>;
319                                         };
320                                 };
321                         };
322
323                         clk_24mhz: clk_24mhz {
324                                 compatible = "fixed-clock";
325                                 #clock-cells = <0>;
326
327                                 clock-frequency = <24000000>;
328                                 status = "okay";
329                         };
330
331                         clk_25mhz: clk_25mhz {
332                                 compatible = "fixed-clock";
333                                 #clock-cells = <0>;
334
335                                 clock-frequency = <25000000>;
336                                 status = "okay";
337                         };
338
339                         clk_imx290: clk_imx290 {
340                                 compatible = "fixed-clock";
341                                 #clock-cells = <0>;
342
343                                 clock-frequency = <37125000>;
344                                 status = "okay";
345                         };
346                 };
347         };
348
349         fragment@204 {
350                 target = <&i2c0mux>;
351                 __overlay__ {
352                         status = "okay";
353                 };
354         };
355
356         fragment@205 {
357                 target = <&gpio>;
358                 __overlay__ {
359                         mipi_sw_oe_hog {
360                                 gpio-hog;
361                                 gpios = <17 GPIO_ACTIVE_LOW>;
362                                 output-high;
363                         };
364                 };
365         };
366
367         __overrides__ {
368                 cam0-imx219 = <&mux_in0>, "remote-endpoint:0=",<&imx219_0_ep>,
369                               <&imx219_0_ep>, "remote-endpoint:0=",<&mux_in0>,
370                               <&mux_in0>, "clock-noncontinuous?",
371                               <&imx219_0>, "status=okay";
372                 cam0-imx477 = <&mux_in0>, "remote-endpoint:0=",<&imx477_0_ep>,
373                               <&imx477_0_ep>, "remote-endpoint:0=",<&mux_in0>,
374                               <&mux_in0>, "clock-noncontinuous?",
375                               <&imx477_0>, "status=okay";
376                 cam0-imx708 = <&mux_in0>, "remote-endpoint:0=",<&imx708_0_ep>,
377                               <&imx708_0_ep>, "remote-endpoint:0=",<&mux_in0>,
378                               <&mux_in0>, "clock-noncontinuous?",
379                               <&imx708_0>, "status=okay",
380                               <&imx708_0_vcm>, "status=okay",
381                               <&imx708_0>,"lens-focus:0=", <&imx708_0_vcm>;
382                 cam0-ov5647 = <&mux_in0>, "remote-endpoint:0=",<&ov5647_0_ep>,
383                               <&ov5647_0_ep>, "remote-endpoint:0=",<&mux_in0>,
384                               <&ov5647_0>, "status=okay";
385                 cam0-ov7251 = <&mux_in0>, "remote-endpoint:0=",<&ov7251_0_ep>,
386                               <&ov7251_0_ep>, "remote-endpoint:0=",<&mux_in0>,
387                               <&ov7251_0>, "status=okay",
388                               <0>,"+100-101";
389                 cam0-ov9281 = <&mux_in0>, "remote-endpoint:0=",<&ov9281_0_ep>,
390                               <&ov9281_0_ep>, "remote-endpoint:0=",<&mux_in0>,
391                               <&ov9281_0>, "status=okay";
392                 cam0-imx258 = <&mux_in0>, "remote-endpoint:0=",<&imx258_0_ep>,
393                               <&imx258_0_ep>, "remote-endpoint:0=",<&mux_in0>,
394                               <&imx258_0>, "status=okay";
395                 cam0-imx290 = <&mux_in0>, "remote-endpoint:0=",<&imx290_0_ep>,
396                               <&imx290_0_ep>, "remote-endpoint:0=",<&mux_in0>,
397                               <&imx290_0>, "status=okay";
398                 cam0-ov2311 = <&mux_in0>, "remote-endpoint:0=",<&ov2311_0_ep>,
399                               <&ov2311_0_ep>, "remote-endpoint:0=",<&mux_in0>,
400                               <&ov2311_0>, "status=okay";
401
402                 cam1-imx219 = <&mux_in1>, "remote-endpoint:0=",<&imx219_1_ep>,
403                               <&imx219_1_ep>, "remote-endpoint:0=",<&mux_in1>,
404                               <&mux_in1>, "clock-noncontinuous?",
405                               <&imx219_1>, "status=okay";
406                 cam1-imx477 = <&mux_in1>, "remote-endpoint:0=",<&imx477_1_ep>,
407                               <&imx477_1_ep>, "remote-endpoint:0=",<&mux_in1>,
408                               <&mux_in1>, "clock-noncontinuous?",
409                               <&imx477_1>, "status=okay";
410                 cam1-imx708 = <&mux_in1>, "remote-endpoint:0=",<&imx708_1_ep>,
411                               <&imx708_1_ep>, "remote-endpoint:0=",<&mux_in1>,
412                               <&mux_in1>, "clock-noncontinuous?",
413                               <&imx708_1>, "status=okay",
414                               <&imx708_1_vcm>, "status=okay",
415                               <&imx708_1>,"lens-focus:0=", <&imx708_1_vcm>;
416                 cam1-ov5647 = <&mux_in1>, "remote-endpoint:0=",<&ov5647_1_ep>,
417                               <&ov5647_1_ep>, "remote-endpoint:0=",<&mux_in1>,
418                               <&ov5647_1>, "status=okay";
419                 cam1-ov7251 = <&mux_in1>, "remote-endpoint:0=",<&ov7251_1_ep>,
420                               <&ov7251_1_ep>, "remote-endpoint:0=",<&mux_in1>,
421                               <&ov7251_1>, "status=okay",
422                               <0>,"+102-103";
423                 cam1-ov9281 = <&mux_in1>, "remote-endpoint:0=",<&ov9281_1_ep>,
424                               <&ov9281_1_ep>, "remote-endpoint:0=",<&mux_in1>,
425                               <&ov9281_1>, "status=okay";
426                 cam1-imx258 = <&mux_in1>, "remote-endpoint:0=",<&imx258_1_ep>,
427                               <&imx258_1_ep>, "remote-endpoint:0=",<&mux_in1>,
428                               <&imx258_1>, "status=okay";
429                 cam1-imx290 = <&mux_in1>, "remote-endpoint:0=",<&imx290_1_ep>,
430                               <&imx290_1_ep>, "remote-endpoint:0=",<&mux_in1>,
431                               <&imx290_1>, "status=okay";
432                 cam1-ov2311 = <&mux_in1>, "remote-endpoint:0=",<&ov2311_1_ep>,
433                               <&ov2311_1_ep>, "remote-endpoint:0=",<&mux_in1>,
434                               <&ov2311_1>, "status=okay";
435
436                 cam0-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
437                                        <&imx290_0>,"clock-frequency:0";
438                 cam1-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
439                                        <&imx290_1>,"clock-frequency:0";
440         };
441 };