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