blob: d9f950d90eb5b63acea36514ce343a20e5fc4ea0 [file] [log] [blame]
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -03001.. include:: <isonum.txt>
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -03002
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -03003The Samsung S5P/EXYNOS4 FIMC driver
4===================================
5
6Copyright |copy| 2012 - 2013 Samsung Electronics Co., Ltd.
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -03007
8The FIMC (Fully Interactive Mobile Camera) device available in Samsung
9SoC Application Processors is an integrated camera host interface, color
10space converter, image resizer and rotator. It's also capable of capturing
11data from LCD controller (FIMD) through the SoC internal writeback data
12path. There are multiple FIMC instances in the SoCs (up to 4), having
13slightly different capabilities, like pixel alignment constraints, rotator
14availability, LCD writeback support, etc. The driver is located at
Sylwester Nawrocki188ab112013-06-14 19:28:40 -030015drivers/media/platform/exynos4-is directory.
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030016
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030017Supported SoCs
18--------------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030019
20S5PC100 (mem-to-mem only), S5PV210, EXYNOS4210
21
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030022Supported features
23------------------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030024
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030025- camera parallel interface capture (ITU-R.BT601/565);
26- camera serial interface capture (MIPI-CSI2);
27- memory-to-memory processing (color space conversion, scaling, mirror
28 and rotation);
29- dynamic pipeline re-configuration at runtime (re-attachment of any FIMC
30 instance to any parallel video input or any MIPI-CSI front-end);
31- runtime PM and system wide suspend/resume
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030032
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030033Not currently supported
34-----------------------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030035
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030036- LCD writeback input
37- per frame clock gating (mem-to-mem)
38
39Files partitioning
40------------------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030041
42- media device driver
Sylwester Nawrocki188ab112013-06-14 19:28:40 -030043 drivers/media/platform/exynos4-is/media-dev.[ch]
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030044
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030045- camera capture video device driver
Sylwester Nawrocki188ab112013-06-14 19:28:40 -030046 drivers/media/platform/exynos4-is/fimc-capture.c
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030047
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030048- MIPI-CSI2 receiver subdev
Sylwester Nawrocki188ab112013-06-14 19:28:40 -030049 drivers/media/platform/exynos4-is/mipi-csis.[ch]
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030050
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030051- video post-processor (mem-to-mem)
Sylwester Nawrocki188ab112013-06-14 19:28:40 -030052 drivers/media/platform/exynos4-is/fimc-core.c
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030053
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030054- common files
Sylwester Nawrocki188ab112013-06-14 19:28:40 -030055 drivers/media/platform/exynos4-is/fimc-core.h
56 drivers/media/platform/exynos4-is/fimc-reg.h
57 drivers/media/platform/exynos4-is/regs-fimc.h
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030058
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030059User space interfaces
60---------------------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030061
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030062Media device interface
63~~~~~~~~~~~~~~~~~~~~~~
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030064
65The driver supports Media Controller API as defined at
Mauro Carvalho Chehab991ce922015-12-04 10:38:59 -020066https://linuxtv.org/downloads/v4l-dvb-apis/media_common.html
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030067The media device driver name is "SAMSUNG S5P FIMC".
68
69The purpose of this interface is to allow changing assignment of FIMC instances
70to the SoC peripheral camera input at runtime and optionally to control internal
71connections of the MIPI-CSIS device(s) to the FIMC entities.
72
73The media device interface allows to configure the SoC for capturing image
74data from the sensor through more than one FIMC instance (e.g. for simultaneous
75viewfinder and still capture setup).
76Reconfiguration is done by enabling/disabling media links created by the driver
77during initialization. The internal device topology can be easily discovered
78through media entity and links enumeration.
79
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030080Memory-to-memory video node
81~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030082
83V4L2 memory-to-memory interface at /dev/video? device node. This is standalone
84video device, it has no media pads. However please note the mem-to-mem and
85capture video node operation on same FIMC instance is not allowed. The driver
86detects such cases but the applications should prevent them to avoid an
87undefined behaviour.
88
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030089Capture video node
90~~~~~~~~~~~~~~~~~~
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030091
92The driver supports V4L2 Video Capture Interface as defined at:
Mauro Carvalho Chehab991ce922015-12-04 10:38:59 -020093https://linuxtv.org/downloads/v4l-dvb-apis/devices.html
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030094
95At the capture and mem-to-mem video nodes only the multi-planar API is
96supported. For more details see:
Mauro Carvalho Chehab991ce922015-12-04 10:38:59 -020097https://linuxtv.org/downloads/v4l-dvb-apis/planar-apis.html
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -030098
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -030099Camera capture subdevs
100~~~~~~~~~~~~~~~~~~~~~~
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300101
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
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300106sysfs
107~~~~~
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300108
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):
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300127
128.. code-block:: none
129
130 # echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300131
132For V4L2 video node control only (subdevs configured internally by the host
133driver):
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300134
135.. code-block:: none
136
137 # echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode
138
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300139This is a default option.
140
1415. Device mapping to video and subdev device nodes
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300142--------------------------------------------------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300143
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.
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300153
154.. code-block:: none
155
156 # dmesg | grep -i fimc
157
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300158(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:
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300161
162.. code-block:: none
163
164 # media-ctl -p
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300165
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -03001667. Build
Mauro Carvalho Chehabf0726e42016-07-17 17:57:31 -0300167--------
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300168
Sylwester Nawrocki1b741bc2012-01-30 11:38:21 -0300169If 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).