RK3576+gc05a2

正在施工

说明

  1. Sensor 调试的第⼀个关键节点是 i2c 能否通讯成功,chip id 检查是否正确。如果是,说明上电时序没有问题。

  2. 使⽤ media-ctl 获取拓扑结构,查看 Sensor 是否已经注册成⼀个 entity。如果是,说明 Sensor 已经注册成功。

  3. 抓图

ps:SDK有doc的,里面说的调试步骤很清楚,有的不一定可以轻易搞出来,大的流程是这样,卡到哪一步就随机应变了。

点亮sensor

i2c访问

# 标准格式
i2ctransfer -f -y BUS_NUMBER w[WRITE_LENGTH]@[DEVICE_ADDRESS] [WRITE_DATA...] r[READ_LENGTH]
# 示例:读取GC05a2传感器0x03f0寄存器,即sensor id ,把驱动里面的 __gc05a2_power_off  函数注释掉,不使用摄像头时会断电pwd下拉,去掉然后芯片的i2c部分就可以通讯了。
i2ctransfer -f -y 4 w2@0x37 0x03 0xf0 r2

alt text

其中:

  • BUS_NUMBER = 4(你的I2C总线号)
  • DEVICE_ADDRESS = 0x37(你的摄像头地址)
  • WRITE_LENGTH = 2(寄存器地址长度)
  • READ_LENGTH = 1(要读取的数据长度)

alt text

i2cdump -y -f 4 0x37 是不行的,i2c读取摄像头里面的寄存器都是双字节的,摄像头没有低位的寄存器,所以读不到。

# i2cdetect和i2cdump默认只扫描0x00-0x7F范围
# 0x03f0超出了这个范围(需要2字节地址)
i2cdump的工作方式:
默认使用单字节地址(0-255)
发送格式:START + 设备地址 + 寄存器地址(8位) + START + 设备地址 + READ

alt text

alt text

i2ctools的使用参考:https://blog.csdn.net/qq_42952079/article/details/125217208

视频流连接链路

可以看下你的mipi传输信号是属于哪个mipi phy的。
原理图标注的好的话,直接看原理图上引脚就行。

ISP (Image Signal Processor): 即图像信号处理模块, 主要作用是对前端图像传感器输出的信号做后期处理,依赖于 ISP 才能在不同的光学条件下都能较好的还原现场细节。

VICAP(Video capture):视频捕获单元

参考:

https://www.forlinx.com/article_view_1246.html
https://blog.csdn.net/qq_34341546/article/details/138849017

里面的
alt text

alt text

有一个dcphy接口和两个dphy接口,接入路径如下:

单摄(接第一个dphy)

sensor0->csi2_dphy0->mipi1_csi2->rkcif_mipi_lvds1(sditf)->rkisp_vir0

双摄(接两个dphy)

sensor0->csi2_dphy0->mipi1_csi2->rkcif_mipi_lvds1(sditf)->rkisp_vir0

sensor1->csi2_dphy3->mipi3_csi2->rkcif_mipi_lvds3(sditf)->rkisp_vir1

三摄(接dcphy和2个dphy)

sensor0->csi2_dcphy0->mipi0_csi2->rkcif_mipi_lvds(sditf)->rkisp_vir0

sensor1->csi2_dphy0->mipi1_csi2->rkcif_mipi_lvds1(sditf)->rkisp_vir1

sensor2->csi2_dphy3->mipi3_csi2->rkcif_mipi_lvds3(sditf)->rkisp_vir2

五摄(接dcphy,将2个dphy拆分)

sensor0->csi2_dcphy0->mipi0_csi2->rkcif_mipi_lvds(sditf)->rkisp_vir0

sensor1->csi2_dphy1->mipi1_csi2->rkcif_mipi_lvds1(sditf)->rkisp_vir1

sensor2->csi2_dphy2->mipi2_csi2->rkcif_mipi_lvds2(sditf)->rkisp_vir2

sensor3->csi2_dphy4->mipi3_csi2->rkcif_mipi_lvds3(sditf)->rkisp_vir3

sensor4->csi2_dphy5->mipi4_csi2->rkcif_mipi_lvds4(sditf)->rkisp_vir4

设备树配置

只用dphy开一个2lan,算上注释的整个实际上是2个dphy分成2x2lan。

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2024 Rockchip Electronics Co., Ltd.
 *
 */

/ {
    cam_ext_clk: camera-external-clock {
        compatible = "fixed-clock";
        clock-frequency = <24000000>;
        clock-output-names = "CLK_CAMERA_24MHZ";
        #clock-cells = <0>;
    };
};

&csi2_dphy1 {
	status = "okay";

	ports {
		#address-cells = <1>;
		#size-cells = <0>;
		port@0 {
			reg = <0>;
			#address-cells = <1>;
			#size-cells = <0>;

			mipi_in_ucam1: endpoint@1 {
				reg = <1>;
				remote-endpoint = <&imx464_out0>;
				data-lanes = <1 2>;
			};
		};
		port@1 {
			reg = <1>;
			#address-cells = <1>;
			#size-cells = <0>;

			csidphy1_out: endpoint@0 {
				reg = <0>;
				remote-endpoint = <&mipi1_csi2_input>;
			};
		};
	};
};

// &csi2_dphy2 {
// 	status = "okay";

// 	ports {
// 		#address-cells = <1>;
// 		#size-cells = <0>;
// 		port@0 {
// 			reg = <0>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi_in_ucam2: endpoint@1 {
// 				reg = <1>;
// 				remote-endpoint = <&imx464_out1>;
// 				data-lanes = <1 2>;
// 			};
// 		};
// 		port@1 {
// 			reg = <1>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			csidphy2_out: endpoint@0 {
// 				reg = <0>;
// 				remote-endpoint = <&mipi2_csi2_input>;
// 			};
// 		};
// 	};
// };

// &csi2_dphy4 {
// 	status = "okay";

// 	ports {
// 		#address-cells = <1>;
// 		#size-cells = <0>;
// 		port@0 {
// 			reg = <0>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi_in_ucam3: endpoint@1 {
// 				reg = <1>;
// 				remote-endpoint = <&imx464_out2>;
// 				data-lanes = <1 2>;
// 			};
// 		};
// 		port@1 {
// 			reg = <1>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			csidphy4_out: endpoint@0 {
// 				reg = <0>;
// 				remote-endpoint = <&mipi3_csi2_input>;
// 			};
// 		};
// 	};
// };

// &csi2_dphy5 {
// 	status = "okay";

// 	ports {
// 		#address-cells = <1>;
// 		#size-cells = <0>;
// 		port@0 {
// 			reg = <0>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi_in_ucam4: endpoint@1 {
// 				reg = <1>;
// 				remote-endpoint = <&imx464_out3>;
// 				data-lanes = <1 2>;
// 			};
// 		};
// 		port@1 {
// 			reg = <1>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			csidphy5_out: endpoint@0 {
// 				reg = <0>;
// 				remote-endpoint = <&mipi4_csi2_input>;
// 			};
// 		};
// 	};
// };

&i2c4 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4m1_xfer>;
	status = "okay";

    gc05a2: gc05a2@37 {
        compatible = "galaxycore,gc05a2";
        status = "okay";
        reg = <0x37>;
        clocks = <&cam_ext_clk>;
        clock-names = "xvclk";
        pinctrl-names = "default";
        //pinctrl-0 = <&cam_clk0m0_clk0>;
        pinctrl-0 = <&cam_gpio>;
        pwdn-gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>;
        reset-gpios = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>;
        avdd-supply = <&vcc_cam>;
        dovdd-supply = <&vcc_cam>;
        dvdd-supply = <&vcc_cam>;
        rockchip,camera-module-index = <1>;
        rockchip,camera-module-facing = "front";
        rockchip,camera-module-name = "KYT-11210-V2";
        rockchip,camera-module-lens-name = "default";
        port {
            imx464_out0: endpoint {
                remote-endpoint = <&mipi_in_ucam1>;
                data-lanes = <1 2>;
            };
        };
 	};
};


// &i2c5 {
// 	status = "okay";
// 	pinctrl-0 = <&i2c5m3_xfer>;

// 	/* module 77/79 0x1a 78/80 0x36 */
// 	// imx464_0: imx464-0@1a {
// 	// 	compatible = "sony,imx464";
// 	// 	status = "okay";
// 	// 	reg = <0x1a>;
// 	// 	clocks = <&cru CLK_MIPI_CAMERAOUT_M1>;
// 	// 	clock-names = "xvclk";
// 	// 	power-domains = <&power RK3576_PD_VI>;
// 	// 	pinctrl-names = "default";
// 	// 	pinctrl-0 = <&cam_clk1m0_clk1>;
// 	// 	avdd-supply = <&vcc_mipicsi0>;
// 	// 	pwdn-gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_HIGH>;
// 	// 	rockchip,camera-module-index = <1>;
// 	// 	rockchip,camera-module-facing = "back";
// 	// 	rockchip,camera-module-name = "CMK-OT1980-PX1";
// 	// 	rockchip,camera-module-lens-name = "SHG102";
// 	// 	port {
// 	// 		imx464_out0: endpoint {
// 	// 			remote-endpoint = <&mipi_in_ucam1>;
// 	// 			data-lanes = <1 2>;
// 	// 		};
// 	// 	};
// 	// };

// 	imx464_1: imx464-1@36 {
// 		compatible = "sony,imx464";
// 		status = "okay";
// 		reg = <0x36>;
// 		clocks = <&cru CLK_MIPI_CAMERAOUT_M1>;
// 		clock-names = "xvclk";
// 		power-domains = <&power RK3576_PD_VI>;
// 		pinctrl-names = "default";
// 		avdd-supply = <&vcc_mipicsi0>;
// 		pwdn-gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>;/* hw not connect as default */
// 		rockchip,camera-module-index = <0>;
// 		rockchip,camera-module-facing = "back";
// 		rockchip,camera-module-name = "CMK-OT1980-PX1";
// 		rockchip,camera-module-lens-name = "SHG102";
// 		port {
// 			imx464_out1: endpoint {
// 				remote-endpoint = <&mipi_in_ucam2>;
// 				data-lanes = <1 2>;
// 			};
// 		};
// 	};
// };

// &i2c8 {
// 	status = "okay";
// 	pinctrl-0 = <&i2c8m2_xfer>;

// 	/* 77/79 0x1a 78/80 0x36 */
// 	imx464_2: imx464-2@1a {
// 		compatible = "sony,imx464";
// 		status = "okay";
// 		reg = <0x1a>;
// 		clocks = <&cru CLK_MIPI_CAMERAOUT_M2>;
// 		clock-names = "xvclk";
// 		power-domains = <&power RK3576_PD_VI>;
// 		pinctrl-names = "default";
// 		pinctrl-0 = <&cam_clk2m0_clk2>;
// 		// avdd-supply = <&vcc_mipicsi1>;
// 		pwdn-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
// 		rockchip,camera-module-index = <2>;
// 		rockchip,camera-module-facing = "back";
// 		rockchip,camera-module-name = "CMK-OT1980-PX1";
// 		rockchip,camera-module-lens-name = "SHG102";
// 		port {
// 			imx464_out2: endpoint {
// 				remote-endpoint = <&mipi_in_ucam3>;
// 				data-lanes = <1 2>;
// 			};
// 		};
// 	};

// 	imx464_3: imx464-3@36 {
// 		compatible = "sony,imx464";
// 		status = "okay";
// 		reg = <0x36>;
// 		clocks = <&cru CLK_MIPI_CAMERAOUT_M2>;
// 		clock-names = "xvclk";
// 		power-domains = <&power RK3576_PD_VI>;
// 		// avdd-supply = <&vcc_mipicsi1>;
// 		pwdn-gpios = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
// 		rockchip,camera-module-index = <3>;
// 		rockchip,camera-module-facing = "back";
// 		rockchip,camera-module-name = "CMK-OT1980-PX1";
// 		rockchip,camera-module-lens-name = "SHG102";
// 		port {
// 			imx464_out3: endpoint {
// 				remote-endpoint = <&mipi_in_ucam4>;
// 				data-lanes = <1 2>;
// 			};
// 		};
// 	};
// };

&mipi1_csi2 {
	status = "okay";

	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@0 {
			reg = <0>;
			#address-cells = <1>;
			#size-cells = <0>;

			mipi1_csi2_input: endpoint@1 {
				reg = <1>;
				remote-endpoint = <&csidphy1_out>;
			};
		};

		port@1 {
			reg = <1>;
			#address-cells = <1>;
			#size-cells = <0>;

			mipi1_csi2_output: endpoint@0 {
				reg = <0>;
				remote-endpoint = <&cif_mipi_in1>;
			};
		};
	};
};

// &mipi2_csi2 {
// 	status = "okay";

// 	ports {
// 		#address-cells = <1>;
// 		#size-cells = <0>;

// 		port@0 {
// 			reg = <0>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi2_csi2_input: endpoint@1 {
// 				reg = <1>;
// 				remote-endpoint = <&csidphy2_out>;
// 			};
// 		};

// 		port@1 {
// 			reg = <1>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi2_csi2_output: endpoint@0 {
// 				reg = <0>;
// 				remote-endpoint = <&cif_mipi_in2>;
// 			};
// 		};
// 	};
// };

// &mipi3_csi2 {
// 	status = "okay";

// 	ports {
// 		#address-cells = <1>;
// 		#size-cells = <0>;

// 		port@0 {
// 			reg = <0>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi3_csi2_input: endpoint@1 {
// 				reg = <1>;
// 				remote-endpoint = <&csidphy4_out>;
// 			};
// 		};

// 		port@1 {
// 			reg = <1>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi3_csi2_output: endpoint@0 {
// 				reg = <0>;
// 				remote-endpoint = <&cif_mipi_in3>;
// 			};
// 		};
// 	};
// };

// &mipi4_csi2 {
// 	status = "okay";

// 	ports {
// 		#address-cells = <1>;
// 		#size-cells = <0>;

// 		port@0 {
// 			reg = <0>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi4_csi2_input: endpoint@1 {
// 				reg = <1>;
// 				remote-endpoint = <&csidphy5_out>;
// 			};
// 		};

// 		port@1 {
// 			reg = <1>;
// 			#address-cells = <1>;
// 			#size-cells = <0>;

// 			mipi4_csi2_output: endpoint@0 {
// 				reg = <0>;
// 				remote-endpoint = <&cif_mipi_in4>;
// 			};
// 		};
// 	};
// };

&rkcif {
	status = "okay";
};

&rkcif_mipi_lvds1 {
	status = "okay";

	port {
		cif_mipi_in1: endpoint {
			remote-endpoint = <&mipi1_csi2_output>;
		};
	};
};

&rkcif_mipi_lvds1_sditf {
	status = "okay";

	port {
		mipi1_lvds_sditf: endpoint {
			remote-endpoint = <&isp_vir0>;
		};
	};
};

// &rkcif_mipi_lvds2 {
// 	status = "okay";

// 	port {
// 		cif_mipi_in2: endpoint {
// 			remote-endpoint = <&mipi2_csi2_output>;
// 		};
// 	};
// };

// &rkcif_mipi_lvds2_sditf {
// 	status = "okay";

// 	port {
// 		mipi2_lvds_sditf: endpoint {
// 			remote-endpoint = <&isp_vir1>;
// 		};
// 	};
// };

// &rkcif_mipi_lvds3 {
// 	status = "okay";

// 	port {
// 		cif_mipi_in3: endpoint {
// 			remote-endpoint = <&mipi3_csi2_output>;
// 		};
// 	};
// };

// &rkcif_mipi_lvds3_sditf {
// 	status = "okay";

// 	port {
// 		mipi3_lvds_sditf: endpoint {
// 			remote-endpoint = <&isp_vir2>;
// 		};
// 	};
// };

// &rkcif_mipi_lvds4 {
// 	status = "okay";

// 	port {
// 		cif_mipi_in4: endpoint {
// 			remote-endpoint = <&mipi4_csi2_output>;
// 		};
// 	};
// };

// &rkcif_mipi_lvds4_sditf {
// 	status = "okay";

// 	port {
// 		mipi4_lvds_sditf: endpoint {
// 			remote-endpoint = <&isp_vir3>;
// 		};
// 	};
// };

&rkcif_mmu {
	status = "okay";
};

&rkisp {
	status = "okay";
};

&rkisp_mmu {
	status = "okay";
};

&rkisp_vir0 {
	status = "okay";

	port {
		#address-cells = <1>;
		#size-cells = <0>;

		isp_vir0: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&mipi1_lvds_sditf>;
		};
	};
};

// &rkisp_vir1 {
// 	status = "okay";

// 	port {
// 		#address-cells = <1>;
// 		#size-cells = <0>;

// 		isp_vir1: endpoint@0 {
// 			reg = <0>;
// 			remote-endpoint = <&mipi2_lvds_sditf>;
// 		};
// 	};
// };

// &rkisp_vir2 {
// 	status = "okay";

// 	port {
// 		#address-cells = <1>;
// 		#size-cells = <0>;

// 		isp_vir2: endpoint@0 {
// 			reg = <0>;
// 			remote-endpoint = <&mipi3_lvds_sditf>;
// 		};
// 	};
// };

// &rkisp_vir3 {
// 	status = "okay";

// 	port {
// 		#address-cells = <1>;
// 		#size-cells = <0>;

// 		isp_vir3: endpoint@0 {
// 			reg = <0>;
// 			remote-endpoint = <&mipi4_lvds_sditf>;
// 		};
// 	};
// };

&rkvpss {
	status = "okay";
};

&rkvpss_mmu {
	status = "okay";
};

&rkvpss_vir0 {
	status = "okay";
};

// &rkvpss_vir1 {
// 	status = "okay";
// };

// &rkvpss_vir2 {
// 	status = "okay";
// };

// &rkvpss_vir3 {
// 	status = "okay";
// };

链路信息

参考:

https://wiki.t-firefly.com/zh_CN/ROC-RK3576-PC/usage_camera.html

https://doc.embedfire.com/linux/rk3576/quick_start/zh/latest/doc/camera/camera.html

由于一款主板可能存在多个摄像头:

  • 对于使用RKISP的摄像头如 CAM-8MS1M(IMX415) 需要抓取rkisp_mainpath对应的video节点

  • 对于自带ISP的摄像头如 CAM-8MS1M 则是抓取stream_cif_mipi_id0 对应的video节点

grep -H '' /sys/class/video4linux/video*/name

查看所有设备

v4l2-ctl --list-devices

查看支持的格式:

v4l2-ctl -d /dev/video11 --list-formats-ext

alt text
查看当前格式设置

v4l2-ctl -d /dev/video11 --get-fmt-video

alt text

查看详细video设备信息

v4l2-ctl -d /dev/video11 --all

查看media1的完整拓扑

media-ctl -p -d /dev/media1 -v

会有三个media节点(0,1,2)
/dev/media0: CIF (原始采集) → /dev/video0-/dev/video10
/dev/media1: ISP (图像处理) → /dev/video11-/dev/video19
/dev/media2: VPSS (后处理) → /dev/video21-/dev/video24

/dev/video0-3: 原始流通道 (stream_cif_mipi_id0-3)
/dev/video4-7: 缩放通道 (rkcif_scale_ch0-3)
/dev/video8-10: 工具通道 (rkcif_tools_id0-2)
/dev/video11: mainpath (主路径) - 通常用于主视频流
/dev/video12: selfpath (自路径) - 通常用于预览
/dev/video13: ldcpath (镜头畸变校正路径)
/dev/video14: iqtool (图像质量工具路径)
/dev/video21: scale0
/dev/video22: scale1
/dev/video23: scale2
/dev/video24: scale3

Rockchip平台使用了CIF+ISP的混合架构,其中CIF负责原始数据采集,ISP负责图像处理。

RK 的摄像头开发文档: https://redmine.rock-chips.com/documents/53

功耗

可以看电源的电流,我的是 不开摄像头12V0.425A,开启摄像头12V0.451A(运行不正常的)。

调试

使⽤GStreamer

介绍: https://doc.embedfire.com/linux/rk356x/quick_start/zh/latest/lubancat_rk_software_hardware/software/gstreamer/gstreamer.html

# 查看所有插件
gst-inspect-1.0
# 查看插件详细信息
gst-inspect-1.0 kmssink

buildroot选 waylandsink 插件。

选 kmssink 如果:
运行在嵌入式Linux(如Buildroot/Yocto)。
需要最低延迟(如摄像头监控、机器视觉)。
系统无X11/Wayland。

选 xvimagesink 如果:
在桌面环境(Ubuntu等)调试。
需要与其他窗口共享屏幕(如显示视频+GUI控件)。
分辨率较低(如640x480)。

检查XVideo支持:xvinfo

gst-launch-1.0 v4l2src device=/dev/video11 ! video/x-raw,format=NV12,width=640,height=480 ! queue ! xvimagesink sync=false
cheese

使用茄子软件

直接cheesem命令即可

问题现象

使用v4l2命令

alt text

使用茄子程序 :
抓图正常,但是3A不正常。
alt text
3A正常后:
alt text

分析过程

追哪里有问题:

strace -e trace=open,close,ioctl gst-launch-1.0 v4l2src device=/dev/video11 ! video/x-raw,format=NV16,width=640,height=480 ! queue ! xvimagesink sync=false

日志: close() 频繁调用

  1. 问题核心:gc05a2_s_power 被调用两次(on=1 后 on=0)
    (1) 正常调用顺序
    在 V4L2 框架下,摄像头驱动的电源管理流程通常是:

on=1(开启电源):
当应用通过 open() 或 VIDIOC_STREAMON 启动摄像头时调用,初始化传感器、配置寄存器。
on=0(关闭电源):
当应用调用 close() 或 VIDIOC_STREAMOFF 时触发,释放资源以节省功耗。
(2) 你的日志中存在的问题
从 strace 和内核日志来看:

gc05a2_s_stream: on: 1 被成功调用(传感器开始输出数据流)。
但随后立即触发大量 close() 操作(可能是 GStreamer 或应用异常退出)。
传感器未正确维持电源状态,导致 s_power(on=0) 被过早调用。

发现ISP还需要应用层的配合:
alt text
可能是这里的 Sensor输出Raw数据,需要启动3A 问题。

systemctl status rkaiq_3A.service

ISP 开发: https://doc.embedfire.com/linux/rk356x/quick_start/zh/latest/quick_start/isp/isp.html#pc

buildroot 正常的情况下 strace 命令:

root@rk3576-buildroot:/# strace -e trace=open,close,ioctl gst-launch-1.0 v4l2src device=/dev/video11 ! video/x-raw,format=NV12,width=640,height=480 ! queue ! waylandsink sync=false
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(4)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
close(3)                                = 0
[ 2115.971210] rkisp_hw 27c00000.isp: set isp clk = 594000000Hz
close(3)                                = 0
close(3)                                = 0
close(5)                                = 0
close(5)                                = 0
[ 2115.992718] rkisp rkisp-vir0: first params buf queue
close(5)                                = 0
[ 2115.993112] rkcif-mipi-lvds1: stream[0] start streaming
close(5)                                = 0
[ 2115.993369] rockchip-mipi-csi2 mipi1-csi2: stream on, src_sd: 00000000d3a3b1a8, sd_name:rockchip-csi2-dphy1
close(5)                                = 0
[ 2115.993386] rockchip-mipi-csi2 mipi1-csi2: stream ON
close(5)                                = 0
[ 2115.993426] rockchip-csi2-dphy1: dphy1, data_rate_mbps 902
ioctl(1, TCGETS, {c_iflag=ICRNL|IXON|IXOFF, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B115200|CS8|CREAD|HUPCL|CLOCAL, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
[ 2115.993457] rockchip-csi2-dphy csi2-dphy1: csi2_dphy_s_stream stream on:1, dphy1, ret 0
Setting pipeline to PAUSED ...
[ 2115.993471] gc05a2 4-0037: gc05a2_s_stream: on: 1, 2592x1944@30
close(12)                               = 0
close(13)                               = 0
close(13)                               = 0
ioctl(12, VIDIOC_QUERYCAP, {driver="rkisp_v10", card="rkisp_mainpath", bus_info="platform:rkisp-vir0", version=KERNEL_VERSION(2, 9, 0), capabilities=V4L2_CAP_VIDEO_CAPTURE_MPLANE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_STREAMING|V4L2_CAP_DEVICE_CAPS, device_caps=V4L2_CAP_VIDEO_CAPTURE_MPLANE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_STREAMING}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=0, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="UYVY 4:2:2", pixelformat=v4l2_fourcc('U', 'Y', 'V', 'Y') /* V4L2_PIX_FMT_UYVY */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('U', 'Y', 'V', 'Y') /* V4L2_PIX_FMT_UYVY */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('U', 'Y', 'V', 'Y') /* V4L2_PIX_FMT_UYVY */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=64}], num_planes=1}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=1, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="Y/UV 4:2:2", pixelformat=v4l2_fourcc('N', 'V', '1', '6') /* V4L2_PIX_FMT_NV16 */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('N', 'V', '1', '6') /* V4L2_PIX_FMT_NV16 */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('N', 'V', '1', '6') /* V4L2_PIX_FMT_NV16 */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=32}], num_planes=1}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=2, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="Y/VU 4:2:2", pixelformat=v4l2_fourcc('N', 'V', '6', '1') /* V4L2_PIX_FMT_NV61 */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('N', 'V', '6', '1') /* V4L2_PIX_FMT_NV61 */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('N', 'V', '6', '1') /* V4L2_PIX_FMT_NV61 */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=32}], num_planes=1}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=3, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="Y/VU 4:2:0", pixelformat=v4l2_fourcc('N', 'V', '2', '1') /* V4L2_PIX_FMT_NV21 */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('N', 'V', '2', '1') /* V4L2_PIX_FMT_NV21 */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('N', 'V', '2', '1') /* V4L2_PIX_FMT_NV21 */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=32}], num_planes=1}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=4, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="Y/UV 4:2:0", pixelformat=v4l2_fourcc('N', 'V', '1', '2') /* V4L2_PIX_FMT_NV12 */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('N', 'V', '1', '2') /* V4L2_PIX_FMT_NV12 */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('N', 'V', '1', '2') /* V4L2_PIX_FMT_NV12 */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=32}], num_planes=1}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=5, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="Y/VU 4:2:0 (N-C)", pixelformat=v4l2_fourcc('N', 'M', '2', '1') /* V4L2_PIX_FMT_NV21M */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('N', 'M', '2', '1') /* V4L2_PIX_FMT_NV21M */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('N', 'M', '2', '1') /* V4L2_PIX_FMT_NV21M */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=32}, {sizeimage=0, bytesperline=32}], num_planes=2}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=6, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, flags=0, description="Y/UV 4:2:0 (N-C)", pixelformat=v4l2_fourcc('N', 'M', '1', '2') /* V4L2_PIX_FMT_NV12M */}) = 0
ioctl(12, VIDIOC_TRY_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, fmt.pix_mp={width=0, height=0, pixelformat=v4l2_fourcc('N', 'M', '1', '2') /* V4L2_PIX_FMT_NV12M */, field=V4L2_FIELD_ANY, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[], num_planes=0}} => {fmt.pix_mp={width=32, height=0, pixelformat=v4l2_fourcc('N', 'M', '1', '2') /* V4L2_PIX_FMT_NV12M */, field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_DEFAULT, plane_fmt=[{sizeimage=0, bytesperline=32}, {sizeimage=0, bytesperline=32}], num_planes=2}}) = 0
ioctl(12, VIDIOC_ENUM_FMT, {index=7, type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE}) = -1 EINVAL (Invalid argument)
Using mplane plugin for capture
ioctl(12, VIDIOC_QUERYCAP, {driver="rkisp_v10", card="rkisp_mainpath", bus_info="platform:rkisp-vir0", version=KERNEL_VERSION(2, 9, 0), capabilities=V4L2_CAP_VIDEO_CAPTURE_MPLANE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_STREAMING|V4L2_CAP_DEVICE_CAPS, device_caps=V4L2_CAP_VIDEO_CAPTURE_MPLANE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_STREAMING}) = 0
ioctl(12, VIDIOC_G_PARM, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE}) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(12, VIDIOC_QUERYCAP, {driver="rkisp_v10", card="rkisp_mainpath", bus_info="platform:rkisp-vir0", version=KERNEL_VERSION(2, 9, 0), capabilities=V4L2_CAP_VIDEO_CAPTURE_MPLANE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_STREAMING|V4L2_CAP_DEVICE_CAPS, device_caps=V4L2_CAP_VIDEO_CAPTURE_MPLANE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_STREAMING}) = 0
ioctl(12, VIDIOC_ENUMINPUT, {index=0, name="Camera", type=V4L2_INPUT_TYPE_CAMERA, audioset=0, tuner=0, std=0, status=0, capabilities=0}) = 0
ioctl(12, VIDIOC_ENUMINPUT, {index=1})  = -1 EINVAL (Invalid argument)
ioctl(12, VIDIOC_ENUMSTD, {index=0})    = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(12, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL|0 /* V4L2_CID_??? */ => V4L2_CTRL_CLASS_IMAGE_PROC+0x1, type=V4L2_CTRL_TYPE_CTRL_CLASS, name="Image Processing Controls", ...}) = 0
ioctl(12, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL|V4L2_CTRL_CLASS_IMAGE_PROC+0x1 => V4L2_CID_PIXEL_RATE, type=V4L2_CTRL_TYPE_INTEGER64, name="Pixel Rate", ...}) = 0
ioctl(12, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL|V4L2_CID_PIXEL_RATE}) = -1 EINVAL (Invalid argument)
ioctl(12, VIDIOC_G_STD, 0x7ffe4fe180)   = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(12, VIDIOC_G_INPUT, 0x7ffe4fe124) = -1 ENOTTY (Inappropriate ioctl for device)
Pipeline is live and does not need PREROLL ...
ioctl(1, TCGETS, {c_iflag=ICRNL|IXON|IXOFF, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B115200|CS8|CREAD|HUPCL|CLOCAL, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
0:02:18.7 / 99:99:99.

正常的:

# buildroot:  buildroot文件系统就是好的。

/rockchip-test/camera/camera_rkisp_test.sh

# 实际执行的是

gst-launch-1.0 v4l2src device=/dev/video-camera0 ! video/x-raw,format=NV12,width=640,height=480, framerate=30/1 ! waylandsink

以后调试的时候,用buildroot,感觉RK对debian的支持还是不行。

使用buildroot环境给Debian编译一个ISP的3A程序,camera-engine-rkaiq包。

另写一篇 链接:https://www.cnblogs.com/allalonewithyou/p/19160415

还是不行。只是3AOK了。

解决

PS:

  1. 摄像头的 3A 是指自动对焦(AF)、自动曝光(AE)和自动白平衡(AWB)这三种关键自动化技术
  2. 日志 dev_info(dev, "%s(%d) enter!\n", __func__, __LINE__);
  3. container_of 函数 #define to_gc05a2(sd) container_of(sd, struct gc05a2, subdev)
posted @ 2025-10-14 11:55  潇汀  阅读(18)  评论(0)    收藏  举报