1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun.. include:: <isonum.txt> 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunThe Samsung S5P/Exynos4 FIMC driver 6*4882a593Smuzhiyun=================================== 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunCopyright |copy| 2012 - 2013 Samsung Electronics Co., Ltd. 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunThe FIMC (Fully Interactive Mobile Camera) device available in Samsung 11*4882a593SmuzhiyunSoC Application Processors is an integrated camera host interface, color 12*4882a593Smuzhiyunspace converter, image resizer and rotator. It's also capable of capturing 13*4882a593Smuzhiyundata from LCD controller (FIMD) through the SoC internal writeback data 14*4882a593Smuzhiyunpath. There are multiple FIMC instances in the SoCs (up to 4), having 15*4882a593Smuzhiyunslightly different capabilities, like pixel alignment constraints, rotator 16*4882a593Smuzhiyunavailability, LCD writeback support, etc. The driver is located at 17*4882a593Smuzhiyundrivers/media/platform/exynos4-is directory. 18*4882a593Smuzhiyun 19*4882a593SmuzhiyunSupported SoCs 20*4882a593Smuzhiyun-------------- 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunS5PC100 (mem-to-mem only), S5PV210, Exynos4210 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunSupported features 25*4882a593Smuzhiyun------------------ 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun- camera parallel interface capture (ITU-R.BT601/565); 28*4882a593Smuzhiyun- camera serial interface capture (MIPI-CSI2); 29*4882a593Smuzhiyun- memory-to-memory processing (color space conversion, scaling, mirror 30*4882a593Smuzhiyun and rotation); 31*4882a593Smuzhiyun- dynamic pipeline re-configuration at runtime (re-attachment of any FIMC 32*4882a593Smuzhiyun instance to any parallel video input or any MIPI-CSI front-end); 33*4882a593Smuzhiyun- runtime PM and system wide suspend/resume 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunNot currently supported 36*4882a593Smuzhiyun----------------------- 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun- LCD writeback input 39*4882a593Smuzhiyun- per frame clock gating (mem-to-mem) 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunUser space interfaces 42*4882a593Smuzhiyun--------------------- 43*4882a593Smuzhiyun 44*4882a593SmuzhiyunMedia device interface 45*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~ 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunThe driver supports Media Controller API as defined at :ref:`media_controller`. 48*4882a593SmuzhiyunThe media device driver name is "Samsung S5P FIMC". 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunThe purpose of this interface is to allow changing assignment of FIMC instances 51*4882a593Smuzhiyunto the SoC peripheral camera input at runtime and optionally to control internal 52*4882a593Smuzhiyunconnections of the MIPI-CSIS device(s) to the FIMC entities. 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunThe media device interface allows to configure the SoC for capturing image 55*4882a593Smuzhiyundata from the sensor through more than one FIMC instance (e.g. for simultaneous 56*4882a593Smuzhiyunviewfinder and still capture setup). 57*4882a593Smuzhiyun 58*4882a593SmuzhiyunReconfiguration is done by enabling/disabling media links created by the driver 59*4882a593Smuzhiyunduring initialization. The internal device topology can be easily discovered 60*4882a593Smuzhiyunthrough media entity and links enumeration. 61*4882a593Smuzhiyun 62*4882a593SmuzhiyunMemory-to-memory video node 63*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~ 64*4882a593Smuzhiyun 65*4882a593SmuzhiyunV4L2 memory-to-memory interface at /dev/video? device node. This is standalone 66*4882a593Smuzhiyunvideo device, it has no media pads. However please note the mem-to-mem and 67*4882a593Smuzhiyuncapture video node operation on same FIMC instance is not allowed. The driver 68*4882a593Smuzhiyundetects such cases but the applications should prevent them to avoid an 69*4882a593Smuzhiyunundefined behaviour. 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunCapture video node 72*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~ 73*4882a593Smuzhiyun 74*4882a593SmuzhiyunThe driver supports V4L2 Video Capture Interface as defined at 75*4882a593Smuzhiyun:ref:`devices`. 76*4882a593Smuzhiyun 77*4882a593SmuzhiyunAt the capture and mem-to-mem video nodes only the multi-planar API is 78*4882a593Smuzhiyunsupported. For more details see: :ref:`planar-apis`. 79*4882a593Smuzhiyun 80*4882a593SmuzhiyunCamera capture subdevs 81*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~ 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunEach FIMC instance exports a sub-device node (/dev/v4l-subdev?), a sub-device 84*4882a593Smuzhiyunnode is also created per each available and enabled at the platform level 85*4882a593SmuzhiyunMIPI-CSI receiver device (currently up to two). 86*4882a593Smuzhiyun 87*4882a593Smuzhiyunsysfs 88*4882a593Smuzhiyun~~~~~ 89*4882a593Smuzhiyun 90*4882a593SmuzhiyunIn order to enable more precise camera pipeline control through the sub-device 91*4882a593SmuzhiyunAPI the driver creates a sysfs entry associated with "s5p-fimc-md" platform 92*4882a593Smuzhiyundevice. The entry path is: /sys/platform/devices/s5p-fimc-md/subdev_conf_mode. 93*4882a593Smuzhiyun 94*4882a593SmuzhiyunIn typical use case there could be a following capture pipeline configuration: 95*4882a593Smuzhiyunsensor subdev -> mipi-csi subdev -> fimc subdev -> video node 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunWhen we configure these devices through sub-device API at user space, the 98*4882a593Smuzhiyunconfiguration flow must be from left to right, and the video node is 99*4882a593Smuzhiyunconfigured as last one. 100*4882a593Smuzhiyun 101*4882a593SmuzhiyunWhen we don't use sub-device user space API the whole configuration of all 102*4882a593Smuzhiyundevices belonging to the pipeline is done at the video node driver. 103*4882a593SmuzhiyunThe sysfs entry allows to instruct the capture node driver not to configure 104*4882a593Smuzhiyunthe sub-devices (format, crop), to avoid resetting the subdevs' configuration 105*4882a593Smuzhiyunwhen the last configuration steps at the video node is performed. 106*4882a593Smuzhiyun 107*4882a593SmuzhiyunFor full sub-device control support (subdevs configured at user space before 108*4882a593Smuzhiyunstarting streaming): 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun.. code-block:: none 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun # echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode 113*4882a593Smuzhiyun 114*4882a593SmuzhiyunFor V4L2 video node control only (subdevs configured internally by the host 115*4882a593Smuzhiyundriver): 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun.. code-block:: none 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun # echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode 120*4882a593Smuzhiyun 121*4882a593SmuzhiyunThis is a default option. 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun5. Device mapping to video and subdev device nodes 124*4882a593Smuzhiyun-------------------------------------------------- 125*4882a593Smuzhiyun 126*4882a593SmuzhiyunThere are associated two video device nodes with each device instance in 127*4882a593Smuzhiyunhardware - video capture and mem-to-mem and additionally a subdev node for 128*4882a593Smuzhiyunmore precise FIMC capture subsystem control. In addition a separate v4l2 129*4882a593Smuzhiyunsub-device node is created per each MIPI-CSIS device. 130*4882a593Smuzhiyun 131*4882a593SmuzhiyunHow to find out which /dev/video? or /dev/v4l-subdev? is assigned to which 132*4882a593Smuzhiyundevice? 133*4882a593Smuzhiyun 134*4882a593SmuzhiyunYou can either grep through the kernel log to find relevant information, i.e. 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun.. code-block:: none 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun # dmesg | grep -i fimc 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun(note that udev, if present, might still have rearranged the video nodes), 141*4882a593Smuzhiyun 142*4882a593Smuzhiyunor retrieve the information from /dev/media? with help of the media-ctl tool: 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun.. code-block:: none 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun # media-ctl -p 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun7. Build 149*4882a593Smuzhiyun-------- 150*4882a593Smuzhiyun 151*4882a593SmuzhiyunIf the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m) 152*4882a593Smuzhiyuntwo modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and 153*4882a593Smuzhiyunoptional s5p-csis.ko (MIPI-CSI receiver subdev). 154