fimc.txt 5.7 KB

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