Skip to contentSkip to conversation

arm64: dts: imx8mm-var-dart-sonata: Add OV5640 camera support

PATCH In review Stefano Radaelli 2 participants 6 messages Oct 15 – Oct 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: imx8mm-var-dart-sonata: Add OV5640 camera support

From: Stefano Radaelli <[email protected]>

Add support for the OV5640 camera connected to the Sonata carrier board's first MIPI CSI port.

Describe the sensor on I2C2, its 24 MHz reference clock, fixed supplies, and reset and power-down signals controlled by the GPIO expander. Connect the sensor to the MIPI CSI receiver using two data lanes and enable the receiver and CSI bridge.

---
 .../dts/freescale/imx8mm-var-dart-sonata.dts  | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
arch/arm64/boot/dts/freescale/imx8mm-var-dart-sonata.dts +66 -0
index 57d29a5c3821..427a255fe8ec 100644
@@ -75,12 +75,39 @@ clk40m: oscillator {
 		clock-output-names = "can_osc";
 	};
 
+	camera_clk: oscillator-cam {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <24000000>;
+	};
+
 	pcie0_refclk: pcie0-refclk {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <100000000>;
 	};
 
+	reg_camera_1v5: regulator-camera-1v5 {
+		compatible = "regulator-fixed";
+		regulator-name = "CAM_1V5";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+	};
+
+	reg_camera_1v8: regulator-camera-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "CAM_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
+	reg_camera_2v8: regulator-camera-2v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "CAM_2V8";
+		regulator-min-microvolt = <2800000>;
+		regulator-max-microvolt = <2800000>;
+	};
+
 	reg_usdhc2_vmmc: regulator-vmmc-usdhc2 {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
@@ -95,6 +122,10 @@ reg_usdhc2_vmmc: regulator-vmmc-usdhc2 {
 	};
 };
 
+&csi {
+	status = "okay";
+};
+
 &ecspi1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_ecspi1>;
@@ -200,6 +231,26 @@ ft5x06_ts: touchscreen@38 {
 		wakeup-source;
 	};
 
+	ov5640_mipi1: camera@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		clocks = <&camera_clk>;
+		clock-names = "xclk";
+		AVDD-supply = <&reg_camera_2v8>;
+		DOVDD-supply = <&reg_camera_1v8>;
+		DVDD-supply = <&reg_camera_1v5>;
+		powerdown-gpios = <&pca6408_1 3 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&pca6408_1 1 GPIO_ACTIVE_LOW>;
+
+		port {
+			ov5640_mipi1_ep: endpoint {
+				remote-endpoint = <&mipi1_sensor_ep>;
+				clock-lanes = <0>;
+				data-lanes = <1 2>;
+			};
+		};
+	};
+
 	extcon_ptn5150: typec@3d {
 		compatible = "nxp,ptn5150";
 		reg = <0x3d>;
@@ -263,6 +314,21 @@ st33ktpm2xi2c: tpm@2e {
 	};
 };
 
+&mipi_csi {
+	status = "okay";
+
+	ports {
+		port@0 {
+			reg = <0>;
+
+			mipi1_sensor_ep: endpoint {
+				remote-endpoint = <&ov5640_mipi1_ep>;
+				data-lanes = <1 2>;
+			};
+		};
+	};
+};
+
 &pcie_phy {
 	fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_INPUT>;
 	fsl,tx-deemph-gen1 = <0x2d>;
Signature · 1 line
2.47.3
#1 lore raw
Quoted 4 lines · Stefano Radaelli

From: Stefano Radaelli <[email protected]>

Add support for the OV5640 camera connected to the Sonata carrier board's first MIPI CSI port.

Does this board only support ov5640 camera? Suppose ov5640 module also use for other boards.

Can you refer https://lore.kernel.org/imx/20261011-expulsion-frivolous-690de090cf9d@spud/
to define connectors?

Frank

Quoted 119 lines

Describe the sensor on I2C2, its 24 MHz reference clock, fixed supplies, and reset and power-down signals controlled by the GPIO expander. Connect the sensor to the MIPI CSI receiver using two data lanes and enable the receiver and CSI bridge.

---
 .../dts/freescale/imx8mm-var-dart-sonata.dts  | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
arch/arm64/boot/dts/freescale/imx8mm-var-dart-sonata.dts +66 -1
index 57d29a5c3821..427a255fe8ec 100644
@@ -75,12 +75,39 @@ clk40m: oscillator {
 		clock-output-names = "can_osc";
 	};
 
+	camera_clk: oscillator-cam {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <24000000>;
+	};
+
 	pcie0_refclk: pcie0-refclk {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <100000000>;
 	};
 
+	reg_camera_1v5: regulator-camera-1v5 {
+		compatible = "regulator-fixed";
+		regulator-name = "CAM_1V5";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+	};
+
+	reg_camera_1v8: regulator-camera-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "CAM_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
+	reg_camera_2v8: regulator-camera-2v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "CAM_2V8";
+		regulator-min-microvolt = <2800000>;
+		regulator-max-microvolt = <2800000>;
+	};
+
 	reg_usdhc2_vmmc: regulator-vmmc-usdhc2 {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
@@ -95,6 +122,10 @@ reg_usdhc2_vmmc: regulator-vmmc-usdhc2 {
 	};
 };
 
+&csi {
+	status = "okay";
+};
+
 &ecspi1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_ecspi1>;
@@ -200,6 +231,26 @@ ft5x06_ts: touchscreen@38 {
 		wakeup-source;
 	};
 
+	ov5640_mipi1: camera@3c {
+		compatible = "ovti,ov5640";
+		reg = <0x3c>;
+		clocks = <&camera_clk>;
+		clock-names = "xclk";
+		AVDD-supply = <&reg_camera_2v8>;
+		DOVDD-supply = <&reg_camera_1v8>;
+		DVDD-supply = <&reg_camera_1v5>;
+		powerdown-gpios = <&pca6408_1 3 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&pca6408_1 1 GPIO_ACTIVE_LOW>;
+
+		port {
+			ov5640_mipi1_ep: endpoint {
+				remote-endpoint = <&mipi1_sensor_ep>;
+				clock-lanes = <0>;
+				data-lanes = <1 2>;
+			};
+		};
+	};
+
 	extcon_ptn5150: typec@3d {
 		compatible = "nxp,ptn5150";
 		reg = <0x3d>;
@@ -263,6 +314,21 @@ st33ktpm2xi2c: tpm@2e {
 	};
 };
 
+&mipi_csi {
+	status = "okay";
+
+	ports {
+		port@0 {
+			reg = <0>;
+
+			mipi1_sensor_ep: endpoint {
+				remote-endpoint = <&ov5640_mipi1_ep>;
+				data-lanes = <1 2>;
+			};
+		};
+	};
+};
+
 &pcie_phy {
 	fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_INPUT>;
 	fsl,tx-deemph-gen1 = <0x2d>;
--

2.47.3

#2 lore raw
Quoted 6 lines · Frank Li
Quoted 4 lines · Stefano Radaelli

From: Stefano Radaelli <[email protected]>

Add support for the OV5640 camera connected to the Sonata carrier board's first MIPI CSI port.

Quoted 8 lines

Does this board only support ov5640 camera? Suppose ov5640 module also use for other boards.

Can you refer https://lore.kernel.org/imx/20261011-expulsion-frivolous-690de090cf9d@spud/
to define connectors?

Frank

Hi Frank,

Thanks for your feedback! I looked at the Toradex approach you linked.

In our case, the same connector can also accommodate Basler cameras and potentially other camera modules in the future, while some of our other carrier boards use different connectors.

Given these differences, I would prefer to keep the classic approach proposed in this patch, describing the camera directly in the carrier board DTS. Do you think we should still use connector bindings in our case? If so, how would you suggest handling these differences?

Thanks,
Best Regards,
Stefano

#3 lore raw
Quoted 20 lines · Stefano Radaelli
Quoted 6 lines · Frank Li
Quoted 4 lines · Stefano Radaelli

From: Stefano Radaelli <[email protected]>

Add support for the OV5640 camera connected to the Sonata carrier board's first MIPI CSI port.

Quoted 8 lines

Does this board only support ov5640 camera? Suppose ov5640 module also use for other boards.

Can you refer https://lore.kernel.org/imx/20261011-expulsion-frivolous-690de090cf9d@spud/
to define connectors?

Frank

Hi Frank,

Thanks for your feedback! I looked at the Toradex approach you linked.

Quoted 8 lines

In our case, the same connector can also accommodate Basler cameras and potentially other camera modules in the future, while some of our other carrier boards use different connectors.

Given these differences, I would prefer to keep the classic approach proposed in this patch, describing the camera directly in the carrier board DTS. Do you think we should still use connector bindings in our case? If so, how would you suggest handling these differences?

Need understand whole board familar, basic Two problem:

Does carrier board support difference kinds camera?

Does carrier board or camera module reused for other boards?

Frank

Quoted 4 lines

Thanks,
Best Regards,
Stefano

#4 lore raw
Quoted 30 lines · Frank Li
Quoted 20 lines · Stefano Radaelli
Quoted 6 lines · Frank Li
Quoted 4 lines · Stefano Radaelli

From: Stefano Radaelli <[email protected]>

Add support for the OV5640 camera connected to the Sonata carrier board's first MIPI CSI port.

Quoted 8 lines

Does this board only support ov5640 camera? Suppose ov5640 module also use for other boards.

Can you refer https://lore.kernel.org/imx/20261011-expulsion-frivolous-690de090cf9d@spud/
to define connectors?

Frank

Hi Frank,

Thanks for your feedback! I looked at the Toradex approach you linked.

Quoted 8 lines

In our case, the same connector can also accommodate Basler cameras and potentially other camera modules in the future, while some of our other carrier boards use different connectors.

Given these differences, I would prefer to keep the classic approach proposed in this patch, describing the camera directly in the carrier board DTS. Do you think we should still use connector bindings in our case? If so, how would you suggest handling these differences?

Quoted 8 lines

Need understand whole board familar, basic Two problem:

Does carrier board support difference kinds camera?

Does carrier board or camera module reused for other boards?

Frank

Hi Frank,

Yes to both:

- The carrier board supports different cameras: we currently support OV5640 and Basler modules, and support for another camera is planned.
- The OV5640 module can be used on multiple carrier boards that share the same camera connector.
Other carrier boards in our family use a different connector.

Given these combinations, would you consider reasonable keeping the camera described directly in the carrier board DTS as proposed in this patch? This would avoid adding complexity across the different configurations.

If you still recommend connector bindings, how would you suggest structuring them to handle these differences?

Thank you so much for your help,
Best Regards,
Stefano

#5 lore raw
Quoted 42 lines · Stefano Radaelli
Quoted 30 lines · Frank Li
Quoted 20 lines · Stefano Radaelli
Quoted 6 lines · Frank Li
Quoted 4 lines · Stefano Radaelli

From: Stefano Radaelli <[email protected]>

Add support for the OV5640 camera connected to the Sonata carrier board's first MIPI CSI port.

Quoted 8 lines

Does this board only support ov5640 camera? Suppose ov5640 module also use for other boards.

Can you refer https://lore.kernel.org/imx/20261011-expulsion-frivolous-690de090cf9d@spud/
to define connectors?

Frank

Hi Frank,

Thanks for your feedback! I looked at the Toradex approach you linked.

Quoted 8 lines

In our case, the same connector can also accommodate Basler cameras and potentially other camera modules in the future, while some of our other carrier boards use different connectors.

Given these differences, I would prefer to keep the classic approach proposed in this patch, describing the camera directly in the carrier board DTS. Do you think we should still use connector bindings in our case? If so, how would you suggest handling these differences?

Quoted 8 lines

Need understand whole board familar, basic Two problem:

Does carrier board support difference kinds camera?

Does carrier board or camera module reused for other boards?

Frank

Hi Frank,

Quoted 7 lines

Yes to both:

- The carrier board supports different cameras: we currently support OV5640 and Basler modules, and support for another camera is planned.
- The OV5640 module can be used on multiple carrier boards that share the same camera connector.
Other carrier boards in our family use a different connector.

Carrier board -> camera_connector-> OV5640 (and other camera).

==== defined camera_connector carrie boards dts/dtso

camera_conn1: camera-connect-0 {
	compatible = "variscite,mx8mm-snonata-camara";
	gpio-map = <>;
}

camera-i2c-0: &i2c2 {
};

camera-regulator-0: { /* if exist */
};

mipi_csi {

	ports {
		 camera-port-0: port@0 {
		};
	}
}

==== ov5640.dtso

reg_camera_1v5: regulator-camera-1v5 {
	...
	vin-supply = <&camera-regulator-0>  //if exist
}
&camera-i2c-0 {
	camera@3c {
		compatible = "ovti,ov5640";
		reset-gpios = <&ov5440_ep 1 GPIO_ACTIVE_LOW>;
		...
		port {
			ov5440_ep_0: endpoint {
				remote-endnpoint = <camera-port-0-ep>;
				...
			}
		}
}
&camera-port-0 {
	camera-port-0-ep: endpoint {
		remote-endpoint = <ov5440_ep_0>;
	}
}

Use Makefile create combination for difference carrier boards and camera modules.

You can use similar method to create connector for carrier boards, if it shared for difference boards.

Connector have some limiation to support multi instance ( more than one camera module).

Quoted 3 lines

Given these combinations, would you consider reasonable keeping the camera described directly in the carrier board DTS as proposed in this patch?

It is only if support one only camera.

Quoted 4 lines

This would avoid adding complexity across the different configurations.

If you still recommend connector bindings, how would you suggest structuring them to handle these differences?

See above code segment.

Frank

Quoted 4 lines

Thank you so much for your help,
Best Regards,
Stefano