[gsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget*/translations/zh_CN/driver-api/media/tx-rxmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/zh_TW/driver-api/media/tx-rxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/it_IT/driver-api/media/tx-rxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ja_JP/driver-api/media/tx-rxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ko_KR/driver-api/media/tx-rxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/sp_SP/driver-api/media/tx-rxmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhD/var/lib/git/docbuild/linux/Documentation/driver-api/media/tx-rx.rsthKubhtarget)}(h.. _transmitter-receiver:h]h}(h]h ]h"]h$]h&]refidtransmitter-receiveruh1hhKhhhhhhubhsection)}(hhh](htitle)}(h+Pixel data transmitter and receiver driversh]h+Pixel data transmitter and receiver drivers}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hV4L2 supports various devices that transmit and receive pixel data. Examples of these devices include a camera sensor, a TV tuner and a parallel, a BT.656 or a CSI-2 receiver in an SoC.h]hV4L2 supports various devices that transmit and receive pixel data. Examples of these devices include a camera sensor, a TV tuner and a parallel, a BT.656 or a CSI-2 receiver in an SoC.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h Bus typesh]h Bus types}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hPThe following busses are the most common. This section discusses these two only.h]hPThe following busses are the most common. This section discusses these two only.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h MIPI CSI-2h]h MIPI CSI-2}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hyCSI-2 is a data bus intended for transferring images from cameras to the host SoC. It is defined by the `MIPI alliance`_.h](hhCSI-2 is a data bus intended for transferring images from cameras to the host SoC. It is defined by the }(hjhhhNhNubh reference)}(h`MIPI alliance`_h]h MIPI alliance}(hj!hhhNhNubah}(h]h ]h"]h$]h&]name MIPI alliancerefurihttps://www.mipi.org/uh1jhjresolvedKubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h*.. _`MIPI alliance`: https://www.mipi.org/h]h}(h] mipi-allianceah ]h"] mipi allianceah$]h&]j1j2uh1hhKhjhhhh referencedKubeh}(h] mipi-csi-2ah ]h"] mipi csi-2ah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hParallel and BT.656h]hParallel and BT.656}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjShhhhhKubh)}(hThe parallel and `BT.656`_ buses transport one bit of data on each clock cycle per data line. The parallel bus uses synchronisation and other additional signals whereas BT.656 embeds synchronisation.h](hThe parallel and }(hjdhhhNhNubj )}(h `BT.656`_h]hBT.656}(hjlhhhNhNubah}(h]h ]h"]h$]h&]nameBT.656j1*https://en.wikipedia.org/wiki/ITU-R_BT.656uh1jhjdj3Kubh buses transport one bit of data on each clock cycle per data line. The parallel bus uses synchronisation and other additional signals whereas BT.656 embeds synchronisation.}(hjdhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjShhubh)}(h8.. _`BT.656`: https://en.wikipedia.org/wiki/ITU-R_BT.656h]h}(h]bt-656ah ]h"]bt.656ah$]h&]j1j|uh1hhK hjShhhhjJKubeh}(h]parallel-and-bt-656ah ]h"]parallel and bt.656ah$]h&]uh1hhhhhhhhKubeh}(h] bus-typesah ]h"] bus typesah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hTransmitter driversh]hTransmitter drivers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK#ubh)}(hTransmitter drivers generally need to provide the receiver drivers with the configuration of the transmitter. What is required depends on the type of the bus. These are common for both busses.h]hTransmitter drivers generally need to provide the receiver drivers with the configuration of the transmitter. What is required depends on the type of the bus. These are common for both busses.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjhhubh)}(hhh](h)}(hMedia bus pixel codeh]hMedia bus pixel code}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK*ubh)}(hSee :ref:`v4l2-mbus-pixelcode`.h](hSee }(hjhhhNhNubh)}(h:ref:`v4l2-mbus-pixelcode`h]hinline)}(hjh]hv4l2-mbus-pixelcode}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocdriver-api/media/tx-rx refdomainjreftyperef refexplicitrefwarn reftargetv4l2-mbus-pixelcodeuh1hhhhK,hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK,hjhhubeh}(h]media-bus-pixel-codeah ]h"]media bus pixel codeah$]h&]uh1hhjhhhhhK*ubh)}(hhh](h)}(hLink frequencyh]hLink frequency}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK/ubh)}(hThe :ref:`V4L2_CID_LINK_FREQ ` control is used to tell the receiver the frequency of the bus (i.e. it is not the same as the symbol rate).h](hThe }(hj#hhhNhNubh)}(h.:ref:`V4L2_CID_LINK_FREQ `h]j)}(hj-h]hV4L2_CID_LINK_FREQ}(hj/hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj+ubah}(h]h ]h"]h$]h&]refdocj refdomainj9reftyperef refexplicitrefwarnjv4l2-cid-link-frequh1hhhhK1hj#ubhl control is used to tell the receiver the frequency of the bus (i.e. it is not the same as the symbol rate).}(hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK1hjhhubh)}(hDrivers that do not have user-configurable link frequency should report it through the ``.get_mbus_config()`` subdev pad operation, in the ``link_freq`` field of struct v4l2_mbus_config, instead of through controls.h](hWDrivers that do not have user-configurable link frequency should report it through the }(hjUhhhNhNubhliteral)}(h``.get_mbus_config()``h]h.get_mbus_config()}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjUubh subdev pad operation, in the }(hjUhhhNhNubj^)}(h ``link_freq``h]h link_freq}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjUubh? field of struct v4l2_mbus_config, instead of through controls.}(hjUhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK4hjhhubh)}(h}Receiver drivers should use :c:func:`v4l2_get_link_freq` helper to obtain the link frequency from the transmitter sub-device.h](hReceiver drivers should use }(hjhhhNhNubh)}(h:c:func:`v4l2_get_link_freq`h]j^)}(hjh]hv4l2_get_link_freq()}(hjhhhNhNubah}(h]h ](jcc-funceh"]h$]h&]uh1j]hjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjv4l2_get_link_frequh1hhhhK8hjubhE helper to obtain the link frequency from the transmitter sub-device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjhhubeh}(h]link-frequencyah ]h"]link frequencyah$]h&]uh1hhjhhhhhK/ubh)}(hhh](h)}(h:``.enable_streams()`` and ``.disable_streams()`` callbacksh](j^)}(h``.enable_streams()``h]h.enable_streams()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjubh and }(hjhhhNhNubj^)}(h``.disable_streams()``h]h.disable_streams()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjubh callbacks}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhhhhhKenable_streams() and struct v4l2_subdev_pad_ops->disable_streams() callbacks are used by the receiver driver to control the transmitter driver's streaming state. These callbacks may not be called directly, but by using ``v4l2_subdev_enable_streams()`` and ``v4l2_subdev_disable_streams()``.h](hThe struct v4l2_subdev_pad_ops->enable_streams() and struct v4l2_subdev_pad_ops->disable_streams() callbacks are used by the receiver driver to control the transmitter driver’s streaming state. These callbacks may not be called directly, but by using }(hjhhhNhNubj^)}(h ``v4l2_subdev_enable_streams()``h]hv4l2_subdev_enable_streams()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjubh and }(hjhhhNhNubj^)}(h!``v4l2_subdev_disable_streams()``h]hv4l2_subdev_disable_streams()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK>hjhhubeh}(h],enable-streams-and-disable-streams-callbacksah ]h"]2.enable_streams() and .disable_streams() callbacksah$]h&]uh1hhjhhhhhK` control.h]h)}(hThe pixel rate calculated this way is **not** the same thing as the pixel rate on the camera sensor's pixel array which is indicated by the :ref:`V4L2_CID_PIXEL_RATE ` control.h](h&The pixel rate calculated this way is }(hjhhhNhNubhstrong)}(h**not**h]hnot}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubha the same thing as the pixel rate on the camera sensor’s pixel array which is indicated by the }(hjhhhNhNubh)}(h0:ref:`V4L2_CID_PIXEL_RATE `h]j)}(hjh]hV4L2_CID_PIXEL_RATE}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjv4l2-cid-pixel-rateuh1hhhhKnhjubh control.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKnhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h] pixel-rateah ]h"] pixel rateah$]h&]uh1hhjohhhhhKRubh)}(hhh](h)}(hLP-11 and LP-111 statesh]hLP-11 and LP-111 states}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKsubh)}(hXAs part of transitioning to high speed mode, a CSI-2 transmitter typically briefly sets the bus to LP-11 or LP-111 state, depending on the PHY. This period may be as short as 100 µs, during which the receiver observes this state and proceeds its own part of high speed mode transition.h]hXAs part of transitioning to high speed mode, a CSI-2 transmitter typically briefly sets the bus to LP-11 or LP-111 state, depending on the PHY. This period may be as short as 100 µs, during which the receiver observes this state and proceeds its own part of high speed mode transition.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKuhjhhubh)}(hX;Most receivers are capable of autonomously handling this once the software has configured them to do so, but there are receivers which require software involvement in observing LP-11 or LP-111 state. 100 µs is a brief period to hit in software, especially when there is no interrupt telling something is happening.h]hX;Most receivers are capable of autonomously handling this once the software has configured them to do so, but there are receivers which require software involvement in observing LP-11 or LP-111 state. 100 µs is a brief period to hit in software, especially when there is no interrupt telling something is happening.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhjhhubh)}(hX)One way to address this is to configure the transmitter side explicitly to LP-11 or LP-111 state, which requires support from the transmitter hardware. This is not universally available. Many devices return to this state once streaming is stopped while the state after power-on is LP-00 or LP-000.h]hX)One way to address this is to configure the transmitter side explicitly to LP-11 or LP-111 state, which requires support from the transmitter hardware. This is not universally available. Many devices return to this state once streaming is stopped while the state after power-on is LP-00 or LP-000.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX{The ``.pre_streamon()`` callback may be used to prepare a transmitter for transitioning to streaming state, but not yet start streaming. Similarly, the ``.post_streamoff()`` callback is used to undo what was done by the ``.pre_streamon()`` callback. The caller of ``.pre_streamon()`` is thus required to call ``.post_streamoff()`` for each successful call of ``.pre_streamon()``.h](hThe }(hj#hhhNhNubj^)}(h``.pre_streamon()``h]h.pre_streamon()}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1j]hj#ubh callback may be used to prepare a transmitter for transitioning to streaming state, but not yet start streaming. Similarly, the }(hj#hhhNhNubj^)}(h``.post_streamoff()``h]h.post_streamoff()}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j]hj#ubh/ callback is used to undo what was done by the }(hj#hhhNhNubj^)}(h``.pre_streamon()``h]h.pre_streamon()}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hj#ubh callback. The caller of }(hj#hhhNhNubj^)}(h``.pre_streamon()``h]h.pre_streamon()}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1j]hj#ubh is thus required to call }(hj#hhhNhNubj^)}(h``.post_streamoff()``h]h.post_streamoff()}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1j]hj#ubh for each successful call of }(hj#hhhNhNubj^)}(h``.pre_streamon()``h]h.pre_streamon()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hj#ubh.}(hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hIn the context of CSI-2, the ``.pre_streamon()`` callback is used to transition the transmitter to the LP-11 or LP-111 state. This also requires powering on the device, so this should be only done when it is needed.h](hIn the context of CSI-2, the }(hjhhhNhNubj^)}(h``.pre_streamon()``h]h.pre_streamon()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j]hjubh callback is used to transition the transmitter to the LP-11 or LP-111 state. This also requires powering on the device, so this should be only done when it is needed.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hqReceiver drivers that do not need explicit LP-11 or LP-111 state setup are waived from calling the two callbacks.h]hqReceiver drivers that do not need explicit LP-11 or LP-111 state setup are waived from calling the two callbacks.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]lp-11-and-lp-111-statesah ]h"]lp-11 and lp-111 statesah$]h&]uh1hhjohhhhhKsubeh}(h]csi-2-transmitter-driversah ]h"]csi-2 transmitter driversah$]h&]uh1hhhhhhhhKOubeh}(h](+pixel-data-transmitter-and-receiver-driversheh ]h"](+pixel data transmitter and receiver driverstransmitter-receivereh$]h&]uh1hhhhhhhhKexpect_referenced_by_name}jhsexpect_referenced_by_id}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}( mipi alliance]j!abt.656]jlaurefids}h]hasnameids}(jhjjjjjPjMjGjDjjjjjljijj jjj+j(jdjajjjjjju nametypes}(jjjjPjGjjjljjj+jdjjjuh}(hhjhjhjMjjDj>jjSjjjijj jjjj(jjaj.jjojjjjjiju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages]transform_messages]hsystem_message)}(hhh]h)}(hhh]h:Hyperlink target "transmitter-receiver" is not referenced.}hjxsbah}(h]h ]h"]h$]h&]uh1hhjuubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jsuba transformerN include_log] decorationNhhub.