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