fimc.rst 5.8 KB

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