全志V853芯片适配双目GC2053的操作步骤

2024-02-02 16:38:49 浏览数 (2)

1.主题

Tina V85x 平台适配双目GC2053的操作步骤 GC2053数据手册:ov-GC2053datas

2.问题背景

Tina V85x 平台支持多目sensor场景。Tina V85x SDK默认配置一般都是单目sensor,比如SDK V1.0默认是单目GC2053。为方便用户适配双目或多目sensor,下面以V853 perf1方案 双目GC2053为例,介绍适配的操作步骤。

3.解决办法

一、双目GC2053适配 适配双目GC2053主要修改以下几处:

1、dts设备树 文件:device/config/chips/v853/configs/perf1/board.dts 修改:

  • (1)修改csi/isp频率 为节省带宽,可将csi/isp频率由原来默认的300MHz降至200MHz。
代码语言:javascript复制
vind0:vind@0 {
-			vind0_clk = <300000000>;
 			vind0_clk = <200000000>;
 			status = "okay";
  • (2)修改成离线模式 因双目场景下,ISP需分时复用,故只能支持离线模式,即work_mode改成1(离线)。具体可参考->
代码语言:javascript复制
tdm0:tdm@0 {
-				work_mode = <0>;
 				work_mode = <1>;
 			};
 
 			isp00:isp@0 {
-				work_mode = <0>;
 				work_mode = <1>;
 			};
 
 			scaler00:scaler@0 {
-				work_mode = <0>;
 				work_mode = <1>;
 			};
 
 			scaler10:scaler@4 {
-				work_mode = <0>;
 				work_mode = <1>;
 			};
 
 			scaler20:scaler@8 {
-				work_mode = <0>;
 				work_mode = <1>;
 			};
 
 			scaler30:scaler@12 {
-				work_mode = <0>;
 				work_mode = <1>;
 			};
  • (3)修改sensor配置 sensor0默认是gc2053,无需修改。但是需要修改sensor1的配置为gc2053。修改后,sensor0和sensor1的配置如下:
代码语言:javascript复制
sensor0:sensor@0 {
				device_type = "sensor0";
				sensor0_mname = "gc2053_mipi";
				sensor0_twi_cci_id = <1>;
				sensor0_twi_addr = <0x6e>;
				sensor0_mclk_id = <0>;
				sensor0_pos = "rear";
				sensor0_isp_used = <1>;
				sensor0_fmt = <1>;
				sensor0_stby_mode = <0>;
				sensor0_vflip = <0>;
				sensor0_hflip = <0>;
				sensor0_iovdd-supply = <&reg_aldo2>;
				sensor0_iovdd_vol = <1800000>;
				sensor0_avdd-supply = <&reg_bldo2>;
				sensor0_avdd_vol = <2800000>;
				sensor0_dvdd-supply = <&reg_dldo2>;
				sensor0_dvdd_vol = <1200000>;
				sensor0_power_en = <>;
				sensor0_reset = <&pio PA 18 1 0 1 0>;
				sensor0_pwdn = <&pio PA 19 1 0 1 0>;
				sensor0_sm_hs = <>;
				sensor0_sm_vs = <>;
				flash_handle = <&flash0>;
				act_handle = <&actuator0>;
				status	= "okay";
			};

			sensor1:sensor@1 {
				device_type = "sensor1";
				sensor1_mname = "gc2053_mipi_2";
				sensor1_twi_cci_id = <0>;
				sensor1_twi_addr = <0x6e>;
				sensor1_mclk_id = <1>;
				sensor1_pos = "front";
				sensor1_isp_used = <1>;
				sensor1_fmt = <1>;
				sensor1_stby_mode = <0>;
				sensor1_vflip = <0>;
				sensor1_hflip = <0>;
				sensor1_iovdd-supply = <&reg_aldo2>;
				sensor1_iovdd_vol = <1800000>;
				sensor1_avdd-supply = <&reg_bldo2>;
				sensor1_avdd_vol = <2800000>;
				sensor1_dvdd-supply = <&reg_dldo2>;
				sensor1_dvdd_vol = <1200000>;
				sensor1_power_en = <>;
				sensor1_reset = <&pio PA 20 1 0 1 0>;
				sensor1_pwdn = <&pio PA 21 1 0 1 0>;
				sensor1_sm_hs = <>;
				sensor1_sm_vs = <>;
				flash_handle = <>;
				act_handle = <>;
				status	= "okay";
			};
  • (4)修改各video节点的配置 双目GC2053场景下,可支持的video节点分别为: sensor0:video 0/4/8/12 sensor1:video 1/5/9/13 故只需修改以上8个video节点的配置即可。修改后的配置如下:
代码语言:javascript复制
vinc00:vinc@0 {
				vinc0_csi_sel = <0>;
				vinc0_mipi_sel = <0>;
				vinc0_isp_sel = <0>;
				vinc0_isp_tx_ch = <0>;
				vinc0_tdm_rx_sel = <0>;
				vinc0_rear_sensor_sel = <0>;
				vinc0_front_sensor_sel = <0>;
				vinc0_sensor_list = <0>;
				work_mode = <0x1>;
				status = "okay";
			};

			vinc01:vinc@1 {
				vinc1_csi_sel = <1>;
				vinc1_mipi_sel = <1>;
				vinc1_isp_sel = <1>;
				vinc1_isp_tx_ch = <0>;
				vinc1_tdm_rx_sel = <1>;
				vinc1_rear_sensor_sel = <1>;
				vinc1_front_sensor_sel = <1>;
				vinc1_sensor_list = <0>;
				status = "okay";
			};


			vinc10:vinc@4 {
				vinc4_csi_sel = <0>;
				vinc4_mipi_sel = <0>;
				vinc4_isp_sel = <0>;
				vinc4_isp_tx_ch = <0>;
				vinc4_tdm_rx_sel = <0>;
				vinc4_rear_sensor_sel = <0>;
				vinc4_front_sensor_sel = <0>;
				vinc4_sensor_list = <0>;
				work_mode = <0x1>;
				status = "okay";
			};

			vinc11:vinc@5 {
				vinc5_csi_sel = <1>;
				vinc5_mipi_sel = <1>;
				vinc5_isp_sel = <1>;
				vinc5_isp_tx_ch = <0>;
				vinc5_tdm_rx_sel = <1>;
				vinc5_rear_sensor_sel = <1>;
				vinc5_front_sensor_sel = <1>;
				vinc5_sensor_list = <0>;
				status = "okay";
			};


			vinc20:vinc@8 {
				vinc8_csi_sel = <0>;
				vinc8_mipi_sel = <0x0>;
				vinc8_isp_sel = <0>;
				vinc8_isp_tx_ch = <0>;
				vinc8_tdm_rx_sel = <0>;
				vinc8_rear_sensor_sel = <0>;
				vinc8_front_sensor_sel = <0>;
				vinc8_sensor_list = <0>;
				work_mode = <0x1>;
				status = "okay";
			};

			vinc21:vinc@9 {
				vinc9_csi_sel = <0>;
				vinc9_mipi_sel = <0x0>;
				vinc9_isp_sel = <0>;
				vinc9_isp_tx_ch = <0>;
				vinc9_tdm_rx_sel = <0>;
				vinc9_rear_sensor_sel = <0>;
				vinc9_front_sensor_sel = <0>;
				vinc9_sensor_list = <0>;
				work_mode = <0x1>;
				status = "okay";
			};


			vinc30:vinc@12 {
				vinc12_csi_sel = <0>;
				vinc12_mipi_sel = <0x0>;
				vinc12_isp_sel = <0>;
				vinc12_isp_tx_ch = <0>;
				vinc12_tdm_rx_sel = <0>;
				vinc12_rear_sensor_sel = <0>;
				vinc12_front_sensor_sel = <0>;
				vinc12_sensor_list = <0>;
				work_mode = <0x1>;
				status = "okay";
			};

			vinc31:vinc@13 {
				vinc13_csi_sel = <1>;
				vinc13_mipi_sel = <1>;
				vinc13_isp_sel = <1>;
				vinc13_isp_tx_ch = <0>;
				vinc13_tdm_rx_sel = <1>;
				vinc13_rear_sensor_sel = <1>;
				vinc13_front_sensor_sel = <1>;
				vinc13_sensor_list = <0>;
				status = "okay";
			};

2、内核配置 双mipi sensor场景下,ISP分时复用,需要使用TDM,故需打开TDM。 文件:device/config/chips/v853/configs/perf1/linux/config-4.9 修改:打开TDM配置

代码语言:javascript复制
CONFIG_SUPPORT_ISP_TDM=y
CONFIG_TDM_LBC_EN=y

3、mpp middleware

首先,确保mpp配置中选中了gc2053 sensor。检查方法: make menuconfig,依次进入配置项:

代码语言:javascript复制
Allwinner  --->
    eyesee-mpp  --->
        [*]   select sensor
        [*]     use sensor gc2053

然后,在ISP效果文件中,为第二个sensor添加效果文件配置。 位置:external/eyesee-mpp/middleware/sun8iw21/media/LIBRARY/libisp/isp_cfg/isp_ini_parse.c 修改:将原来的两组gc2053_mipi配置分别拷贝一份,然后修改名字为gc2053_mipi_2即可,其他参数不用修改。

代码语言:javascript复制
struct isp_cfg_array cfg_arr[] = {
...

#ifdef SENSOR_GC2053
	{"gc2053_mipi",  "gc2053_mipi_isp600_20220511_164617_vlc4_day", 1920, 1088, 20, 0, 0, &gc2053_mipi_v853_isp_cfg},
	{"gc2053_mipi",  "gc2053_mipi_isp600_20220415_144837_ir", 1920, 1088, 20, 0, 1, &gc2053_mipi_ir_isp_cfg},
	{"gc2053_mipi_2",  "gc2053_mipi_isp600_20220511_164617_vlc4_day", 1920, 1088, 20, 0, 0, &gc2053_mipi_v853_isp_cfg},
	{"gc2053_mipi_2",  "gc2053_mipi_isp600_20220415_144837_ir", 1920, 1088, 20, 0, 1, &gc2053_mipi_ir_isp_cfg},
#endif

...
}

按以上步骤修改完成后,需重新编译mpp和固件,命令如下:

代码语言:javascript复制
cleanmpp && mkmpp && mp

二、双目GC2053验证 支持验证双目GC2053的mpp sample有: sample_rtsp(支持双目采集 编码 RTSP)、sample_smartIPC_demo(支持双目采集 编码 RTSP 人形检测)、sample_smartPreview_demo(支持双目采集 预览) 如果不需要RTSP功能,注释掉代码中的宏 #define SUPPORT_RTSP_TEST 即可。 有关mpp sample的使用方法,请参考https://bbs.aw-ol.com/topic/1906/

0 人点赞