R-Car/Tests:rcar-vin

This document describes how to test the VIN and CSI2 (only present on Gen3) functionality on Renesas R-Car Gen2 and Gen3.

Get the patches
Ideally all the code to test VIN should be available in the kernel, unfortunately this is not the case yet. Renesas driver parts not yet picked-up are available in renesas-drivers kernel.

There are some patches needed to facilitate testing that are not part of renesas-drivers such as kernel configurations and DT changes. To ease testing a branch is available where all such patches are included which can just be build and used to test at:

https://git.ragnatech.se/linux rcar-vin-elinux

Gen2

 * VIN driver picked-up in v4.8-rc1.
 * To test the HDMI input the ADV7604 needs to be enabled (not default in shmobile_defconfig) and added to DT.

Gen3

 * VIN and CSI2 driver support is included in renesas-drivers.
 * Prototype driver for ADV7482 available in renesas-drivers, this driver is incomplete and requires more work.
 * To test CVBS or HDMI input the RCAR_VIN, RCAR_CSI2 and ADV7482 needs to be enabled (not default in defconfig) and added to DT.
 * There is one huge limitation in the prototype driver for ADV7482 which is used here, it can only support CVBS or HDMI video input. This is controlled by a compile time define (in adv7482.c), so if you want to grab HDMI video be sure to set it and recompile.

Boot the kernel
You should see this on successful probe (this is from Gen3):

rcar-vin e6ef0000.video: Device registered as video22 rcar-vin e6ef1000.video: Device registered as video23 rcar-vin e6ef2000.video: Device registered as video24 rcar-vin e6ef3000.video: Device registered as video25 rcar-vin e6ef4000.video: Device registered as video26 rcar-vin e6ef5000.video: Device registered as video27 rcar-vin e6ef6000.video: Device registered as video28 rcar-vin e6ef7000.video: Device registered as video29

Use v4l-utils to test
The v4l2-utils (git://linuxtv.org/v4l-utils.git) provide two tools which are helpful in testing rcar-vin.

qv4l2
A GUI tool which lets you view the video from a rcar-vin device and test a wide range of different input parameters. Start the tool and specifying which video device you wish to operate on using the -d parameter, the video device number for the different video nodes can be observed in the boot log as shown above.


 * 1) qv4l2 -d 23

v4l2-compliance
A compliance test tool that verifies the drivers user-space interface. Start the tool and specifying which video device you wish to operate on using the -d parameter, the video device number for the different video nodes can be observed in the boot log as shown above. There are a few other options worth testing, --stream-all-formats (-f) and --streaming= (-s) will test that the driver actually can grab frames in different formats.

Driver Info: Driver name  : rcar_vin Card type    : R_Car_VIN Bus info     : platform:e6ef1000.video Driver version: 4.6.0 Capabilities : 0x85200001 Video Capture Read/Write Streaming Extended Pix Format Device Capabilities Device Caps  : 0x05200001 Video Capture Read/Write Streaming Extended Pix Format
 * 1) v4l2-compliance -d 23 -s -f

Compliance test for device /dev/video23 (not using libv4l2):

Required ioctls: test VIDIOC_QUERYCAP: OK

Allow for multiple opens: test second video open: OK	test VIDIOC_QUERYCAP: OK	test VIDIOC_G/S_PRIORITY: OK

Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK

Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK	test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 2 Audio Inputs: 0 Tuners: 0

Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK		test VIDIOC_QUERYCTRL: OK		test VIDIOC_G/S_CTRL: OK		test VIDIOC_G/S/TRY_EXT_CTRLS: OK		test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK		test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 0

Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK		test VIDIOC_G/S_PARM: OK		test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK		test VIDIOC_TRY_FMT: OK		test VIDIOC_S_FMT: OK		test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK		test Composing: OK		test Scaling: OK (Not Supported)

Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK		test VIDIOC_EXPBUF: OK

Test input 1:

Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK		test VIDIOC_QUERYCTRL: OK		test VIDIOC_G/S_CTRL: OK		test VIDIOC_G/S/TRY_EXT_CTRLS: OK		test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK		test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 0

Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK		test VIDIOC_G/S_PARM: OK		test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK		test VIDIOC_TRY_FMT: OK		test VIDIOC_S_FMT: OK		test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK		test Composing: OK		test Scaling: OK (Not Supported)

Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK		test VIDIOC_EXPBUF: OK

Test input 0:

Streaming ioctls: test read/write: OK	test MMAP: OK                                    	test USERPTR: OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device

Stream using all formats: test MMAP for Format NV16, Frame Size 720x576: Crop 720x576@0x0, Compose 720x576@0x0, Stride 736, Field None: OK  		Crop 720x576@0x0, Compose 720x576@0x0, Stride 736, Field Top: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 736, Field Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 736, Field Interlaced: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 736, Field Interlaced Top-Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 736, Field Interlaced Bottom-Top: OK   		Crop 6x4@0x0, Compose 720x576@0x0, Stride 736, Field Interlaced, SelTest: OK   		Crop 6x4@0x0, Compose 6x2@0x0, Stride 736, Field Interlaced, SelTest: OK   		Crop 720x576@0x0, Compose 6x2@0x0, Stride 736, Field Interlaced, SelTest: OK   		Crop 6x4@0x0, Compose 736x576@0x0, Stride 736, Field Interlaced, SelTest: OK   		Crop 720x576@0x0, Compose 736x576@0x0, Stride 736, Field Interlaced, SelTest: OK   	test MMAP for Format YUYV, Frame Size 736x576: Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field None: OK  		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Top: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Top-Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Bottom-Top: OK   		Crop 6x4@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced, SelTest: OK   		Crop 6x4@0x0, Compose 6x2@0x0, Stride 1440, Field Interlaced, SelTest: OK   		Crop 720x576@0x0, Compose 6x2@0x0, Stride 1440, Field Interlaced, SelTest: OK   	test MMAP for Format UYVY, Frame Size 720x576: Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field None: OK  		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Top: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Top-Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Bottom-Top: OK   	test MMAP for Format RGBP, Frame Size 720x576: Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field None: OK  		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Top: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Top-Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Bottom-Top: OK   	test MMAP for Format XR15, Frame Size 720x576: Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field None: OK  		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Top: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Top-Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 1440, Field Interlaced Bottom-Top: OK   	test MMAP for Format XR24, Frame Size 720x576: Crop 720x576@0x0, Compose 720x576@0x0, Stride 2880, Field None: OK  		Crop 720x576@0x0, Compose 720x576@0x0, Stride 2880, Field Top: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 2880, Field Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 2880, Field Interlaced: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 2880, Field Interlaced Top-Bottom: OK   		Crop 720x576@0x0, Compose 720x576@0x0, Stride 2880, Field Interlaced Bottom-Top: OK

Total: 110, Succeeded: 110, Failed: 0, Warnings: 0