1*40249b1dSTomi Valkeinen.. SPDX-License-Identifier: GPL-2.0 2*40249b1dSTomi Valkeinen 3*40249b1dSTomi Valkeinen============================================ 4*40249b1dSTomi ValkeinenRaspberry Pi PiSP Camera Front End (rp1-cfe) 5*40249b1dSTomi Valkeinen============================================ 6*40249b1dSTomi Valkeinen 7*40249b1dSTomi ValkeinenThe PiSP Camera Front End 8*40249b1dSTomi Valkeinen========================= 9*40249b1dSTomi Valkeinen 10*40249b1dSTomi ValkeinenThe PiSP Camera Front End (CFE) is a module which combines a CSI-2 receiver with 11*40249b1dSTomi Valkeinena simple ISP, called the Front End (FE). 12*40249b1dSTomi Valkeinen 13*40249b1dSTomi ValkeinenThe CFE has four DMA engines and can write frames from four separate streams 14*40249b1dSTomi Valkeinenreceived from the CSI-2 to the memory. One of those streams can also be routed 15*40249b1dSTomi Valkeinendirectly to the FE, which can do minimal image processing, write two versions 16*40249b1dSTomi Valkeinen(e.g. non-scaled and downscaled versions) of the received frames to memory and 17*40249b1dSTomi Valkeinenprovide statistics of the received frames. 18*40249b1dSTomi Valkeinen 19*40249b1dSTomi ValkeinenThe FE registers are documented in the `Raspberry Pi Image Signal Processor 20*40249b1dSTomi Valkeinen(ISP) Specification document 21*40249b1dSTomi Valkeinen<https://datasheets.raspberrypi.com/camera/raspberry-pi-image-signal-processor-specification.pdf>`_, 22*40249b1dSTomi Valkeinenand example code for FE can be found in `libpisp 23*40249b1dSTomi Valkeinen<https://github.com/raspberrypi/libpisp>`_. 24*40249b1dSTomi Valkeinen 25*40249b1dSTomi ValkeinenThe rp1-cfe driver 26*40249b1dSTomi Valkeinen================== 27*40249b1dSTomi Valkeinen 28*40249b1dSTomi ValkeinenThe Raspberry Pi PiSP Camera Front End (rp1-cfe) driver is located under 29*40249b1dSTomi Valkeinendrivers/media/platform/raspberrypi/rp1-cfe. It uses the `V4L2 API` to register 30*40249b1dSTomi Valkeinena number of video capture and output devices, the `V4L2 subdev API` to register 31*40249b1dSTomi Valkeinensubdevices for the CSI-2 received and the FE that connects the video devices in 32*40249b1dSTomi Valkeinena single media graph realized using the `Media Controller (MC) API`. 33*40249b1dSTomi Valkeinen 34*40249b1dSTomi ValkeinenThe media topology registered by the `rp1-cfe` driver, in this particular 35*40249b1dSTomi Valkeinenexample connected to an imx219 sensor, is the following one: 36*40249b1dSTomi Valkeinen 37*40249b1dSTomi Valkeinen.. _rp1-cfe-topology: 38*40249b1dSTomi Valkeinen 39*40249b1dSTomi Valkeinen.. kernel-figure:: raspberrypi-rp1-cfe.dot 40*40249b1dSTomi Valkeinen :alt: Diagram of an example media pipeline topology 41*40249b1dSTomi Valkeinen :align: center 42*40249b1dSTomi Valkeinen 43*40249b1dSTomi ValkeinenThe media graph contains the following video device nodes: 44*40249b1dSTomi Valkeinen 45*40249b1dSTomi Valkeinen- rp1-cfe-csi2-ch0: capture device for the first CSI-2 stream 46*40249b1dSTomi Valkeinen- rp1-cfe-csi2-ch1: capture device for the second CSI-2 stream 47*40249b1dSTomi Valkeinen- rp1-cfe-csi2-ch2: capture device for the third CSI-2 stream 48*40249b1dSTomi Valkeinen- rp1-cfe-csi2-ch3: capture device for the fourth CSI-2 stream 49*40249b1dSTomi Valkeinen- rp1-cfe-fe-image0: capture device for the first FE output 50*40249b1dSTomi Valkeinen- rp1-cfe-fe-image1: capture device for the second FE output 51*40249b1dSTomi Valkeinen- rp1-cfe-fe-stats: capture device for the FE statistics 52*40249b1dSTomi Valkeinen- rp1-cfe-fe-config: output device for FE configuration 53*40249b1dSTomi Valkeinen 54*40249b1dSTomi Valkeinenrp1-cfe-csi2-chX 55*40249b1dSTomi Valkeinen---------------- 56*40249b1dSTomi Valkeinen 57*40249b1dSTomi ValkeinenThe rp1-cfe-csi2-chX capture devices are normal V4L2 capture devices which 58*40249b1dSTomi Valkeinencan be used to capture video frames or metadata received from the CSI-2. 59*40249b1dSTomi Valkeinen 60*40249b1dSTomi Valkeinenrp1-cfe-fe-image0, rp1-cfe-fe-image1 61*40249b1dSTomi Valkeinen------------------------------------ 62*40249b1dSTomi Valkeinen 63*40249b1dSTomi ValkeinenThe rp1-cfe-fe-image0 and rp1-cfe-fe-image1 capture devices are used to write 64*40249b1dSTomi Valkeinenthe processed frames to memory. 65*40249b1dSTomi Valkeinen 66*40249b1dSTomi Valkeinenrp1-cfe-fe-stats 67*40249b1dSTomi Valkeinen---------------- 68*40249b1dSTomi Valkeinen 69*40249b1dSTomi ValkeinenThe format of the FE statistics buffer is defined by 70*40249b1dSTomi Valkeinen:c:type:`pisp_statistics` C structure and the meaning of each parameter is 71*40249b1dSTomi Valkeinendescribed in the `PiSP specification` document. 72*40249b1dSTomi Valkeinen 73*40249b1dSTomi Valkeinenrp1-cfe-fe-config 74*40249b1dSTomi Valkeinen----------------- 75*40249b1dSTomi Valkeinen 76*40249b1dSTomi ValkeinenThe format of the FE configuration buffer is defined by 77*40249b1dSTomi Valkeinen:c:type:`pisp_fe_config` C structure and the meaning of each parameter is 78*40249b1dSTomi Valkeinendescribed in the `PiSP specification` document. 79