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