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