Bootstrap

RV1126新增驱动IMX415 SENSOR,实现v4l2抓图

RV1126新增驱动IMX415 SENSOR,实现v4l2抓图。

1:内核dts修改

&csi_dphy0 {

status = "okay";

ports {

#address-cells = <1>;

#size-cells = <0>;

port@0 {

reg = <0>;

#address-cells = <1>;

#size-cells = <0>;

mipi_in_ucam0: endpoint@1 {

reg = <1>;

remote-endpoint = <&ucam_out0>;

data-lanes = <1 2 3 4>;

};

};

port@1 {

reg = <1>;

#address-cells = <1>;

#size-cells = <0>;

csidphy0_out: endpoint@0 {

reg = <0>;

remote-endpoint = <&mipi_csi2_input>;

};

};

};

};

&i2c1 {

status = "okay";

clock-frequency = <400000>;

imx415: imx415@1a {

compatible = "sony,imx415";

reg = <0x1a>;

clocks = <&cru CLK_MIPICSI_OUT>;

clock-names = "xvclk";

power-domains = <&power RV1126_PD_VI>;

pinctrl-names = "rockchip,camera_default";

pinctrl-0 = <&mipicsi_clk0>;

avdd-supply = <&vcc3v3_sys>;

dovdd-supply = <&vcc_1v8>;

dvdd-supply = <&vcc_dvdd>;

/* reset is always pulled high in v10 */

reset-gpios = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>;

rockchip,camera-module-index = <1>;

rockchip,camera-module-facing = "front";

rockchip,camera-module-name = "YT10092";

rockchip,camera-module-lens-name = "IR0147-50IRC-8M-F20";

ir-cut = <&cam_ircut0>;

flash-leds = <&flash_ir>;

port {

ucam_out0: endpoint {

remote-endpoint = <&mipi_in_ucam0>;

data-lanes = <1 2 3 4>;

};

};

};

};

2:Makefile修改

obj-$(CONFIG_VIDEO_IMX415)+= imx415.o

3:Kconfig修改

config VIDEO_IMX415

4:驱动对应的宏开关打开

以上修改后,重新编译内核。重新总体编译。

5:单板启动注册成功

[root@RV1126_RV1109:/]

Media controllerAPI version 4.19.111

Media deviceinformation

------------------------

driver rkcif

model rkcif_mipi_lvds

serial

bus info

hw revision 0x0

driverversion 4.19.111

Device topology

- entity 1:stream_cif_mipi_id0 (1 pad, 4 links)

type Node subtype V4L flags 0

device node name /dev/video0

pad0: Sink

<-"rockchip-mipi-csi2":1 [ENABLED]

<-"rockchip-mipi-csi2":2 []

<-"rockchip-mipi-csi2":3 []

<-"rockchip-mipi-csi2":4 []

- entity 5:stream_cif_mipi_id1 (1 pad, 4 links)

type Node subtype V4L flags 0

device node name /dev/video1

pad0: Sink

<-"rockchip-mipi-csi2":1 []

<- "rockchip-mipi-csi2":2[ENABLED]

<-"rockchip-mipi-csi2":3 []

<-"rockchip-mipi-csi2":4 []

- entity 9:stream_cif_mipi_id2 (1 pad, 4 links)

type Node subtype V4L flags 0

device node name /dev/video2

pad0: Sink

<-"rockchip-mipi-csi2":1 []

<-"rockchip-mipi-csi2":2 []

<-"rockchip-mipi-csi2":3 [ENABLED]

<-"rockchip-mipi-csi2":4 []

- entity 13:stream_cif_mipi_id3 (1 pad, 4 links)

type Node subtype V4L flags 0

device node name /dev/video3

pad0: Sink

<-"rockchip-mipi-csi2":1 []

<-"rockchip-mipi-csi2":2 []

<-"rockchip-mipi-csi2":3 []

<-"rockchip-mipi-csi2":4 [ENABLED]

- entity 17:rockchip-mipi-csi2 (5 pads, 17 links)

type V4L2 subdev subtype Unknownflags 0

device node name /dev/v4l-subdev1

pad0: Sink

[fmt:SGBRG10_1X10/3864x2192field:none

crop.bounds:(12,16)/3840x2160

crop:(12,16)/3840x2160]

<-"rockchip-mipi-dphy-rx":1 [ENABLED]

pad1: Source

[fmt:SGBRG10_1X10/3864x2192field:none

crop.bounds:(12,16)/3840x2160

crop:(12,16)/3840x2160]

->"stream_cif_mipi_id0":0 [ENABLED]

->"stream_cif_mipi_id1":0 []

-> "stream_cif_mipi_id2":0 []

->"stream_cif_mipi_id3":0 []

pad2: Source

[fmt:SGBRG10_1X10/3864x2192field:none

crop.bounds:(12,16)/3840x2160

crop:(12,16)/3840x2160]

-> "stream_cif_mipi_id0":0 []

->"stream_cif_mipi_id1":0 [ENABLED]

->"stream_cif_mipi_id2":0 []

->"stream_cif_mipi_id3":0 []

pad3: Source

[fmt:SGBRG10_1X10/3864x2192field:none

crop.bounds:(12,16)/3840x2160

crop:(12,16)/3840x2160]

->"stream_cif_mipi_id0":0 []

->"stream_cif_mipi_id1":0 []

->"stream_cif_mipi_id2":0 [ENABLED]

-> "stream_cif_mipi_id3":0[]

pad4: Source

[fmt:SGBRG10_1X10/3864x2192field:none

crop.bounds:(12,16)/3840x2160

crop:(12,16)/3840x2160]

->"stream_cif_mipi_id0":0 []

-> "stream_cif_mipi_id1":0[]

->"stream_cif_mipi_id2":0 []

->"stream_cif_mipi_id3":0 [ENABLED]

- entity 23:rockchip-mipi-dphy-rx (2 pads, 2 links)

type V4L2 subdev subtype Unknownflags 0

device node name /dev/v4l-subdev2

pad0: Sink

[fmt:SGBRG10_1X10/3864x2192@10000/300000 field:none

crop.bounds:(12,16)/3840x2160]

<- "m01_f_imx4151-001a":0 [ENABLED]

pad1: Source

[fmt:SGBRG10_1X10/3864x2192@10000/300000field:none

crop.bounds:(12,16)/3840x2160]

->"rockchip-mipi-csi2":0 [ENABLED]

- entity 28:rkcif-mipi-luma (0 pad, 0 link)

type Node subtype V4L flags 0

device node name /dev/video4

- entity 31:m01_f_imx415 1-001a (1 pad, 1 link)

type V4L2 subdev subtype Sensorflags 0

device node name /dev/v4l-subdev3

pad0: Source

[fmt:SGBRG10_1X10/3864x2192@10000/300000 field:none

crop.bounds:(12,16)/3840x2160]

->"rockchip-mipi-dphy-rx":0 [ENABLED]

- entity 35:m01_f_ircut (0 pad, 0 link)

type V4L2 subdev subtype Lens flags1

device node name /dev/v4l-subdev4

[root@RV1126_RV1109:/]#

ioctl:VIDIOC_ENUM_FMT

Type: Video Capture Multiplanar

[0]: 'NV16' (Y/CbCr 4:2:2)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[1]: 'NV61' (Y/CrCb 4:2:2)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[2]: 'NV12' (Y/CbCr 4:2:0)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[3]: 'NV21' (Y/CrCb 4:2:0)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[4]: 'YUYV' (YUYV 4:2:2)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[5]: 'YVYU' (YVYU 4:2:2)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[6]: 'UYVY' (UYVY 4:2:2)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[7]: 'VYUY' (VYUY 4:2:2)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[8]: 'RGB3' (24-bit RGB 8-8-8)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[9]: 'RGBP' (16-bit RGB 5-6-5)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[10]: 'BGRH' (18-bit BGRX 6-6-6-14)

Size: Stepwise 64x64 - 3864x2192 withstep 8/8

[11]: 'RGGB' (8-bit Bayer RGRG/GBGB)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[12]: 'GRBG' (8-bit Bayer GRGR/BGBG)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[13]: 'GBRG' (8-bit Bayer GBGB/RGRG)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[14]: 'BA81' (8-bit Bayer BGBG/GRGR)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[15]: 'RG10' (10-bit Bayer RGRG/GBGB)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[16]: 'BA10' (10-bit Bayer GRGR/BGBG)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[17]: 'GB10' (10-bit Bayer GBGB/RGRG)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[18]: 'BG10' (10-bit Bayer BGBG/GRGR)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[19]: 'RG12' (12-bit Bayer RGRG/GBGB)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[20]: 'BA12' (12-bit Bayer GRGR/BGBG)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[21]: 'GB12' (12-bit Bayer GBGB/RGRG)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[22]: 'BG12' (12-bit Bayer BGBG/GRGR)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[23]: 'BYR2' (16-bit Bayer BGBG/GRGR)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[24]: 'Y16 ' (16-bit Greyscale)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[25]: 'GREY' (8-bit Greyscale)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[26]: 'EBD8' (Embedded data 8-bit,compressed)

Size: Stepwise 64x64 -3864x2192 with step 8/8

[27]: 'SPD6' (Shield pix data 16-bit,compressed)

Size: Stepwise 64x64 -3864x2192 with step 8/8

6:v4l2抓图成功

[root@RV1126_RV1109:/]#v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,heigh

t=2160,pixelformat=SGBRG10_1X10\--stream-mmap=3 \--stream-skip=3 \--stream-to=/

tmp/cif888.out\--stream-count=1 \--stream-poll

[ 216.222320] rkcif_mipi_lvds: stream[0] startstreaming

[ 216.222446] rockchip-mipi-csi2ffb10000.mipi-csi2: stream on, src_sd: d2dfee3b, sd_name:rockchip-mipi-dphy-rx

[ 216.222457] rockchip-mipi-csi2ffb10000.mipi-csi2: stream ON

[ 216.222484] rockchip-mipi-dphy-rxff4b0000.csi-dphy: stream on:1

[ 216.222500] rockchip-mipi-dphy-rx:data_rate_mbps 892

[ 216.223557] rockchip-mipi-dphy-rxff4b0000.csi-dphy: stream on:1

<<<[ 216.473292] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.506625] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.539958] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.573304] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.606626] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.639971] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.673278] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.706639] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.739943] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.773291] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.806637] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.839973] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.873305] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.906639] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.939971] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

[ 216.973304] rkcif_mipi_lvds: not activebuffer, skip current frame, mipi/lvds stream[0]

<[ 216.987827] rkcif_mipi_lvds: stream[0] startstopping

[ 217.006837] rockchip-mipi-csi2ffb10000.mipi-csi2: stream off, src_sd: d2dfee3b, sd_name:rockchip-mipi-dphy-rx

[ 217.006906] rockchip-mipi-csi2ffb10000.mipi-csi2: stream OFF

[ 217.006944] rockchip-mipi-dphy-rxff4b0000.csi-dphy: stream on:0

[ 217.008102] rockchip-mipi-dphy-rxff4b0000.csi-dphy: stream on:0

[ 217.009920] rkcif_mipi_lvds: stream[0]stopping finished

7:抓图文件查看

[root@RV1126_RV1109:/tmp]#ls -l

total 16512

drwxr-xr-x 2 avahiavahi 40 Jan 1 00:00 avahi-autoipd

-rw-r--r-- 1root root 16588800 Jan 1 00:03 cif888.out

-rw-r--r-- 1root root 66024 Jan 1 00:00 cl_viv_vx_ext.h

drwxr-xr-x 2root root 60 Jan 1 00:00 dbus

-rw-r--r-- 1root root 0 Jan 1 00:00 dnsmasq.leases

---------- 1root root 6 Jan 1 00:00 loglevel

-rw-r--r-- 1root root 25687 Jan 1 00:04 messages

-rw-r--r-- 1root root 204896 Jan 1 00:03 messages.0

-rw-r--r-- 1root root 1349 Jan 1 00:00 mountall.log

drwxr-xr-x 7root root 180 Jan 1 00:00 nginx

-rw-r--r-- 1root root 55 Jan 1 00:00 resolv.conf

drwxr-xr-x 2root root 60 Jan 1 00:00 subsys

drwx------ 2root root 40 Jan 1 00:00 tmp.4soNzzu8dM

8:至此驱动调试完成,欢迎讨论交流

;