요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
The Samsung S5P/Exynos4 FIMC driver
===================================
Copyright |copy| 2012 - 2013 Samsung Electronics Co., Ltd.
The FIMC (Fully Interactive Mobile Camera) device available in Samsung
SoC Application Processors is an integrated camera host interface, color
space converter, image resizer and rotator. It's also capable of capturing
data from LCD controller (FIMD) through the SoC internal writeback data
path. There are multiple FIMC instances in the SoCs (up to 4), having
slightly different capabilities, like pixel alignment constraints, rotator
availability, LCD writeback support, etc. The driver is located at
drivers/media/platform/samsung/exynos4-is directory.
Supported SoCs
--------------
S5PC100 (mem-to-mem only), S5PV210, Exynos4210
Supported features
------------------
- camera parallel interface capture (ITU-R.BT601/565);
- camera serial interface capture (MIPI-CSI2);
- memory-to-memory processing (color space conversion, scaling, mirror
and rotation);
- dynamic pipeline re-configuration at runtime (re-attachment of any FIMC
instance to any parallel video input or any MIPI-CSI front-end);
- runtime PM and system wide suspend/resume
Not currently supported
-----------------------
- LCD writeback input
- per frame clock gating (mem-to-mem)
User space interfaces
---------------------
Media device interface
~~~~~~~~~~~~~~~~~~~~~~
The driver supports Media Controller API as defined at :ref:`media_controller`.
The media device driver name is "Samsung S5P FIMC".
The purpose of this interface is to allow changing assignment of FIMC instances
to the SoC peripheral camera input at runtime and optionally to control internal
connections of the MIPI-CSIS device(s) to the FIMC entities.
The media device interface allows to configure the SoC for capturing image
data from the sensor through more than one FIMC instance (e.g. for simultaneous
viewfinder and still capture setup).
Reconfiguration is done by enabling/disabling media links created by the driver
during initialization. The internal device topology can be easily discovered
through media entity and links enumeration.
Memory-to-memory video node
~~~~~~~~~~~~~~~~~~~~~~~~~~~
V4L2 memory-to-memory interface at /dev/video? device node. This is standalone
video device, it has no media pads. However please note the mem-to-mem and
capture video node operation on same FIMC instance is not allowed. The driver
detects such cases but the applications should prevent them to avoid an
undefined behaviour.
Capture video node
~~~~~~~~~~~~~~~~~~
The driver supports V4L2 Video Capture Interface as defined at
:ref:`devices`.
At the capture and mem-to-mem video nodes only the multi-planar API is
supported. For more details see: :ref:`planar-apis`.
Camera capture subdevs
~~~~~~~~~~~~~~~~~~~~~~
Each FIMC instance exports a sub-device node (/dev/v4l-subdev?), a sub-device
node is also created per each available and enabled at the platform level
MIPI-CSI receiver device (currently up to two).
sysfs
~~~~~
In order to enable more precise camera pipeline control through the sub-device
API the driver creates a sysfs entry associated with "s5p-fimc-md" platform
device. The entry path is: /sys/platform/devices/s5p-fimc-md/subdev_conf_mode.
In typical use case there could be a following capture pipeline configuration:
sensor subdev -> mipi-csi subdev -> fimc subdev -> video node
When we configure these devices through sub-device API at user space, the
configuration flow must be from left to right, and the video node is
configured as last one.
When we don't use sub-device user space API the whole configuration of all
devices belonging to the pipeline is done at the video node driver.
The sysfs entry allows to instruct the capture node driver not to configure
the sub-devices (format, crop), to avoid resetting the subdevs' configuration
when the last configuration steps at the video node is performed.
For full sub-device control support (subdevs configured at user space before
starting streaming):
.. code-block:: none
# echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
For V4L2 video node control only (subdevs configured internally by the host
driver):
.. code-block:: none
# echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
This is a default option.
5. Device mapping to video and subdev device nodes
--------------------------------------------------
There are associated two video device nodes with each device instance in
hardware - video capture and mem-to-mem and additionally a subdev node for
more precise FIMC capture subsystem control. In addition a separate v4l2
sub-device node is created per each MIPI-CSIS device.
How to find out which /dev/video? or /dev/v4l-subdev? is assigned to which
device?
You can either grep through the kernel log to find relevant information, i.e.
.. code-block:: none
# dmesg | grep -i fimc
(note that udev, if present, might still have rearranged the video nodes),
or retrieve the information from /dev/media? with help of the media-ctl tool:
.. code-block:: none
# media-ctl -p
7. Build
--------
If the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m)
two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and
optional s5p-csis.ko (MIPI-CSI receiver subdev).
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Samsung S5P/Exynos4 FIMC driver
1-18이 문서는 GPL-2.0 라이선스를 따르며, 저작권은 2012-2013 Samsung Electronics Co., Ltd.에 있습니다.
Samsung SoC Application Processor의 FIMC(Fully Interactive Mobile Camera)는 camera host interface, color space converter, image resizer와 rotator를 통합한 장치입니다. SoC 내부 writeback data path를 통해 LCD controller(FIMD)의 data를 capture할 수도 있습니다.
SoC에는 최대 4개의 FIMC instance가 있으며 pixel alignment 제약, rotator 제공 여부, LCD writeback 지원 등 capability가 조금씩 다릅니다. Driver는 `drivers/media/platform/samsung/exynos4-is`에 있습니다.
지원 SoC
19-23지원하는 SoC는 S5PC100(mem-to-mem 전용), S5PV210, Exynos4210입니다.
지원 기능
24-34- Camera parallel interface capture(ITU-R.BT601/565)
- Camera serial interface capture(MIPI-CSI2)
- Color space conversion, scaling, mirror, rotation을 포함한 memory-to-memory processing
- 실행 중 dynamic pipeline reconfiguration: 모든 FIMC instance를 임의의 parallel video input 또는 MIPI-CSI front-end에 다시 연결
- Runtime PM과 system-wide suspend/resume
현재 지원하지 않는 기능
35-40- LCD writeback input
- Frame별 clock gating(mem-to-mem)
Media device interface
41-61Driver는 `media_controller`에서 정의한 Media Controller API를 지원합니다. Media device driver 이름은 `Samsung S5P FIMC`입니다.
이 interface는 실행 중 FIMC instance와 SoC peripheral camera input의 할당을 바꾸고, 선택적으로 MIPI-CSIS device와 FIMC entity 사이의 내부 연결을 제어하기 위한 것입니다.
Media device interface를 사용하면 둘 이상의 FIMC instance를 거쳐 sensor image data를 capture하도록 SoC를 구성할 수 있습니다. 예를 들어 viewfinder와 still capture를 동시에 구성할 수 있습니다.
재구성은 driver가 initialization 때 만든 media link를 활성화하거나 비활성화하여 수행합니다. 내부 device topology는 media entity와 link를 열거하여 쉽게 확인할 수 있습니다.
Memory-to-memory video node
62-69`/dev/video?` device node에 V4L2 memory-to-memory interface가 있습니다. 이 standalone video device에는 media pad가 없습니다.
동일한 FIMC instance에서 mem-to-mem video node와 capture video node를 함께 동작시키는 것은 허용되지 않습니다. Driver가 이 경우를 감지하지만 undefined behavior를 피하려면 application이 미리 방지해야 합니다.
Capture video node
70-79Driver는 `devices`에서 정의한 V4L2 Video Capture Interface를 지원합니다. Capture와 mem-to-mem video node에서는 multi-planar API만 지원합니다. 자세한 내용은 `planar-apis`를 참조하십시오.
Camera capture sub-device
80-86각 FIMC instance는 `/dev/v4l-subdev?` sub-device node를 노출합니다. Platform level에서 사용할 수 있고 활성화된 각 MIPI-CSI receiver device에도 sub-device node를 하나씩 만듭니다. 현재는 최대 두 개입니다.
sysfs pipeline 제어
87-122Sub-device API를 통해 camera pipeline을 더 정밀하게 제어할 수 있도록 driver는 `s5p-fimc-md` platform device에 연결된 sysfs entry를 만듭니다. 경로는 `/sys/platform/devices/s5p-fimc-md/subdev_conf_mode`입니다.
일반적인 capture pipeline 구성은 다음과 같습니다.
User space의 sub-device API로 설정할 때는 sensor에서 video node 방향으로 구성하며 video node를 마지막에 설정합니다.
User space에서 sub-device API로 이 장치들을 구성할 때는 왼쪽에서 오른쪽 순서로 진행하고 video node를 마지막에 구성해야 합니다.
User space sub-device API를 사용하지 않으면 pipeline에 속한 모든 device의 구성을 video node driver가 수행합니다. 이 sysfs entry를 사용하면 capture node driver가 sub-device의 format과 crop을 설정하지 않도록 지시할 수 있습니다. 따라서 마지막 video node 설정 단계가 앞서 구성한 sub-device 설정을 reset하지 않습니다.
Streaming을 시작하기 전에 user space에서 sub-device를 구성하는 완전한 sub-device 제어를 사용하려면 다음과 같이 설정합니다.
# echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
Host driver가 내부적으로 sub-device를 구성하는 V4L2 video node 전용 제어를 사용하려면 다음과 같이 설정합니다.
# echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
`vid-dev`가 기본 option입니다.
Video 및 subdev node mapping
123-147각 hardware device instance에는 video capture와 mem-to-mem이라는 두 video device node가 연결되며, FIMC capture subsystem을 더 정밀하게 제어하기 위한 subdev node도 하나 있습니다. 또한 각 MIPI-CSIS device마다 별도의 V4L2 sub-device node를 만듭니다.
어떤 `/dev/video?` 또는 `/dev/v4l-subdev?`가 어느 device에 할당되었는지 알아보려면 kernel log에서 관련 정보를 찾을 수 있습니다.
# dmesg | grep -i fimc
udev가 설치되어 있다면 그 뒤에도 video node 순서를 다시 배치했을 수 있습니다.
또는 `media-ctl` 도구를 사용해 `/dev/media?`에서 정보를 가져올 수 있습니다.
# media-ctl -p
Module build
148-153Driver를 loadable kernel module(`CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m`)로 build하면 core V4L2 module 외에 `s5p-fimc.ko`와 선택적인 MIPI-CSI receiver subdev module `s5p-csis.ko`가 생성됩니다.
FIMC capture subsystem
fimc.rst:1-153S5P/Exynos4 FIMC의 capture와 memory-to-memory 기능, 동적 media link, sub-device pipeline 설정 순서 및 device node mapping을 한 페이지에서 확인할 수 있습니다.
일반적인 MIPI-CSI capture 경로입니다.