How to add dvp camera driver

  • Hi, everyone.
    Recently, I have try to add dvp camera driver uing RV1106. This is my dts file : It does not work, Is anybody have some sugguestions?

    Code: Select all

    // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
    /*
     * Copyright (c) 2022 Rockchip Electronics Co., Ltd.
     */
    #include "rv1106-amp.dtsi"
    
    / {
    	chosen {
    		bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk1p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0";
    	};
    
    	acodec_sound: acodec-sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "rv-acodec";
    		simple-audio-card,format = "i2s";
    		simple-audio-card,mclk-fs = <256>;
    		simple-audio-card,cpu {
    			sound-dai = <&i2s0_8ch>;
    		};
    		simple-audio-card,codec {
    			sound-dai = <&acodec>;
    		};
    	};
    
    	vcc_1v8: vcc-1v8 {
    		compatible = "regulator-fixed";
    		regulator-name = "vcc_1v8";
    		regulator-always-on;
    		regulator-boot-on;
    		regulator-min-microvolt = <1800000>;
    		regulator-max-microvolt = <1800000>;
    	};
    
    	vcc_3v3: vcc-3v3 {
    		compatible = "regulator-fixed";
    		regulator-name = "vcc_3v3";
    		regulator-always-on;
    		regulator-boot-on;
    		regulator-min-microvolt = <3300000>;
    		regulator-max-microvolt = <3300000>;
    	};
    
    	vdd_arm: vdd-arm {
    		compatible = "regulator-fixed";
    		regulator-name = "vdd_arm";
    		regulator-min-microvolt = <900000>;
    		regulator-max-microvolt = <900000>;
    		regulator-always-on;
    
    		regulator-boot-on;
    	};
    	leds: leds {
    		compatible = "gpio-leds";
    		work_led: work{
    			gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;
    			linux,default-trigger = "activity";
    			default-state = "on";
    		};	
    	};
    };
    
    &acodec {
    	#sound-dai-cells = <0>;
    	pa-ctl-gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
    	status = "okay";
    };
    
    &cpu0 {
    	cpu-supply = <&vdd_arm>;
    };
    
    &csi2_dphy_hw {
    	status = "okay";
    };
    
    
    
    &i2c3 {
    	status = "okay";
    	clock-frequency = <400000>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&i2c3m2_xfer>;
    
    	ar0230: ar0230@10 {
    		compatible = "aptina,ar0230";
    		reg = <0x10>;
    		clocks = <&cru MCLK_REF_MIPI0>;
    		clock-names = "xvclk";
    		pwdn-gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>;
    		reset-gpios = <&gpio2 RK_PC5 GPIO_ACTIVE_HIGH>;
    		pinctrl-names = "default";
    		pinctrl-0 = <&cifm0_dvp_ctl>;
    		rockchip,camera-module-index = <0>;
    		rockchip,camera-module-facing = "back";
    		rockchip,camera-module-name = "CMK-OT0836-PT2";
    		rockchip,camera-module-lens-name = "YT-2929";
    		port {
    			cam_para_out1: endpoint {
    				remote-endpoint = <&cif_para_in>;
    			};
    		};
    	};
    
    };
    
    &i2s0_8ch {
    	#sound-dai-cells = <0>;
    	status = "okay";
    };
    
    
    &rkcif {
    	status = "okay";
    };
    &rkcif_dvp {
    	status = "okay";
      	rockchip,dphy_hw = <&csi2_dphy_hw>;
    	port {
    		/* Parallel bus endpoint */
    		cif_para_in: endpoint {
    			remote-endpoint = <&cam_para_out1>;
    			bus-width = <8>;
    			hsync-active = <1>;
    			vsync-active = <1>;
    			pclk-sample = <0>;
    		};
    	};
    };
    
    &rkcif_dvp_sditf {
    	status = "okay";
    	port {
    		/* parallel endpoint */
    		dvp_sditf: endpoint {
    			remote-endpoint = <&isp_in>;
    			bus-width = <8>;
    			hsync-active = <1>;
    			vsync-active = <1>;
    			pclk-sample = <0>;
    		};
    	};
    };
    
    &rkisp {
    	status = "okay";
    };
    
    &rkisp_vir0 {
    	status = "okay";
    
    	port@0 {
    		isp_in: endpoint {
    			remote-endpoint = <&dvp_sditf>;
    		};
    	};
    };
    
    &saradc {
    	status = "okay";
    	vref-supply = <&vcc_1v8>;
    };
    
    
    &tsadc {
    	status = "okay";
    };
    
    
    
  • The below is logs:

    Code: Select all

    [  248.353499] vsys dev open 26
    [  248.376461] stream_cif_dvp_id0: s_power 1, entity use_count 1
    [  248.395369] rkisp queue buf done
    [  248.396987] rkisp_hw ffa00000.rkisp: set isp clk = 198000000Hz
    [  248.397094] rkcif-dvp: sditf_reinit_mode, mode->rdbk_mode 0, mode->name rkisp-vir0, link_mode 1
    [  248.398245] rkcif-dvp: stream[0] start streaming
    [  248.412364] rkcif-dvp: set dual edge mode(off,0x40000)!!!
    [  249.356461] rockit isp stream off
    [  249.869785] rkisp-vir0: rkisp_stream_stop id:0 timeout
    [  249.869894] rkcif-dvp: stream[0] start stopping, total mode 0x2, cur 0x2
    [  250.376553] rkcif-dvp: stream[0] stopping finished, dma_en 0x0
    [  250.383604] stream_cif_dvp_id0: s_power 0, entity use_count 0
    [  523.259772] vsys dev open 26
    
  • Hello, we haven't tried porting a DVP camera on the Luckfox Pico before. However, based on our experience with porting CSI cameras, we can provide some suggestions. From the logs you provided, it seems that an error occurs when calling the ISP. We suggest disabling the rkcif_dvp_sditf, rkisp, and rkisp_vir0 nodes first to check if a /dev/videoX device can be registered. Then, use v4l2 tools to capture RAW images to verify if the camera can work properly, in order to rule out hardware issues.