在rk3399(rockpi 4b)上链接gc2145(自带isp的相机模组)(二)

第一步
首先参照rockpi4b的官方wiki把rockpi的bsp编译烧写跑起来,这部分不再赘述了

第二步
将官方的内核clone到bsp中,将原来的内核备份一下如下

//树形图
.

├── build
├── docker
├── kernel//官方内核
├── kernel-b
├── patch
├── README.md
├── rkbin
├── rootfs
└── u-boot

下载附件中的文件
下载链接
1 在 内核目录执行git apply patch就把patch文件打好了
此外还要添加rockpi4b对应的dts文件

2 将rockpi-4-linux.dtsi 保存到arch/arm64/boot/dts/rockchip目录中

3 将rockpi-4b-linux.dts 保存到arch/arm64/boot/dts/rockchip目录中

至此,内核层的文件全部准备完了,
编译内核生成boot.img

然后dd 到sd卡的第四个分区

sudo dd if=out/boot.img of=/dev/sdb4//看自己的sd号

加载自己制作的文件系统启动后可以查看如下的log

如下说明gc2145的驱动加载正常,否则请校验i2c的通信

dmesg |grep gc2145
[    2.980341] gc2145 4-003c: driver version: 00.01.05
[    2.981398] gc2145 4-003c: gc2145_parse_of(2843)
[    2.982277] gc2145 4-003c: gc2145_parse_of gc2145->bus_cfg.bus_type 2
[    2.983512] gc2145 4-003c: gc2145_parse_of mipi framesizes
[    2.984559] gc2145 4-003c: GPIO lookup for consumer pwdn
[    2.984572] gc2145 4-003c: using device tree for GPIO lookup
[    2.984619] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff3d0000/gc2145@3c[0]' - status (0)
[    2.984678] gc2145 4-003c: __gc2145_power_on(2740)
[    3.001678] gc2145 4-003c: Found GC2145 sensor
[    3.004780] gc2145 4-003c: m01_b_gc2145 4-003c sensor driver registered !!
[    9.669613] gc2145 4-003c: gc2145_power(2626) on(1)
[    9.675349] gc2145 4-003c: gc2145_init(2610)
[    9.948015] gc2145 4-003c: gc2145_power(2626) on(0)

查看isp的加载

grep '' /sys/class/video4linux/video*/name
/sys/class/video4linux/video0/name:rkisp1_mainpath
/sys/class/video4linux/video1/name:rkisp1_selfpath
/sys/class/video4linux/video2/name:rkisp1_dmapath
/sys/class/video4linux/video3/name:rkisp1-statistics
/sys/class/video4linux/video4/name:rkisp1-input-params

查看sensor的拓扑结构

dmesg | grep Async
[    3.003872] rkisp1: Async subdev notifier completed

上面的需要都确保一致才可以,

下面是可选的,有助于进一步了解数据流走向

移植
https://github.com/rockchip-linux/v4l-utils
到板子上
执行如下命令

sudo media-ctl -p
[sudo] password for ab64:
Media controller API version 0.1.0

Media device information
------------------------
driver          rkisp1
model           rkisp1
serial
bus info
hw revision     0x0
driver version  0.0.0

Device topology
- entity 1: rkisp1-isp-subdev (4 pads, 6 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:UYVY8_2X8/800x600 field:none
                 crop.bounds:(0,0)/800x600
                 crop:(0,0)/800x600]
                <- "rkisp1_dmapath":0 []
                <- "rockchip-mipi-dphy-rx":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV8_2X8/800x600 field:none
                 crop.bounds:(0,0)/800x600
                 crop:(0,0)/800x600]
                -> "rkisp1_selfpath":0 [ENABLED]
                -> "rkisp1_mainpath":0 [ENABLED]
        pad3: Source
                -> "rkisp1-statistics":0 [ENABLED]

- entity 2: rkisp1_mainpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]

- entity 3: rkisp1_selfpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]

- entity 4: rkisp1_dmapath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
        pad0: Source
                -> "rkisp1-isp-subdev":0 []

- entity 5: rkisp1-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
        pad0: Sink
                <- "rkisp1-isp-subdev":3 [ENABLED]

- entity 6: rkisp1-input-params (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video4
        pad0: Source
                -> "rkisp1-isp-subdev":1 [ENABLED]

- entity 7: rockchip-mipi-dphy-rx (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:UYVY8_2X8/800x600 field:none]
                <- "m01_b_gc2145 4-003c":0 [ENABLED]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none]
                -> "rkisp1-isp-subdev":0 [ENABLED]

- entity 8: m01_b_gc2145 4-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:UYVY8_2X8/800x600 field:none]
                -> "rockchip-mipi-dphy-rx":0 [ENABLED]
posted @ 2022-04-26 13:17  tccxy  阅读(712)  评论(0编辑  收藏  举报