Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
fork
Configure Feed
Select the types of activity you want to include in your feed.
1.. SPDX-License-Identifier: GPL-2.0
2
3MIPI CSI-2
4==========
5
6CSI-2 is a data bus intended for transferring images from cameras to
7the host SoC. It is defined by the `MIPI alliance`_.
8
9.. _`MIPI alliance`: http://www.mipi.org/
10
11Transmitter drivers
12-------------------
13
14CSI-2 transmitter, such as a sensor or a TV tuner, drivers need to
15provide the CSI-2 receiver with information on the CSI-2 bus
16configuration. These include the V4L2_CID_LINK_FREQ and
17V4L2_CID_PIXEL_RATE controls and
18(:c:type:`v4l2_subdev_video_ops`->s_stream() callback). These
19interface elements must be present on the sub-device represents the
20CSI-2 transmitter.
21
22The V4L2_CID_LINK_FREQ control is used to tell the receiver driver the
23frequency (and not the symbol rate) of the link. The
24V4L2_CID_PIXEL_RATE is may be used by the receiver to obtain the pixel
25rate the transmitter uses. The
26:c:type:`v4l2_subdev_video_ops`->s_stream() callback provides an
27ability to start and stop the stream.
28
29The value of the V4L2_CID_PIXEL_RATE is calculated as follows::
30
31 pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample
32
33where
34
35.. list-table:: variables in pixel rate calculation
36 :header-rows: 1
37
38 * - variable or constant
39 - description
40 * - link_freq
41 - The value of the V4L2_CID_LINK_FREQ integer64 menu item.
42 * - nr_of_lanes
43 - Number of data lanes used on the CSI-2 link. This can
44 be obtained from the OF endpoint configuration.
45 * - 2
46 - Two bits are transferred per clock cycle per lane.
47 * - bits_per_sample
48 - Number of bits per sample.
49
50The transmitter drivers must, if possible, configure the CSI-2
51transmitter to *LP-11 mode* whenever the transmitter is powered on but
52not active. Some transmitters do this automatically but some have to
53be explicitly programmed to do so, and some are unable to do so
54altogether due to hardware constraints.
55
56Stopping the transmitter
57^^^^^^^^^^^^^^^^^^^^^^^^
58
59A transmitter stops sending the stream of images as a result of
60calling the ``.s_stream()`` callback. Some transmitters may stop the
61stream at a frame boundary whereas others stop immediately,
62effectively leaving the current frame unfinished. The receiver driver
63should not make assumptions either way, but function properly in both
64cases.
65
66Receiver drivers
67----------------
68
69Before the receiver driver may enable the CSI-2 transmitter by using
70the :c:type:`v4l2_subdev_video_ops`->s_stream(), it must have powered
71the transmitter up by using the
72:c:type:`v4l2_subdev_core_ops`->s_power() callback. This may take
73place either indirectly by using :c:func:`v4l2_pipeline_pm_use` or
74directly.