From b3cdce5e365bbb9134d72890b17a4de0fdfbbb17 Mon Sep 17 00:00:00 2001 From: Alvin Xie Date: Thu, 18 Apr 2024 18:22:19 +0800 Subject: [PATCH] radxa cm3i io: modify okdo 5mp config for dual cameras Signed-off-by: Alvin Xie --- .../radxa-cm3i-io-okdo-5mp-camera-cam1.dts | 33 ++++--- .../radxa-cm3i-io-okdo-5mp-camera-cam2.dts | 94 +++++++++++++++---- .../radxa-cm3i-io-rpi-camera-v1p3-cam1.dts | 2 +- .../radxa-cm3i-io-rpi-camera-v1p3-cam2.dts | 2 +- 4 files changed, 100 insertions(+), 31 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam1.dts b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam1.dts index 2dbfe975..cf1de4cb 100644 --- a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam1.dts +++ b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam1.dts @@ -15,36 +15,47 @@ }; &{/} { - ext_cam_ov5647_clk: external-camera-ov5647-clock { + ext_cam_ov5647_clk_1: ext-cam-ov5647-clk-1 { status = "okay"; compatible = "fixed-clock"; clock-frequency = <25000000>; - clock-output-names = "ext_cam_ov5647_clk"; + clock-output-names = "ext_cam_ov5647_clk_1"; #clock-cells = <0>; }; + + ov5647_1_pwdn_gpio: ov5647-1-pwdn-gpio { + status = "okay"; + compatible = "regulator-fixed"; + regulator-name = "ov5647_1_pwdn_gpio"; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; + }; }; &i2c0 { status = "okay"; pinctrl-names = "default"; + pinctrl-0 = <&i2c0_xfer>; + #address-cells = <1>; #size-cells = <0>; - ov5647: ov5647@36 { + ov5647_1: ov5647-1@36 { status = "okay"; compatible = "ovti,ov5647"; reg = <0x36>; - clocks = <&ext_cam_ov5647_clk>; - clock-names = "ext_cam_ov5647_clk"; - pwdn-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; + clocks = <&ext_cam_ov5647_clk_1>; + clock-names = "xvclk"; rockchip,camera-module-index = <0>; - rockchip,camera-module-facing = "back"; + rockchip,camera-module-facing = "front"; rockchip,camera-module-name = "OKDO-5MP"; rockchip,camera-module-lens-name = "default"; port { - ov5647_out: endpoint { - remote-endpoint = <&csi2dphy1_ucam1>; + ov5647_1_out: endpoint { + remote-endpoint = <&csi2dphy1_uCAM1>; data-lanes = <1 2>; }; }; @@ -67,9 +78,9 @@ #address-cells = <1>; #size-cells = <0>; - csi2dphy1_ucam1: endpoint@1 { + csi2dphy1_uCAM1: endpoint@1 { reg = <1>; - remote-endpoint = <&ov5647_out>; + remote-endpoint = <&ov5647_1_out>; data-lanes = <1 2>; }; }; diff --git a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam2.dts b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam2.dts index 700c923b..a6cece4e 100644 --- a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam2.dts +++ b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-okdo-5mp-camera-cam2.dts @@ -15,37 +15,46 @@ }; &{/} { - ext_cam_ov5647_clk: external-camera-ov5647-clock { + ext_cam_ov5647_clk_2: ext-cam-ov5647-clk-2 { status = "okay"; compatible = "fixed-clock"; clock-frequency = <25000000>; - clock-output-names = "ext_cam_ov5647_clk"; + clock-output-names = "ext_cam_ov5647_clk_2"; #clock-cells = <0>; }; + + ov5647_2_pwdn_gpio: ov5647-2-pwdn-gpio { + status = "okay"; + compatible = "regulator-fixed"; + regulator-name = "ov5647_2_pwdn_gpio"; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&gpio4 RK_PC5 GPIO_ACTIVE_LOW>; + }; }; &i2c5 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&i2c5m0_xfer>; + #address-cells = <1>; #size-cells = <0>; - - ov5647_1: ov5647-1@36 { + ov5647_2: ov5647-2@36 { status = "okay"; compatible = "ovti,ov5647"; reg = <0x36>; - clocks = <&ext_cam_ov5647_clk>; - clock-names = "ext_cam_ov5647_clk"; - pwdn-gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_LOW>; - rockchip,camera-module-index = <0>; + clocks = <&ext_cam_ov5647_clk_2>; + clock-names = "xvclk"; + rockchip,camera-module-index = <1>; rockchip,camera-module-facing = "back"; rockchip,camera-module-name = "OKDO-5MP"; rockchip,camera-module-lens-name = "default"; port { - ov5647_out: endpoint { - remote-endpoint = <&csi2dphy2_ucam2>; + ov5647_2_out: endpoint { + remote-endpoint = <&csi2dphy2_uCAM2>; data-lanes = <1 2>; }; }; @@ -58,19 +67,17 @@ &csi2_dphy2 { status = "okay"; - ports { #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; #address-cells = <1>; #size-cells = <0>; - csi2dphy2_ucam2: endpoint@1 { + csi2dphy2_uCAM2: endpoint@1 { reg = <1>; - remote-endpoint = <&ov5647_out>; + remote-endpoint = <&ov5647_2_out>; data-lanes = <1 2>; }; }; @@ -82,22 +89,73 @@ csi2dphy2_out: endpoint@1 { reg = <1>; - remote-endpoint = <&isp0_in>; + remote-endpoint = <&mipi_csi2_input>; + }; + }; + }; +}; + +&mipi_csi2 { + status = "okay"; + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_input: endpoint@1 { + reg = <1>; + remote-endpoint = <&csi2dphy2_out>; + data-lanes = <1 2>; }; }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + mipi_csi2_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&cif_mipi_in>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&rkcif_mipi_lvds { + status = "okay"; + port { + cif_mipi_in: endpoint { + remote-endpoint = <&mipi_csi2_output>; + data-lanes = <1 2>; + }; + }; +}; + +&rkcif_mipi_lvds_sditf { + status = "okay"; + port { + mipi_lvds_sditf: endpoint { + remote-endpoint = <&isp1_in>; + data-lanes = <1 2>; + }; }; }; -&rkisp_vir0 { +&rkisp_vir1 { status = "okay"; port { #address-cells = <1>; #size-cells = <0>; - isp0_in: endpoint@0 { + isp1_in: endpoint@0 { reg = <0>; - remote-endpoint = <&csi2dphy2_out>; + remote-endpoint = <&mipi_lvds_sditf>; }; }; }; diff --git a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam1.dts b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam1.dts index 353cd1a1..2b7123f4 100644 --- a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam1.dts +++ b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam1.dts @@ -6,7 +6,7 @@ / { metadata { - title = "Enable Raspberry Pi Camera v1.3 on CAM1."; + title = "Enable Raspberry Pi Camera v1.3 on CAM1"; compatible = "radxa,cm3i-io"; category = "camera"; exclusive = "csi2_dphy1"; diff --git a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam2.dts b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam2.dts index 9048bffe..9efcec00 100644 --- a/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam2.dts +++ b/arch/arm64/boot/dts/rockchip/overlays/radxa-cm3i-io-rpi-camera-v1p3-cam2.dts @@ -6,7 +6,7 @@ / { metadata { - title = "Enable Raspberry Pi Camera v1.3 on CAM2."; + title = "Enable Raspberry Pi Camera v1.3 on CAM2"; compatible = "radxa,cm3i-io"; category = "camera"; exclusive = "csi2_dphy2";