fimc.rst 5.3 KB

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