3ef3c358c1171d0c4f115ab72d2072e56a133d1f
[openwrt/staging/linusw.git] /
1 From f833b2697388eed0eae00fd2a027178d4beee6ec Mon Sep 17 00:00:00 2001
2 From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
3 Date: Thu, 20 Jul 2023 13:18:34 +0200
4 Subject: [PATCH 0770/1085] overlays: Add overlay for the OV64A40 Arducam
5 Camera Module
6
7 Arducam have integrated an Omnivision OV64A40 with a ROHM BU64754 VCM
8 with a Raspberry Pi compatible cable pinout.
9
10 Provide an overlay to support the module.
11
12 Also add support to the camera mux overlays.
13
14 Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
15 Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
16 ---
17 arch/arm/boot/dts/overlays/Makefile | 1 +
18 arch/arm/boot/dts/overlays/README | 25 +++++
19 .../dts/overlays/camera-mux-2port-overlay.dts | 32 +++++++
20 .../dts/overlays/camera-mux-4port-overlay.dts | 64 +++++++++++++
21 .../arm/boot/dts/overlays/ov64a40-overlay.dts | 91 +++++++++++++++++++
22 arch/arm/boot/dts/overlays/ov64a40.dtsi | 34 +++++++
23 6 files changed, 247 insertions(+)
24 create mode 100644 arch/arm/boot/dts/overlays/ov64a40-overlay.dts
25 create mode 100644 arch/arm/boot/dts/overlays/ov64a40.dtsi
26
27 --- a/arch/arm/boot/dts/overlays/Makefile
28 +++ b/arch/arm/boot/dts/overlays/Makefile
29 @@ -175,6 +175,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
30 mz61581.dtbo \
31 ov2311.dtbo \
32 ov5647.dtbo \
33 + ov64a40.dtbo \
34 ov7251.dtbo \
35 ov9281.dtbo \
36 papirus.dtbo \
37 --- a/arch/arm/boot/dts/overlays/README
38 +++ b/arch/arm/boot/dts/overlays/README
39 @@ -817,6 +817,7 @@ Params: cam0-arducam-64mp Select A
40 cam0-imx708 Select IMX708 for camera on port 0
41 cam0-ov2311 Select OV2311 for camera on port 0
42 cam0-ov5647 Select OV5647 for camera on port 0
43 + cam0-ov64a40 Select OV64A40 for camera on port 0
44 cam0-ov7251 Select OV7251 for camera on port 0
45 cam0-ov9281 Select OV9281 for camera on port 0
46 cam0-imx290-clk-freq Set clock frequency for an IMX290 on port 0
47 @@ -829,6 +830,7 @@ Params: cam0-arducam-64mp Select A
48 cam1-imx708 Select IMX708 for camera on port 1
49 cam1-ov2311 Select OV2311 for camera on port 1
50 cam1-ov5647 Select OV5647 for camera on port 1
51 + cam1-ov64a40 Select OV64A40 for camera on port 1
52 cam1-ov7251 Select OV7251 for camera on port 1
53 cam1-ov9281 Select OV9281 for camera on port 1
54 cam1-imx290-clk-freq Set clock frequency for an IMX290 on port 1
55 @@ -850,6 +852,7 @@ Params: cam0-arducam-64mp Select A
56 cam0-imx708 Select IMX708 for camera on port 0
57 cam0-ov2311 Select OV2311 for camera on port 0
58 cam0-ov5647 Select OV5647 for camera on port 0
59 + cam0-ov64a40 Select OV64A40 for camera on port 0
60 cam0-ov7251 Select OV7251 for camera on port 0
61 cam0-ov9281 Select OV9281 for camera on port 0
62 cam0-imx290-clk-freq Set clock frequency for an IMX290 on port 0
63 @@ -862,6 +865,7 @@ Params: cam0-arducam-64mp Select A
64 cam1-imx708 Select IMX708 for camera on port 1
65 cam1-ov2311 Select OV2311 for camera on port 1
66 cam1-ov5647 Select OV5647 for camera on port 1
67 + cam1-ov64a40 Select OV64A40 for camera on port 1
68 cam1-ov7251 Select OV7251 for camera on port 1
69 cam1-ov9281 Select OV9281 for camera on port 1
70 cam1-imx290-clk-freq Set clock frequency for an IMX290 on port 1
71 @@ -874,6 +878,7 @@ Params: cam0-arducam-64mp Select A
72 cam2-imx708 Select IMX708 for camera on port 2
73 cam2-ov2311 Select OV2311 for camera on port 2
74 cam2-ov5647 Select OV5647 for camera on port 2
75 + cam2-ov64a40 Select OV64A40 for camera on port 2
76 cam2-ov7251 Select OV7251 for camera on port 2
77 cam2-ov9281 Select OV9281 for camera on port 2
78 cam2-imx290-clk-freq Set clock frequency for an IMX290 on port 2
79 @@ -886,6 +891,7 @@ Params: cam0-arducam-64mp Select A
80 cam3-imx708 Select IMX708 for camera on port 3
81 cam3-ov2311 Select OV2311 for camera on port 3
82 cam3-ov5647 Select OV5647 for camera on port 3
83 + cam3-ov64a40 Select OV64A40 for camera on port 3
84 cam3-ov7251 Select OV7251 for camera on port 3
85 cam3-ov9281 Select OV9281 for camera on port 3
86 cam3-imx290-clk-freq Set clock frequency for an IMX290 on port 3
87 @@ -3222,6 +3228,25 @@ Params: rotation Mounting
88 vcm Configure a VCM focus drive on the sensor.
89
90
91 +Name: ov64a40
92 +Info: Arducam OV64A40 camera module.
93 + Uses Unicam 1, which is the standard camera connector on most Pi
94 + variants.
95 +Load: dtoverlay=ov64a40,<param>=<val>
96 +Params: rotation Mounting rotation of the camera sensor (0 or
97 + 180, default 0)
98 + orientation Sensor orientation (0 = front, 1 = rear,
99 + 2 = external, default external)
100 + media-controller Configure use of Media Controller API for
101 + configuring the sensor (default on)
102 + cam0 Adopt the default configuration for CAM0 on a
103 + Compute Module (CSI0, i2c_vc, and cam0_reg).
104 + vcm Select lens driver state. Default is enabled,
105 + but vcm=off will disable.
106 + link-frequency Allowable link frequency values to use in Hz:
107 + 456000000 (default), 360000000
108 +
109 +
110 Name: ov7251
111 Info: Omnivision OV7251 camera module.
112 Uses Unicam 1, which is the standard camera connector on most Pi
113 --- a/arch/arm/boot/dts/overlays/camera-mux-2port-overlay.dts
114 +++ b/arch/arm/boot/dts/overlays/camera-mux-2port-overlay.dts
115 @@ -189,6 +189,16 @@
116 #undef cam_node
117 #undef cam_endpoint
118 #undef cam1_clk
119 +
120 + #define cam_node ov64a40_0
121 + #define cam_endpoint ov64a40_0_ep
122 + #define vcm_node ov64a40_0_vcm
123 + #define cam1_clk clk_24mhz
124 + #include "ov64a40.dtsi"
125 + #undef cam_node
126 + #undef cam_endpoint
127 + #undef vcm_node
128 + #undef cam1_clk
129 };
130
131 i2c@1 {
132 @@ -289,6 +299,16 @@
133 #undef cam_node
134 #undef cam_endpoint
135 #undef cam1_clk
136 +
137 + #define cam_node ov64a40_1
138 + #define cam_endpoint ov64a40_1_ep
139 + #define vcm_node ov64a40_1_vcm
140 + #define cam1_clk clk_24mhz
141 + #include "ov64a40.dtsi"
142 + #undef cam_node
143 + #undef cam_endpoint
144 + #undef vcm_node
145 + #undef cam1_clk
146 };
147 };
148 };
149 @@ -450,6 +470,12 @@
150 cam0-ov2311 = <&mux_in0>, "remote-endpoint:0=",<&ov2311_0_ep>,
151 <&ov2311_0_ep>, "remote-endpoint:0=",<&mux_in0>,
152 <&ov2311_0>, "status=okay";
153 + cam0-ov64a40 = <&mux_in0>, "remote-endpoint:0=",<&ov64a40_0_ep>,
154 + <&ov64a40_0_ep>, "remote-endpoint:0=",<&mux_in0>,
155 + <&mux_in0>, "clock-noncontinuous?",
156 + <&ov64a40_0>, "status=okay",
157 + <&ov64a40_0_vcm>, "status=okay",
158 + <&ov64a40_0>,"lens-focus:0=", <&ov64a40_0_vcm>;
159
160 cam1-arducam-64mp = <&mux_in1>, "remote-endpoint:0=",<&arducam_64mp_1_ep>,
161 <&arducam_64mp_1_ep>, "remote-endpoint:0=",<&mux_in1>,
162 @@ -496,6 +522,12 @@
163 cam1-ov2311 = <&mux_in1>, "remote-endpoint:0=",<&ov2311_1_ep>,
164 <&ov2311_1_ep>, "remote-endpoint:0=",<&mux_in1>,
165 <&ov2311_1>, "status=okay";
166 + cam1-ov64a40 = <&mux_in1>, "remote-endpoint:0=",<&ov64a40_1_ep>,
167 + <&ov64a40_1_ep>, "remote-endpoint:0=",<&mux_in1>,
168 + <&mux_in1>, "clock-noncontinuous?",
169 + <&ov64a40_1>, "status=okay",
170 + <&ov64a40_1_vcm>, "status=okay",
171 + <&ov64a40_1>,"lens-focus:0=", <&ov64a40_1_vcm>;
172
173 cam0-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
174 <&imx290_0>,"clock-frequency:0";
175 --- a/arch/arm/boot/dts/overlays/camera-mux-4port-overlay.dts
176 +++ b/arch/arm/boot/dts/overlays/camera-mux-4port-overlay.dts
177 @@ -247,6 +247,16 @@
178 #undef cam_node
179 #undef cam_endpoint
180 #undef cam1_clk
181 +
182 + #define cam_node ov64a40_0
183 + #define cam_endpoint ov64a40_0_ep
184 + #define vcm_node ov64a40_0_vcm
185 + #define cam1_clk clk_24mhz
186 + #include "ov64a40.dtsi"
187 + #undef cam_node
188 + #undef cam_endpoint
189 + #undef vcm_node
190 + #undef cam1_clk
191 };
192
193 i2c@1 {
194 @@ -347,6 +357,16 @@
195 #undef cam_node
196 #undef cam_endpoint
197 #undef cam1_clk
198 +
199 + #define cam_node ov64a40_1
200 + #define cam_endpoint ov64a40_1_ep
201 + #define vcm_node ov64a40_1_vcm
202 + #define cam1_clk clk_24mhz
203 + #include "ov64a40.dtsi"
204 + #undef cam_node
205 + #undef cam_endpoint
206 + #undef vcm_node
207 + #undef cam1_clk
208 };
209
210 i2c@2 {
211 @@ -447,6 +467,16 @@
212 #undef cam_node
213 #undef cam_endpoint
214 #undef cam1_clk
215 +
216 + #define cam_node ov64a40_2
217 + #define cam_endpoint ov64a40_2_ep
218 + #define vcm_node ov64a40_2_vcm
219 + #define cam1_clk clk_24mhz
220 + #include "ov64a40.dtsi"
221 + #undef cam_node
222 + #undef cam_endpoint
223 + #undef vcm_node
224 + #undef cam1_clk
225 };
226
227 i2c@3 {
228 @@ -547,6 +577,16 @@
229 #undef cam_node
230 #undef cam_endpoint
231 #undef cam1_clk
232 +
233 + #define cam_node ov64a40_3
234 + #define cam_endpoint ov64a40_3_ep
235 + #define vcm_node ov64a40_3_vcm
236 + #define cam1_clk clk_24mhz
237 + #include "ov64a40.dtsi"
238 + #undef cam_node
239 + #undef cam_endpoint
240 + #undef vcm_node
241 + #undef cam1_clk
242 };
243 };
244 };
245 @@ -725,6 +765,12 @@
246 cam0-ov2311 = <&mux_in0>, "remote-endpoint:0=",<&ov2311_0_ep>,
247 <&ov2311_0_ep>, "remote-endpoint:0=",<&mux_in0>,
248 <&ov2311_0>, "status=okay";
249 + cam0-ov64a40 = <&mux_in0>, "remote-endpoint:0=",<&ov64a40_0_ep>,
250 + <&ov64a40_0_ep>, "remote-endpoint:0=",<&mux_in0>,
251 + <&mux_in0>, "clock-noncontinuous?",
252 + <&ov64a40_0>, "status=okay",
253 + <&ov64a40_0_vcm>, "status=okay",
254 + <&ov64a40_0>,"lens-focus:0=", <&ov64a40_0_vcm>;
255
256 cam1-arducam-64mp = <&mux_in1>, "remote-endpoint:0=",<&arducam_64mp_1_ep>,
257 <&arducam_64mp_1_ep>, "remote-endpoint:0=",<&mux_in1>,
258 @@ -771,6 +817,12 @@
259 cam1-ov2311 = <&mux_in1>, "remote-endpoint:0=",<&ov2311_1_ep>,
260 <&ov2311_1_ep>, "remote-endpoint:0=",<&mux_in1>,
261 <&ov2311_1>, "status=okay";
262 + cam1-ov64a40 = <&mux_in1>, "remote-endpoint:0=",<&ov64a40_1_ep>,
263 + <&ov64a40_1_ep>, "remote-endpoint:0=",<&mux_in1>,
264 + <&mux_in1>, "clock-noncontinuous?",
265 + <&ov64a40_1>, "status=okay",
266 + <&ov64a40_1_vcm>, "status=okay",
267 + <&ov64a40_1>,"lens-focus:0=", <&ov64a40_1_vcm>;
268
269 cam2-arducam-64mp = <&mux_in2>, "remote-endpoint:0=",<&arducam_64mp_2_ep>,
270 <&arducam_64mp_2_ep>, "remote-endpoint:0=",<&mux_in2>,
271 @@ -817,6 +869,12 @@
272 cam2-ov2311 = <&mux_in2>, "remote-endpoint:0=",<&ov2311_2_ep>,
273 <&ov2311_2_ep>, "remote-endpoint:0=",<&mux_in2>,
274 <&ov2311_2>, "status=okay";
275 + cam2-ov64a40 = <&mux_in2>, "remote-endpoint:0=",<&ov64a40_2_ep>,
276 + <&ov64a40_2_ep>, "remote-endpoint:0=",<&mux_in2>,
277 + <&mux_in2>, "clock-noncontinuous?",
278 + <&ov64a40_2>, "status=okay",
279 + <&ov64a40_2_vcm>, "status=okay",
280 + <&ov64a40_2>,"lens-focus:0=", <&ov64a40_2_vcm>;
281
282 cam3-arducam-64mp = <&mux_in3>, "remote-endpoint:0=",<&arducam_64mp_3_ep>,
283 <&arducam_64mp_3_ep>, "remote-endpoint:0=",<&mux_in3>,
284 @@ -863,6 +921,12 @@
285 cam3-ov2311 = <&mux_in3>, "remote-endpoint:0=",<&ov2311_3_ep>,
286 <&ov2311_3_ep>, "remote-endpoint:0=",<&mux_in3>,
287 <&ov2311_3>, "status=okay";
288 + cam3-ov64a40 = <&mux_in3>, "remote-endpoint:0=",<&ov64a40_3_ep>,
289 + <&ov64a40_3_ep>, "remote-endpoint:0=",<&mux_in3>,
290 + <&mux_in3>, "clock-noncontinuous?",
291 + <&ov64a40_3>, "status=okay",
292 + <&ov64a40_3_vcm>, "status=okay",
293 + <&ov64a40_3>,"lens-focus:0=", <&ov64a40_3_vcm>;
294
295 cam0-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
296 <&imx290_0>,"clock-frequency:0";
297 --- /dev/null
298 +++ b/arch/arm/boot/dts/overlays/ov64a40-overlay.dts
299 @@ -0,0 +1,91 @@
300 +// SPDX-License-Identifier: GPL-2.0-only
301 +// Definitions for OV64A40 camera module on VC I2C bus
302 +/dts-v1/;
303 +/plugin/;
304 +
305 +/{
306 + compatible = "brcm,bcm2835";
307 +
308 + i2c_frag: fragment@0 {
309 + target = <&i2c_csi_dsi>;
310 + __overlay__ {
311 + #address-cells = <1>;
312 + #size-cells = <0>;
313 + status = "okay";
314 +
315 + #include "ov64a40.dtsi"
316 + };
317 + };
318 +
319 + csi_frag: fragment@1 {
320 + target = <&csi1>;
321 + csi: __overlay__ {
322 + status = "okay";
323 + brcm,media-controller;
324 +
325 + port{
326 + csi_ep: endpoint{
327 + remote-endpoint = <&cam_endpoint>;
328 + clock-lanes = <0>;
329 + data-lanes = <1 2>;
330 + };
331 + };
332 + };
333 + };
334 +
335 + fragment@2 {
336 + target = <&i2c0if>;
337 + __overlay__ {
338 + status = "okay";
339 + };
340 + };
341 +
342 + clk_frag: fragment@3 {
343 + target = <&cam1_clk>;
344 + __overlay__ {
345 + clock-frequency = <24000000>;
346 + status = "okay";
347 + };
348 + };
349 +
350 + fragment@4 {
351 + target = <&i2c0mux>;
352 + __overlay__ {
353 + status = "okay";
354 + };
355 + };
356 +
357 + fragment@5 {
358 + target = <&cam_node>;
359 + __overlay__ {
360 + lens-focus = <&vcm_node>;
361 + };
362 + };
363 +
364 + __overrides__ {
365 + rotation = <&cam_node>,"rotation:0";
366 + orientation = <&cam_node>,"orientation:0";
367 + media-controller = <&csi>,"brcm,media-controller?";
368 + cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>,
369 + <&csi_frag>, "target:0=",<&csi0>,
370 + <&clk_frag>, "target:0=",<&cam0_clk>,
371 + <&cam_node>, "clocks:0=",<&cam0_clk>,
372 + <&cam_node>, "avdd-supply:0=",<&cam0_reg>,
373 + <&vcm_node>, "vdd-supply:0=",<&cam0_reg>;
374 + vcm = <&vcm_node>, "status",
375 + <0>, "=5";
376 + link-frequency = <&cam_endpoint>,"link-frequencies#0";
377 + };
378 +};
379 +
380 +&cam_node {
381 + status = "okay";
382 +};
383 +
384 +&cam_endpoint {
385 + remote-endpoint = <&csi_ep>;
386 +};
387 +
388 +&vcm_node {
389 + status = "okay";
390 +};
391 --- /dev/null
392 +++ b/arch/arm/boot/dts/overlays/ov64a40.dtsi
393 @@ -0,0 +1,34 @@
394 +// Fragment that configures an OV64A40
395 +
396 +cam_node: ov64a40@36 {
397 + compatible = "ovti,ov64a40";
398 + reg = <0x36>;
399 + status = "disabled";
400 +
401 + clocks = <&cam1_clk>;
402 + clock-names = "xclk";
403 +
404 + avdd-supply = <&cam1_reg>; /* 2.8v */
405 + dovdd-supply = <&cam_dummy_reg>;/* 1.8v */
406 + dvdd-supply = <&cam_dummy_reg>; /* 1.1v */
407 +
408 + rotation = <180>;
409 + orientation = <2>;
410 +
411 + port {
412 + cam_endpoint: endpoint {
413 + bus-type = <4>;
414 + clock-lanes = <0>;
415 + data-lanes = <1 2>;
416 + link-frequencies =
417 + /bits/ 64 <456000000>;
418 + };
419 + };
420 +};
421 +
422 +vcm_node: bu64754@76 {
423 + compatible = "rohm,bu64754";
424 + reg = <0x76>;
425 + status = "disabled";
426 + vdd-supply = <&cam1_reg>;
427 +};