summaryrefslogtreecommitdiff
path: root/arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi
blob: d45f072f8cdf83626f129a00e268a458dcbf84e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2017 Ideas on Board <kieran.bingham@ideasonboard.com>
 * Copyright (C) 2021 Jacopo Mondi <jacopo+renesas@jmondi.org>
 *
 * Device Tree Source (overlay) that describes GMSL camera connected to
 * Fakra connectors for the Eagle V3M and Condor V3H (and compatible) boards.
 *
 * The following cameras are currently supported: RDACM20 and RDACM21.
 *
 * The board .dts file that include this has to select which cameras are in use
 * by specifying the camera model with:
 *
 * #define GMSL_CAMERA_RDACM20
 * or
 * #define GMSL_CAMERA_RDACM21
 *
 * And which cameras are connected to the board by defining:
 * for GMSL channel 0:
 *	   #define GMSL_CAMERA_0
 *	   #define GMSL_CAMERA_1
 *	   #define GMSL_CAMERA_2
 *	   #define GMSL_CAMERA_3
 *
 * for GMSL channel 1:
 *	   #define GMSL_CAMERA_4
 *	   #define GMSL_CAMERA_5
 *	   #define GMSL_CAMERA_6
 *	   #define GMSL_CAMERA_7
 */

#include <dt-bindings/gpio/gpio.h>

/* Validate the board file settings. */
#if !defined(GMSL_CAMERA_RDACM20) && !defined(GMSL_CAMERA_RDACM21)
#error "Camera model should be defined by the board file"
#endif

#if defined(GMSL_CAMERA_RDACM20) && defined(GMSL_CAMERA_RDACM21)
#error "A single camera model should be selected"
#endif

#if !defined(GMSL_CAMERA_0) && !defined(GMSL_CAMERA_1) && \
    !defined(GMSL_CAMERA_2) && !defined(GMSL_CAMERA_3) && \
    !defined(GMSL_CAMERA_4) && !defined(GMSL_CAMERA_5) && \
    !defined(GMSL_CAMERA_6) && !defined(GMSL_CAMERA_7)
#error "At least one camera should be selected"
#endif

/* Deduce from the enabled cameras which GMSL channels are active. */
#if defined(GMSL_CAMERA_0) || defined(GMSL_CAMERA_1) || \
    defined(GMSL_CAMERA_2) || defined(GMSL_CAMERA_3)
#define GMSL_0
#endif

#if defined(GMSL_CAMERA_4) || defined(GMSL_CAMERA_5) || \
    defined(GMSL_CAMERA_6) || defined(GMSL_CAMERA_7)
#define GMSL_1
#endif

/* Deduce the camera model compatible string. */
#if defined(GMSL_CAMERA_RDACM20)
#define GMSL_CAMERA_MODEL "imi,rdacm20"
#elif defined(GMSL_CAMERA_RDACM21)
#define GMSL_CAMERA_MODEL "imi,rdacm21"
#endif

#ifdef GMSL_0
&vin0 {
	status = "okay";
};

&vin1 {
	status = "okay";
};

&vin2 {
	status = "okay";
};

&vin3 {
	status = "okay";
};

&gmsl0 {
	status = "okay";

#if defined(GMSL_CAMERA_RDACM21)
	maxim,reverse-channel-microvolt = <100000>;
#endif

	ports {
#ifdef GMSL_CAMERA_0
		port@0 {
			max9286_in0: endpoint {
				remote-endpoint = <&fakra_con0>;
			};
		};
#endif

#ifdef GMSL_CAMERA_1
		port@1 {
			max9286_in1: endpoint{
				remote-endpoint = <&fakra_con1>;
			};

		};
#endif

#ifdef GMSL_CAMERA_2
		port@2 {
			max9286_in2: endpoint {
				remote-endpoint = <&fakra_con2>;
			};

		};
#endif

#ifdef GMSL_CAMERA_3
		port@3 {
			max9286_in3: endpoint {
				remote-endpoint = <&fakra_con3>;
			};

		};
#endif
	};

	i2c-mux {
#ifdef GMSL_CAMERA_0
		i2c@0 {
			status = "okay";

			camera@51 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x51>, <0x61>;

				port {
					fakra_con0: endpoint {
						remote-endpoint = <&max9286_in0>;
					};
				};
			};
		};
#endif

#ifdef GMSL_CAMERA_1
		i2c@1 {
			status = "okay";

			camera@52 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x52>, <0x62>;

				port {
					fakra_con1: endpoint {
						remote-endpoint = <&max9286_in1>;
					};
				};
			};
		};
#endif

#ifdef GMSL_CAMERA_2
		i2c@2 {
			status = "okay";

			camera@53 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x53>, <0x63>;

				port {
					fakra_con2: endpoint {
						remote-endpoint = <&max9286_in2>;
					};
				};
			};
		};
#endif

#ifdef GMSL_CAMERA_3
		i2c@3 {
			status = "okay";

			camera@54 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x54>, <0x64>;

				port {
					fakra_con3: endpoint {
						remote-endpoint = <&max9286_in3>;
					};
				};
			};
		};
#endif
	};
};
#endif /* ifdef GMSL_0 */

#ifdef GMSL_1
&vin4 {
	status = "okay";
};

&vin5 {
	status = "okay";
};

&vin6 {
	status = "okay";
};

&vin7 {
	status = "okay";
};

&gmsl1 {
	status = "okay";

#if defined(GMSL_CAMERA_RDACM21)
	maxim,reverse-channel-microvolt = <100000>;
#endif

	ports {
#ifdef GMSL_CAMERA_4
		port@0 {
			max9286_in4: endpoint {
				remote-endpoint = <&fakra_con4>;
			};
		};
#endif

#ifdef GMSL_CAMERA_5
		port@1 {
			max9286_in5: endpoint{
				remote-endpoint = <&fakra_con5>;
			};

		};
#endif

#ifdef GMSL_CAMERA_6
		port@2 {
			max9286_in6: endpoint {
				remote-endpoint = <&fakra_con6>;
			};

		};
#endif

#ifdef GMSL_CAMERA_7
		port@3 {
			max9286_in7: endpoint {
				remote-endpoint = <&fakra_con7>;
			};

		};
#endif
	};

	i2c-mux {
#ifdef GMSL_CAMERA_4
		i2c@0 {
			status = "okay";

			camera@55 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x55>, <0x65>;

				port {
					fakra_con4: endpoint {
						remote-endpoint = <&max9286_in4>;
					};
				};
			};
		};
#endif

#ifdef GMSL_CAMERA_5
		i2c@1 {
			status = "okay";

			camera@56 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x56>, <0x66>;

				port {
					fakra_con5: endpoint {
						remote-endpoint = <&max9286_in5>;
					};
				};
			};
		};
#endif

#ifdef GMSL_CAMERA_6
		i2c@2 {
			status = "okay";

			camera@57 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x57>, <0x67>;

				port {
					fakra_con6: endpoint {
						remote-endpoint = <&max9286_in6>;
					};
				};
			};
		};
#endif

#ifdef GMSL_CAMERA_7
		i2c@3 {
			status = "okay";

			camera@58 {
				compatible = GMSL_CAMERA_MODEL;
				reg = <0x58>, <0x68>;

				port {
					fakra_con7: endpoint {
						remote-endpoint = <&max9286_in7>;
					};
				};
			};
		};
#endif
	};
};
#endif /* ifdef GMSL_1 */