Skip to content

Commit 4113b10

Browse files
roliver-rpipelwell
authored andcommitted
dts: Add 'AI Camera' support
The AI Camera combines an IMX500 and a RP2040 GPIO bridge on a single module. The Raspberry Pi camera regulator is used for both IMX500 and RP2040. SPI, clocks, and reset (required by IMX500) are provided by the RP2040 GPIO bridge. Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
1 parent 15cc525 commit 4113b10

File tree

7 files changed

+325
-0
lines changed

7 files changed

+325
-0
lines changed

arch/arm/boot/dts/overlays/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
136136
imx378.dtbo \
137137
imx462.dtbo \
138138
imx477.dtbo \
139+
imx500.dtbo \
140+
imx500-pi5.dtbo \
139141
imx519.dtbo \
140142
imx708.dtbo \
141143
interludeaudio-analog.dtbo \

arch/arm/boot/dts/overlays/README

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,27 @@ Params: rotation Mounting rotation of the camera sensor (0 or
28182818
sync-sink Configure as vsync sink
28192819

28202820

2821+
Name: imx500
2822+
Info: Sony IMX500 camera module.
2823+
Uses Unicam 1, which is the standard camera connector on most Pi
2824+
variants.
2825+
Load: dtoverlay=imx500,<param>=<val>
2826+
Params: rotation Mounting rotation of the camera sensor (0 or
2827+
180, default 0)
2828+
orientation Sensor orientation (0 = front, 1 = rear,
2829+
2 = external, default external)
2830+
media-controller Configure use of Media Controller API for
2831+
configuring the sensor (default on)
2832+
cam0 Adopt the default configuration for CAM0 on a
2833+
Compute Module (CSI0, i2c_vc, and cam0_reg).
2834+
bypass-cache Do save blocks of data to flash when using
2835+
rp2040-gpio-bridge for SPI transfers.
2836+
2837+
2838+
Name: imx500-pi5
2839+
Info: See imx500 (this is the Pi 5 version)
2840+
2841+
28212842
Name: imx519
28222843
Info: Sony IMX519 camera module.
28232844
Uses Unicam 1, which is the standard camera connector on most Pi
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
// Definitions for IMX500 camera module on VC I2C bus
3+
/dts-v1/;
4+
/plugin/;
5+
6+
#include <dt-bindings/gpio/gpio.h>
7+
8+
/{
9+
compatible = "brcm,bcm2835";
10+
11+
fragment@0 {
12+
target = <&i2c0if>;
13+
__overlay__ {
14+
status = "okay";
15+
};
16+
};
17+
18+
fragment@1 {
19+
target = <&i2c0mux>;
20+
__overlay__ {
21+
status = "okay";
22+
};
23+
};
24+
25+
reg_frag: fragment@2 {
26+
target = <&cam1_reg>;
27+
cam_reg: __overlay__ {
28+
startup-delay-us = <300000>;
29+
};
30+
};
31+
32+
i2c_frag: fragment@100 {
33+
target = <&i2c_csi_dsi>;
34+
__overlay__ {
35+
#address-cells = <1>;
36+
#size-cells = <0>;
37+
status = "okay";
38+
39+
#include "imx500.dtsi"
40+
#include "rpi-rp2040-gpio-bridge.dtsi"
41+
};
42+
};
43+
44+
csi_frag: fragment@101 {
45+
target = <&csi1>;
46+
csi: __overlay__ {
47+
status = "okay";
48+
brcm,media-controller;
49+
50+
port {
51+
csi_ep: endpoint {
52+
remote-endpoint = <&cam_endpoint>;
53+
clock-lanes = <0>;
54+
data-lanes = <1 2>;
55+
clock-noncontinuous;
56+
};
57+
};
58+
};
59+
};
60+
61+
spi_frag: fragment@102 {
62+
target = <&spi_bridgedev0>;
63+
__overlay__ {
64+
compatible = "sony,imx500";
65+
};
66+
};
67+
68+
chosen_frag: fragment@103 {
69+
target = <&chosen>;
70+
__overlay__ {
71+
core_freq_fixed;
72+
};
73+
};
74+
75+
clocks_frag: fragment@104 {
76+
target-path = "/clocks";
77+
__overlay__ {
78+
clk_aicam: clk-aicam {
79+
compatible = "fixed-clock";
80+
#clock-cells = <0>;
81+
clock-frequency = <24000000>;
82+
};
83+
84+
clk_aicam_gated: clk-aicam-gated {
85+
compatible = "gpio-gate-clock";
86+
clocks = <&clk_aicam>;
87+
#clock-cells = <0>;
88+
enable-gpios = <&spi_bridge 21 GPIO_ACTIVE_HIGH>;
89+
};
90+
};
91+
};
92+
93+
__overrides__ {
94+
rotation = <&cam_node>,"rotation:0";
95+
orientation = <&cam_node>,"orientation:0";
96+
media-controller = <&csi>,"brcm,media-controller?";
97+
cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>,
98+
<&csi_frag>, "target:0=",<&csi0>,
99+
<&spi_bridge>, "power-supply:0=",<&cam0_reg>,
100+
<&reg_frag>, "target:0=",<&cam0_reg>,
101+
<&cam_node>, "VANA-supply:0=",<&cam0_reg>;
102+
bypass-cache = <&spi_bridge>,"bypass-cache?";
103+
};
104+
};
105+
106+
&cam_node {
107+
status = "okay";
108+
reset-gpios = <&spi_bridge 20 GPIO_ACTIVE_HIGH>;
109+
clocks = <&clk_aicam_gated>;
110+
spi = <&spi_bridgedev0>;
111+
};
112+
113+
&spi_bridge {
114+
status = "okay";
115+
};
116+
117+
&cam_endpoint {
118+
remote-endpoint = <&csi_ep>;
119+
};
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
// Definitions for IMX500 camera module on VC I2C bus
3+
/dts-v1/;
4+
/plugin/;
5+
6+
#include <dt-bindings/gpio/gpio.h>
7+
8+
/{
9+
compatible = "brcm,bcm2712";
10+
11+
fragment@0 {
12+
target = <&i2c0if>;
13+
__overlay__ {
14+
status = "okay";
15+
};
16+
};
17+
18+
fragment@1 {
19+
target = <&i2c0mux>;
20+
__overlay__ {
21+
status = "okay";
22+
};
23+
};
24+
25+
reg_frag: fragment@2 {
26+
target = <&cam1_reg>;
27+
cam_reg: __overlay__ {
28+
startup-delay-us = <300000>;
29+
};
30+
};
31+
32+
i2c_frag: fragment@100 {
33+
target = <&i2c_csi_dsi>;
34+
__overlay__ {
35+
#address-cells = <1>;
36+
#size-cells = <0>;
37+
status = "okay";
38+
39+
#include "imx500.dtsi"
40+
#include "rpi-rp2040-gpio-bridge.dtsi"
41+
};
42+
};
43+
44+
csi_frag: fragment@101 {
45+
target = <&csi1>;
46+
csi: __overlay__ {
47+
status = "okay";
48+
brcm,media-controller;
49+
50+
port {
51+
csi_ep: endpoint {
52+
remote-endpoint = <&cam_endpoint>;
53+
clock-lanes = <0>;
54+
data-lanes = <1 2>;
55+
clock-noncontinuous;
56+
};
57+
};
58+
};
59+
};
60+
61+
spi_frag: fragment@102 {
62+
target = <&spi_bridge>;
63+
spi_frag_overlay: __overlay__ {
64+
fast_xfer_requires_i2c_lock = <1>;
65+
fast_xfer_recv_gpio_base = <11>;
66+
fast_xfer-gpios = <&rp1_gpio 40 0>, // CD1_SDA (used as data)
67+
<&rp1_gpio 48 0>; // CD1_IO1_MICDAT1 (clock)
68+
};
69+
};
70+
71+
spi_bridge_frag: fragment@103 {
72+
target = <&spi_bridgedev0>;
73+
__overlay__ {
74+
compatible = "sony,imx500";
75+
};
76+
};
77+
78+
clocks_frag: fragment@104 {
79+
target-path = "/clocks";
80+
__overlay__ {
81+
clk_aicam: clk-aicam {
82+
compatible = "fixed-clock";
83+
#clock-cells = <0>;
84+
clock-frequency = <24000000>;
85+
};
86+
87+
clk_aicam_gated: clk-aicam-gated {
88+
compatible = "gpio-gate-clock";
89+
clocks = <&clk_aicam>;
90+
#clock-cells = <0>;
91+
enable-gpios = <&spi_bridge 21 GPIO_ACTIVE_HIGH>;
92+
};
93+
};
94+
};
95+
96+
__overrides__ {
97+
rotation = <&cam_node>,"rotation:0";
98+
orientation = <&cam_node>,"orientation:0";
99+
media-controller = <&csi>,"brcm,media-controller?";
100+
cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>,
101+
<&csi_frag>, "target:0=",<&csi0>,
102+
<&spi_frag_overlay>, "fast_xfer-gpios:4=38", // CD0_SDA (data)
103+
<&spi_frag_overlay>, "fast_xfer-gpios:16=35", // CD0_IO1_MICDAT0 (clock)
104+
<&spi_bridge>, "power-supply:0=",<&cam0_reg>,
105+
<&reg_frag>, "target:0=",<&cam0_reg>,
106+
<&cam_node>, "VANA-supply:0=",<&cam0_reg>;
107+
bypass-cache = <&spi_bridge>,"bypass-cache?";
108+
};
109+
};
110+
111+
&cam_node {
112+
status = "okay";
113+
reset-gpios = <&spi_bridge 20 GPIO_ACTIVE_HIGH>;
114+
clocks = <&clk_aicam_gated>;
115+
spi = <&spi_bridgedev0>;
116+
};
117+
118+
&spi_bridge {
119+
status = "okay";
120+
};
121+
122+
&cam_endpoint {
123+
remote-endpoint = <&csi_ep>;
124+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
cam_node: imx500@1a {
3+
reg = <0x1a>;
4+
compatible = "sony,imx500";
5+
status = "disabled";
6+
7+
clocks = <&cam1_clk>;
8+
clock-names = "inck";
9+
10+
vana-supply = <&cam1_reg>; /* 2.7v */
11+
vdig-supply = <&cam_dummy_reg>; /* 0.84v */
12+
vif-supply = <&cam_dummy_reg>; /* 1.8v */
13+
14+
reset-gpios = <&gpio 255 GPIO_ACTIVE_HIGH>;
15+
16+
rotation = <0>;
17+
orientation = <2>;
18+
19+
port {
20+
cam_endpoint: endpoint {
21+
clock-lanes = <0>;
22+
data-lanes = <1 2>;
23+
clock-noncontinuous;
24+
link-frequencies =
25+
/bits/ 64 <444000000>;
26+
};
27+
};
28+
};

arch/arm/boot/dts/overlays/overlay_map.dts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@
118118
bcm2711;
119119
};
120120

121+
imx500 {
122+
bcm2835;
123+
bcm2711;
124+
bcm2712 = "imx500-pi5";
125+
};
126+
127+
imx500-pi5 {
128+
bcm2712;
129+
};
130+
121131
lirc-rpi {
122132
deprecated = "use gpio-ir";
123133
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
spi_bridge: spi@40 {
3+
reg = <0x40>;
4+
compatible = "raspberrypi,rp2040-gpio-bridge";
5+
status = "disabled";
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
9+
power-supply = <&cam1_reg>;
10+
11+
#gpio-cells = <2>;
12+
gpio-controller;
13+
14+
spi_bridgedev0: spidev@0{
15+
compatible = "spidev";
16+
reg = <0>; /* CE0 */
17+
#address-cells = <1>;
18+
#size-cells = <0>;
19+
spi-max-frequency = <35000000>;
20+
};
21+
};

0 commit comments

Comments
 (0)