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