How to configure RKISP and camera sensor

Hi,
I’m using custom camera board to connect the dual camera in Rock960 board.

I followed the below link to configure my MIPI D-PHY RX0 camera with RK ISP.

media-ctl -d /dev/media0  -p
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, 5 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10/1920x1080 field:none
                 crop.bounds:(0,0)/1920x1080
                 crop:(0,0)/1920x1080]
                <- "rockchip-sy-mipi-dphy":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV2X8/1920x1080 field:none
                 crop.bounds:(0,0)/1920x1080
                 crop:(0,0)/1920x1080]
                -> "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-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
        pad0: Sink
                <- "rkisp1-isp-subdev":3 [ENABLED]

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

- entity 6: rockchip-sy-mipi-dphy (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:UYVY2X8/1920x1080 field:none]
                <- "ar0330_0 2-003c":0 [ENABLED]
        pad1: Source
                [fmt:UYVY2X8/1920x1080 field:none]
                -> "rkisp1-isp-subdev":0 [ENABLED]

- entity 7: ar0330_0 2-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:UYVY2X8/1920x1080 field:none]
                -> "rockchip-sy-mipi-dphy":0 [ENABLED]

media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":2[fmt:UYVY2X8/1920x1080 field:none]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":0[fmt:UYVY2X8/1920x1080 field:none]'
media-ctl -d /dev/media0 --set-v4l2 '"ar0330_0 2-003c":0[fmt:UYVY2X8/1920x1080 field:none]'
media-ctl -d /dev/media0 -l '"ar0330_0 2-003c":0->"rockchip-sy-mipi-dphy":0[1]'
v4l2-ctl --device /dev/video0  --stream-mmap

And I followed the below procedure to configure MIPI D-PHY TX1RX1 camera sensor with RKISP

media-ctl -d /dev/media1  -p
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, 5 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10/1920x1080 field:none
                 crop.bounds:(0,0)/1920x1080
                 crop:(0,0)/1920x1080]
                <- "rockchip-sy-mipi-dphy":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV2X8/1920x1080 field:none
                 crop.bounds:(0,0)/1920x1080
                 crop:(0,0)/1920x1080]
                -> "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/video4
        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/video5
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]

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

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

- entity 6: rockchip-sy-mipi-dphy (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:UYVY2X8/1920x1080 field:none]
                <- "ar0330_2 1-003c":0 [ENABLED]
        pad1: Source
                [fmt:UYVY2X8/1920x1080 field:none]
                -> "rkisp1-isp-subdev":0 [ENABLED]

- entity 7: ar0330_2 1-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:UYVY2X8/1920x1080 field:none]
                -> "rockchip-sy-mipi-dphy":0 [ENABLED]

media-ctl -d /dev/media1 --set-v4l2 '"rkisp1-isp-subdev":2[fmt:UYVY2X8/1920x1080 field:none]'
media-ctl -d /dev/media1 --set-v4l2 '"rkisp1-isp-subdev":0[fmt:UYVY2X8/1920x1080 field:none]'
media-ctl -d /dev/media1 --set-v4l2 '"ar0330_2 1-003c":0[fmt:UYVY2X8/1920x1080 field:none]'
media-ctl -d /dev/media1 -l '"ar0330_2 1-003c":0->"rockchip-sy-mipi-dphy":0[1]'
v4l2-ctl --device /dev/video4  --stream-mmap

I got the data from camera RX0. But I didn’t get the data from the camera TX1RX1. Did I missed anything in the ISP configure for 2nd camera?

1 Like

You need also the enable the tx/rx as rx in device tree if you use rock960 ab. Check rock960 c dts:

https://github.com/96rocks/kernel/blob/33fb3acc053189406d28184582239e952abe3589/arch/arm64/boot/dts/rockchip/rock960-model-c-linux.dts#L1217

I enabled the tx/rx as rx in device tree as its mentioned in Rock960 C dts.

Please paste your kernel dts patch and kernel booting log. We can check it for you.

Hi @hipboi,

Sorry for the late reply.

Now I can able to configure both MIPI D-PHY RX0 and MIPI D-PHY TX1RX1 camera.

When I stream the MIPI D-PHY TX1RX1 camera, I can able to get the preview but I get some mipi mis error continuously from the rkisp.
[ 4737.332475] rkisp1: MIPI mis error: 0x00800000
[ 4737.370018] rkisp1: MIPI mis error: 0x01800000

But when I stream the MIPI D-PHY RX0 camera, I can able to get the preview without any error.

Note:

  • MIPI camera configuration
  1. 1920x1080P @60 FPS
  2. MIPI Lane: 4
  3. pixel_clock = 500000000
  4. link_freq = 500000000

Thanks & Regards,
Bala

And how to calculate pixel_clock and link_freq for 1920x1080p@60fps resolution?

Thanks & Regards,
Bala

Can you check if this document helps?

https://dl.vamrs.com/products/rock960/docs/sw/Rockchip Linux%20Camera Developer%20Guide%20V1.1.pdf

1 Like