cat /sys/kernel/debug/pinctrl/pinctrl-rockchip-pinctrl/pinmux-pinscat /sys/kernel/debug/gpio20260129让天启AIO-3576Q38开发板跑原厂的Buildroot时适配xc7160【使用原厂DTS】缘起让天启AIO-3576Q38开发板跑原厂的Buildroot时适配xc7160【使用原厂DTS】让天启AIO-3576Q38开发板在Rockchip瑞芯微原厂Buildroot下打开gmac0芯片YT8531H-CA。我看原理图是YT8531H-CA/RTL8211F-CG硬件兼容设计的。应该可以直接替换使用的当你把荣品RD-RK3588开发板重新适配一把就相当于从头做了一个项目【荣品RD-RK3588开发板】。当然开发板的功能都是好的你免除了调试的过程也就没有解决相关硬件出错的经验/机会了1、驱动文件直接增加Z:\Linux_SDK\Firefly_SDK\kernel\drivers\media\i2c\xc7160.cZ:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\xc7160.c2、Z:\Linux_SDK\Firefly_SDK\kernel\drivers\media\i2c\MakefileZ:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\Makefileobj-$(CONFIG_VIDEO_WM8739) wm8739.oobj-$(CONFIG_VIDEO_WM8775) wm8775.oobj-$(CONFIG_VIDEO_XC7160) xc7160.o3、Z:\Linux_SDK\Firefly_SDK\kernel\drivers\media\i2c\KconfigZ:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\Kconfigconfig VIDEO_OS02K10tristate OmniVision OS02K10 sensor supportdepends on I2C VIDEO_DEVdepends on MEDIA_CAMERA_SUPPORTselect MEDIA_CONTROLLERselect VIDEO_V4L2_SUBDEV_APIselect V4L2_FWNODEhelpThis is a Video4Linux2 sensor driver for the OmniVisionOS02K10 camera.config VIDEO_XC7160tristate Firefly XC7160 support.depends on I2C VIDEO_DEVdepends on MEDIA_CAMERA_SUPPORTselect MEDIA_CONTROLLERselect VIDEO_V4L2_SUBDEV_APIselect V4L2_FWNODEhelpDriver for sv-taysh camera.This camera consists of ISP xc7160 and sensor sc8238config VIDEO_OS03B10tristate OmniVision OS03B10 sensor supportdepends on I2C VIDEO_DEVdepends on MEDIA_CAMERA_SUPPORTselect MEDIA_CONTROLLERselect VIDEO_V4L2_SUBDEV_APIselect V4L2_FWNODEhelpThis is a Video4Linux2 sensor driver for the OmniVisionOS03B10 camera.4、Z:\git_RK3576_Linux6.1\kernel-6.1\.configY:\A7_RK3576_LINUX\kernel\.configCONFIG_VIDEO_IMX586y# CONFIG_VIDEO_JX_F37 is not set# CONFIG_VIDEO_JX_H62 is not set# CONFIG_VIDEO_JX_H65 is not set# CONFIG_VIDEO_JX_K17 is not set# CONFIG_VIDEO_MIS2031 is not set# CONFIG_VIDEO_MIS4001 is not set# CONFIG_VIDEO_MT9M001 is not set# CONFIG_VIDEO_MT9M032 is not set# CONFIG_VIDEO_MT9M111 is not set# CONFIG_VIDEO_MT9P031 is not set# CONFIG_VIDEO_MT9T001 is not set# CONFIG_VIDEO_MT9T112 is not set# CONFIG_VIDEO_MT9V011 is not set# CONFIG_VIDEO_MT9V032 is not set# CONFIG_VIDEO_MT9V111 is not set# CONFIG_VIDEO_NOON010PC30 is not set# CONFIG_VIDEO_OG01A10 is not set# CONFIG_VIDEO_OG01A1B is not set# CONFIG_VIDEO_OG02B10 is not set# CONFIG_VIDEO_OS02G10 is not set# CONFIG_VIDEO_OS02K10 is not setCONFIG_VIDEO_XC7160y# CONFIG_VIDEO_OS03B10 is not setCONFIG_VIDEO_OS04A10y# CONFIG_VIDEO_OS04D10 is not set# CONFIG_VIDEO_OS05A20 is not setZ:\git_RK3576_Linux6.1\kernel-6.1\arch\arm64\configs\rockchip_linux_defconfigY:\A7_RK3576_LINUX\kernel\arch\arm64\configs\rockchip_linux_defconfigCONFIG_VIDEO_IMX464yCONFIG_VIDEO_XC7160yCONFIG_VIDEO_OS04A10y5、# Found kernels basic config fragment: rk3576.config make -C /home/rootroot/git_RK3576_Linux6.1/kernel/ -j25 CROSS_COMPILE/home/rootroot/git_RK3576_Linux6.1/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- ARCHarm64 rockchip_linux_defconfig rk3576.configmake: Entering directory /home/rootroot/git_RK3576_Linux6.1/kernel-6.1## configuration written to .config#Using .config as baseMerging ./arch/arm64/configs/rk3576.configValue of CONFIG_TOUCHSCREEN_GT9XX is redefined by fragment ./arch/arm64/configs/rk3576.config:Previous value: # CONFIG_TOUCHSCREEN_GT9XX is not setNew value: CONFIG_TOUCHSCREEN_GT9XXyValue of CONFIG_BLK_DEV_RAM_COUNT is redefined by fragment ./arch/arm64/configs/rk3576.config:Previous value: CONFIG_BLK_DEV_RAM_COUNT1New value: CONFIG_BLK_DEV_RAM_COUNT16## merged configuration written to .config (needs make)### configuration written to .config#make: Leaving directory /home/rootroot/git_RK3576_Linux6.1/kernel-6.1 make -C /home/rootroot/git_RK3576_Linux6.1/kernel/ -j25 CROSS_COMPILE/home/rootroot/git_RK3576_Linux6.1/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- ARCHarm64 rk3576-evb1-v10-linux.imgmake: Entering directory /home/rootroot/git_RK3576_Linux6.1/kernel-6.1SYNC include/config/auto.conf.cmdDTC arch/arm64/boot/dts/rockchip/rk3576-evb1-v10-linux.dtbCALL scripts/checksyscalls.sharch/arm64/boot/dts/rockchip/rk3576-evb1-cam-dcphy0.dtsi:25.24-46.4: ERROR (phandle_references): /i2c2acb0000/xc7160_01b: Reference to non-existent node or label pca9555arch/arm64/boot/dts/rockchip/rk3576-evb1-cam-dcphy0.dtsi:25.24-46.4: ERROR (phandle_references): /i2c2acb0000/xc7160_01b: Reference to non-existent node or label pca9555arch/arm64/boot/dts/rockchip/rk3576-evb1-cam-dcphy0.dtsi:7.21-16.11: ERROR (phandle_references): /cam0-pwr: Reference to non-existent node or label pca9555ERROR: Input tree has errors, aborting (use -f to force output)make[3]: *** [scripts/Makefile.lib:419: arch/arm64/boot/dts/rockchip/rk3576-evb1-v10-linux.dtb] Error 2make[2]: *** [scripts/Makefile.build:503: arch/arm64/boot/dts/rockchip] Error 2make[1]: *** [Makefile:1466: rockchip/rk3576-evb1-v10-linux.dtb] Error 2make[1]: *** Waiting for unfinished jobs....make: *** [arch/arm64/Makefile:221: rk3576-evb1-v10-linux.img] Error 2make: Leaving directory /home/rootroot/git_RK3576_Linux6.1/kernel-6.1ERROR: Running /home/rootroot/git_RK3576_Linux6.1/device/rockchip/common/scripts/mk-kernel.sh - run_command failed!ERROR: exit code 2 from line 36:$ERROR: call stack:build-helper: run_command(36)mk-kernel.sh: do_build(79)mk-kernel.sh: build_hook(438)mk-kernel.sh: main(496)ERROR: Running /home/rootroot/git_RK3576_Linux6.1/device/rockchip/common/build-hooks/99-all.sh - build_all failed!ERROR: exit code 2 from line 20:$RK_SCRIPTS_DIR/mk-kernel.shERROR: call stack:99-all.sh: build_all(20)99-all.sh: build_hook(136)build-helper: try_func(63)build-helper: try_hook(96)build-helper: source(165)99-all.sh: main(147)ERROR: Running /home/rootroot/git_RK3576_Linux6.1/device/rockchip/common/build-hooks/99-all.sh - try_func build_hook all failed!ERROR: exit code 2 from line 67:build_hookERROR: call stack:build-helper: try_func(67)build-helper: try_hook(96)build-helper: source(165)99-all.sh: main(147)rootrootrootroot-X99-Turbo:~/git_RK3576_Linux6.1$ ./build.sh6、rootrk3576-buildroot:/#rootrk3576-buildroot:/#rootrk3576-buildroot:/# i2cdetect -y 20 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- --10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --20: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU --50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --70: -- -- -- -- -- -- -- --rootrk3576-buildroot:/#rootrk3576-buildroot:/#rootrk3576-buildroot:/# i2cdetect -y 80 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- --10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --70: -- -- -- -- -- -- -- --rootrk3576-buildroot:/#rootrk3576-buildroot:/#rootrk3576-buildroot:/# dmesg | grep xc7160[ 3.174122] platform csi2-dphy0: Fixed dependency cycle(s) with /i2c2ac90000/xc7160_11b[ 3.174943] platform csi2-dcphy0: Fixed dependency cycle(s) with /i2c2acb0000/xc7160_01b[ 3.211941] xc7160 6-001b: T-chip firefly camera driver version: 00.01.04[ 3.211976] xc7160 6-001b: Failed to get power-gpios, maybe no use[ 3.212072] xc7160 6-001b: supply avdd not found, using dummy regulator[ 3.212141] xc7160 6-001b: supply dovdd not found, using dummy regulator[ 3.212180] xc7160 6-001b: supply dvdd not found, using dummy regulator[ 3.212202] xc7160 6-001b: could not get default pinstate[ 3.212208] xc7160 6-001b: could not get sleep pinstate[ 3.212218] xc7160 6-001b: Success to get xc7160 endpoint data lanes, dts uses 4 lanes[ 3.225660] xc7160 6-001b: isp chip is xc7160[ 3.226493] xc7160 8-001b: T-chip firefly camera driver version: 00.01.04[ 3.226521] xc7160 8-001b: Failed to get power-gpios, maybe no use[ 3.228694] xc7160 8-001b: supply avdd not found, using dummy regulator[ 3.228760] xc7160 8-001b: supply dovdd not found, using dummy regulator[ 3.228789] xc7160 8-001b: supply dvdd not found, using dummy regulator[ 3.228814] xc7160 8-001b: could not get default pinstate[ 3.228820] xc7160 8-001b: could not get sleep pinstate[ 3.228830] xc7160 8-001b: Success to get xc7160 endpoint data lanes, dts uses 4 lanes[ 3.241625] xc7160 8-001b: write XC7160_REG_HIGH_SELECT failed[ 3.242578] xc7160: probe of 8-001b failed with error -5[ 3.281321] xc7160 6-001b: Consider updating driver xc7160 to match on endpoints[ 3.281342] rockchip-csi2-dphy csi2-dphy0: dphy0 matches m01_f_xc7160 6-001b:bus type 5[ 4.209663] xc7160 6-001b: isp chip is xc7160[ 4.249623] xc7160 6-001b: isp chip is xc7160[ 4.281585] xc7160 6-001b: isp chip is xc7160rootrk3576-buildroot:/#rootrk3576-buildroot:/#很容易知道Z:\git_RK3576_Linux6.1\kernel-6.1\arch\arm64\boot\dts\rockchip\rk3576-firefly-aio-3576q38-cam-8ms1m.dtsiZ:\git_RK3576_Linux6.1\kernel-6.1\arch\arm64\boot\dts\rockchip77-min原厂\rk3576-evb1-cam-dcphy0.dtsi【这个挂载i2c8了】Z:\git_RK3576_Linux6.1\kernel-6.1\arch\arm64\boot\dts\rockchip\rk3576-firefly-aio-3576q38-cam-dcphy-8ms1m不是这个.dtsi7、还是不行rootrk3576-buildroot:/#rootrk3576-buildroot:/#rootrk3576-buildroot:/# i2cdetect -y 20 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- --10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --20: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU --50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --70: -- -- -- -- -- -- -- --rootrk3576-buildroot:/#rootrk3576-buildroot:/# i2cdetect -y 6Error: Could not open file /dev/i2c-6 or /dev/i2c/6: No such file or directoryrootrk3576-buildroot:/#rootrk3576-buildroot:/#rootrk3576-buildroot:/# dmesg | grep xc7160rootrk3576-buildroot:/#rootrk3576-buildroot:/#很容易知道i2c6的GPIO冲突了【正常】pin 50 (gpio1-18): wireless-bluetooth gpio1:50 function uart4 group uart4m1-rtsnpin 51 (gpio1-19): 2ad70000.serial (GPIO UNCLAIMED) function uart4 group uart4m1-ctsnpin 52 (gpio1-20): 2ad70000.serial (GPIO UNCLAIMED) function uart4 group uart4m1-xferpin 53 (gpio1-21): 2ad70000.serial (GPIO UNCLAIMED) function uart4 group uart4m1-xferpin 54 (gpio1-22): (MUX UNCLAIMED) (GPIO UNCLAIMED)【异常】pin 50 (gpio1-18): 2ac90000.i2c (GPIO UNCLAIMED) function i2c6 group i2c6m1-xferpin 51 (gpio1-19): 2ac90000.i2c (GPIO UNCLAIMED) function i2c6 group i2c6m1-xferpin 52 (gpio1-20): (MUX UNCLAIMED) (GPIO UNCLAIMED)pin 53 (gpio1-21): (MUX UNCLAIMED) (GPIO UNCLAIMED)pin 54 (gpio1-22): (MUX UNCLAIMED) gpio1:548、拿掉UART4rootrk3576-buildroot:/#rootrk3576-buildroot:/# ls -ltotal 68lrwxrwxrwx 1 root root 7 Jan 26 04:22 bin - usr/bin-rwxr-xr-x 1 root root 489 Jan 20 07:28 busybox.fragmentlrwxrwxrwx 1 root root 8 Jan 29 12:08 data - userdatadrwxr-xr-x 14 root root 3920 Jan 29 12:49 devdrwxr-xr-x 23 root root 4096 Jan 29 12:49 etcdrwxr-xr-x 2 root root 4096 Jan 29 12:08 infolrwxrwxrwx 1 root root 7 Jan 26 04:22 lib - usr/liblrwxrwxrwx 1 root root 3 Jan 26 04:22 lib64 - liblrwxrwxrwx 1 root root 11 Jan 26 05:01 linuxrc - bin/busyboxdrwx------ 2 root root 16384 Jan 29 12:10 lostfounddrwxr-xr-x 11 root root 4096 Jan 26 05:41 mediadrwxr-xr-x 5 root root 4096 Jan 29 12:08 mntdrwxr-xr-x 3 root root 4096 Jan 29 12:49 oemdrwxr-xr-x 3 root root 4096 Jan 26 05:41 optdr-xr-xr-x 257 root root 0 Jan 29 12:49 procdrwxr-xr-x 17 root root 4096 Jan 29 12:08 rockchip-testdrwx------ 2 root root 4096 Jan 20 07:28 rootdrwxr-xr-x 10 root root 500 Jan 29 12:49 runlrwxrwxrwx 1 root root 8 Jan 26 04:22 sbin - usr/sbinlrwxrwxrwx 1 root root 10 Jan 29 12:08 sdcard - mnt/sdcarddr-xr-xr-x 14 root root 0 Jan 29 12:49 sysdrwxr-xr-x 3 root root 4096 Jan 29 12:08 systemdrwxrwxrwt 5 root root 180 Jan 29 12:49 tmplrwxrwxrwx 1 root root 9 Jan 29 12:08 udisk - mnt/udiskdrwxr-xr-x 4 root root 4096 Jan 29 12:49 userdatadrwxr-xr-x 7 root root 4096 Jan 29 12:08 usrdrwxr-xr-x 6 root root 4096 Jan 29 12:10 varlrwxrwxrwx 1 root root 6 Jan 29 12:08 vendor - systemrootrk3576-buildroot:/#rootrk3576-buildroot:/# v4l2-ctl --list-devices[ 67.231950] xc7160 6-001b: isp chip is xc7160[ 67.267912] xc7160 6-001b: isp chip is xc7160[ 67.299938] xc7160 6-001b: isp chip is xc7160[ 67.331956] xc7160 6-001b: isp chip is xc7160[ 67.363792] xc7160 6-001b: isp chip is xc7160[ 67.395954] xc7160 6-001b: isp chip is xc7160[ 67.427939] xc7160 6-001b: isp chip is xc7160[ 67.459946] xc7160 6-001b: isp chip is xc7160[ 67.491954] xc7160 6-001b: isp chip is xc7160[ 67.524000] xc7160 6-001b: isp chip is xc7160[ 67.555908] xc7160 6-001b: isp chip is xc7160rkcif (platform:rkcif-mipi-lvds1):/dev/video0/dev/video1/dev/video2/dev/video3/dev/video4/dev/video5/dev/video6/dev/video7/dev/video8/dev/video9/dev/video10/dev/media0[ 67.587904] xc7160 6-001b: isp chip is xc7160rootrk3576-buildroot:/#【天启的DTS】【原厂的DTS】9、效果图4Kgst-launch-1.0 v4l2src device/dev/video0 num-buffers100 ! video/x-raw,formatNV12, width3840,height2160 ! tee namet ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location8ms1_h264_4k_100.mp4 t. ! queue ! waylandsinkgst-launch-1.0 v4l2src device/dev/video0 num-buffers10000 ! video/x-raw,formatNV12, width3840,height2160 ! tee namet ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location8ms1_h264_4k_10000.mp4 t. ! queue ! waylandsink1080pgst-launch-1.0 v4l2src device/dev/video0 num-buffers10000 ! video/x-raw,formatNV12, width1920,height1080 ! tee namet ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location8ms1_h264_1080p_100.mp4 t. ! queue ! waylandsink25*601500【1分钟的4K录像】gst-launch-1.0 v4l2src device/dev/video0 num-buffers1500 ! video/x-raw,formatNV12, width3840,height2160 ! tee namet ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location8ms1_h264_4k_1500.mp4 t. ! queue ! waylandsinkbuildroot用命令进行4k录像gst-launch-1.0 -e v4l2src device/dev/video0 io-mode4 ! \video/x-raw,formatNV12,width3840,height2160,framerate30/1 ! \mpph265enc ! h265parse ! video/x-h265,stream-formathev1,alignmentau ! \mp4mux -e ! filesink locationhw265.mp4gst-launch-1.0 v4l2src device/dev/video0 num-buffers10000 ! video/x-raw,formatNV12, width1920,height1080 ! tee namet ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location13855_h264_1080p_100.mp4 t. ! queue ! waylandsinkgst-launch-1.0 v4l2src device/dev/video0 num-buffers100 ! video/x-raw,formatNV12, width1920,height1080 ! tee namet ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location13855_h264_1080p_100.mp4 t. ! queue ! waylandsink