R-Car/Devices

= Introduction =

The R-Car SoCs contain a large number of peripheral devices. SoC variants within a family usually differ by the number and configuration of the peripherals, while new SoC generations introduce more drastic changes in the peripherals themselves, both in the form of new peripherals and significative architectural changes to existing peripherals.

This page describes Linux support for the R-Car family peripherals. It puts the focus on usage of the peripherals from a userspace point of view. Implementation details internal to the Linux kernel are considered out of scope here, and differences between versions of a peripheral are only described if they matter for applications.

= I/O Peripherals =

MSIOF
The Clock-Synchronized Serial Interface with FIFO can be used as e.g. an SPI master or SPI slave controller.

Tests

 * Tests:MSIOF-SPI-Slave: Test SPI Slave support using MSIOF1/2 loopback on expansion I/O connectors

SCIF
(High Speed) Serial Communication Interface with FIFO (A/B)

Tests

 * Tests:SCIF-FIFO: Test SCIF FIFO behavior, using SCIF3, SCIFA5, SCIFB0, and HSCIF1 on expansion I/O connectors

= Multimedia Peripherals =

Tests
The DU unit tests suite is available in the following git tree.

git://git.ideasonboard.com/renesas/kms-tests.git

Instructions to build, install and run the test scripts are available in the README file.

Additionally, instructions are available to perform manual tests using modetest or kmsxx.

VSP
The VSP is the successor of the VIO6 video processing engine found in the first generation R-Car SoCs. I provides per-frame video processing such as color management, up/down scaling and blending. The first version of the VSP, named VSP1, is available on the second generation R-Car SoCs. The third generation R-Car SoCs introduced an updated VSP named VSP2 with support for more video processing functions.

The VSP operates in memory-to-memory mode, with some instances supporting direct output to the Display Unit (DU). All instances have one or more input channels to read data from memory, one or more output channels to write data to memory, and a variable number of video processing blocks that can be arranged freely to create processing pipelines.


 * The Read Pixel Formatter (RPF) reads images from memory and unpacks them with optional pixel encoding conversion and alpha channel support.
 * The Write Pixel Formatter (WPF) packs and writes images to memory with optional dithering, mirroring/flipping and pixel encoding conversion support.
 * The Blend ROP Unit (BRU) blends up to four (Gen2) or five (Gen3) input frames into a single output using ROP and/or alpha blending.
 * The Blend ROP Sub unit (BRS) is an additional two inputs blend/ROP unit.
 * The Super Resolution Unit (SRU) performs super-resolution processing with optional x2 upscaling.
 * The Up/Down Scaler (UDS) scales the input frame up or down by a factor of x1/4 to x4.
 * The Look Up Table (LUT) converts the input frame using a per-component look-up table.
 * The Cubic Look-up Table (CLU) converts the input frame using a 2-dimensional or 3-dimensional look-up table that takes all pixel components into account simultaneously.
 * The Hue Saturation value Transform (HST) converts a frame from RGB to HSV.
 * The Hue Saturation value Inverse transform (HSI) converts a frame from HSV to RGB.
 * The Histogram Generator One dimension (HGO) computes per-component one-dimensional histograms on a frame.
 * The Histogram Generator Two dimension (HGT) computes a two-dimensional histogram on a frame.
 * The Lcdc InterFace (LIF) transfers frames to the Display Unit (DU).
 * The SHarPness (SHP) sharpens or unsharpens frames.

The following table shows the blocks available in each VSP variant.

Usage
Both the VSP1 and VSP2 are supported in mainline Linux by a V4L2 driver named vsp1 (the BRS and SHP blocks are currently not supported). The driver uses the Media Controller API. It creates one video device node for each input and output, and exposes one V4L2 subdev device node to userspace for each hardware processing block. Applications use the Media Controller link setup API to connect the blocks into a video pipelines, the V4L2 subdev API to configure formats on the pipeline and the V4L2 API to stream video in and out of the VSP.

The following list describes the API exposed by each supported hardware block.


 * RPF
 * The RPF exposes one subdev node and one video device node to userspace. The video node is a video output device named rpf.[0-9] input implementing the V4L2 multiplane video API with V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE buffers. It reads data from memory and provides it to the RPF. The subdev is named rpf.[0-9] and has two pads, a sink pad connected to the RPF video node and a source pad connectable to any of the other non-RPF subdevs.


 * WPF
 * Similarly to the RPF, the WPF exposes one subdev node and one video device node to userspace. The video node is a video capture device named wpf.[0-9] implementing the V4L2 multiplane video API with V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE buffers. It stores data provided by the WPF to memory. The subdev is named wpf.[0-9] and has two pads, a sink pad connectable to any of the other non-WPF subdevs and a source pad connected to the WPF video node.


 * HGO
 * The HGO exposes one subdev node and one video device node to userspace. The video node is a video capture device named hgo histo implementing the V4L2 metadata API with V4L2_BUF_TYPE_META_CAPTURE buffers. It stores histogram data computed by the HGO to memory and operates with a V4L2_BUF_TYPE_META_CAPTURE buffers queue. The subdev is named hgo and has two pads, a sink pad connectable to any of the non-WPF subdevs and a source pad connected to the HGO video node.
 * The HGO subdev supports the crop and compose selection rectangles on its sink pad. The crop rectangle controls the portion of the input frame that is used for histogram computation. The compose rectangle controls subsampling through skipping, with supported skipping values of no skipping, 1/2 and 1/4 skipping, independently in the horizontal and vertical directions. The compose rectangle top left corner is thus hardwired to (0,0), only the rectangle size can be modified.
 * The HGO subdev exposes two controls to configure the Maximum RGB Mode (Gen2 and Gen3) and the number of bins (Gen3 only). When Maximum RGB Mode is enabled the HGO computes the minimum, maximum, sums and histogram values on the maximum of the R, G and B components for each pixel. Otherwise it computes the statistics on the R, G and B components separately. Maximum RGB Mode can only be enabled when operating on RGB pixels. The number of bins can be configured to 64 or 256 on Gen3 and is fixed to 64 on Gen2.


 * HGT
 * The HGT exposes one subdev node and one video device node to userspace. The video node is a video capture device named hgt histo implementing the V4L2 metadata API with V4L2_BUF_TYPE_META_CAPTURE buffers. It stores histogram data computed by the HGT to memory and operates with a V4L2_BUF_TYPE_META_CAPTURE buffers queue. The subdev is named hgt and has two pads, a sink pad connectable to any of the non-WPF subdevs and a source pad connected to the HGT video node.
 * The HGT subdev supports the crop and compose selection rectangles on its sink pad. The crop rectangle controls the portion of the input frame that is used for histogram computation. The compose rectangle controls subsampling through skipping, with supported skipping values of no skipping, 1/2 and 1/4 skipping, independently in the horizontal and vertical directions. The compose rectangle top left corner is thus hardwired to (0,0), only the rectangle size can be modified.
 * The HGT subdev exposes one control to configure the Boundary Values for Hue Area. The HGT operates on a HSV image and computes the minimum, maximum and sum of the S component and a histogram based on the H and S components of each pixel. The histogram can be weighted for different Hue areas using the Boundary Values for Hue Area control.

Tests
The VSP unit tests suite is available in the following git tree.

git://git.ideasonboard.com/renesas/vsp-tests.git http://git.ideasonboard.com/renesas/vsp-tests.git

Instructions to build, install and run the test scripts are available in the README file.

VSP DU Writeback
The VSP DU Writeback node is a prototype stage extension to the VSP, which at this time requires manual testing. Instructions to help you try out this extension can be found at R-Car/Tests:VSPWriteback

VIN
VIN are a video capturing device found on R-Car SoC, the device is supported by the rcar-vin driver. The driver is currently being rewritten to break out of the soc_camera framework. The soc_camera driver only supports Gen2 while the new driver yet to be merged will add support for Gen3.

Tests
R-Car/Tests:rcar-vin

FDP1
The FDP1 is a fine display processor device found on R-Car SoC, supported by the rcar-fdp1 driver. The FDP1 driver is implemented as a V4L2 Memory2Memory driver and provides video pixel format conversion and de-interlacing features.

Tests
The FDP test suite is available in the following git tree.

https://github.com/kbingham/fdp1test.git

Instructions to build, install and run the test scripts are available in the README file.