€•$‚Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ2/translations/zh_CN/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/zh_TW/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/it_IT/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/ja_JP/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/ko_KR/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/pt_BR/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/sp_SP/driver-api/media/camera-sensor”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒL/var/lib/git/docbuild/linux/Documentation/driver-api/media/camera-sensor.rst”h´KubhŒtarget”“”)”}”(hŒ(.. _media_writing_camera_sensor_drivers:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œ#media-writing-camera-sensor-drivers”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒWriting camera sensor drivers”h]”hŒWriting camera sensor drivers”…””}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒ³This document covers the in-kernel APIs only. For the best practices on userspace API implementation in camera sensor drivers, please see :ref:`media_using_camera_sensor_drivers`.”h]”(hŒŠThis document covers the in-kernel APIs only. For the best practices on userspace API implementation in camera sensor drivers, please see ”…””}”(hhíh²hh³Nh´Nubh)”}”(hŒ(:ref:`media_using_camera_sensor_drivers`”h]”hŒinline”“”)”}”(hh÷h]”hŒ!media_using_camera_sensor_drivers”…””}”(hhûh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-ref”eh"]”h$]”h&]”uh1hùhhõubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œdriver-api/media/camera-sensor”Œ refdomain”jŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆŒ reftarget”Œ!media_using_camera_sensor_drivers”uh1hh³hÇh´KhhíubhŒ.”…””}”(hhíh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubh×)”}”(hhh]”(hÜ)”}”(hŒ CSI-2, parallel and BT.656 buses”h]”hŒ CSI-2, parallel and BT.656 buses”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj$h²hh³hÇh´K ubhì)”}”(hŒ'Please see :ref:`transmitter-receiver`.”h]”(hŒ Please see ”…””}”(hj5h²hh³Nh´Nubh)”}”(hŒ:ref:`transmitter-receiver`”h]”hú)”}”(hj?h]”hŒtransmitter-receiver”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1hùhj=ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jŒ refdomain”jKŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆjŒtransmitter-receiver”uh1hh³hÇh´Khj5ubhŒ.”…””}”(hj5h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khj$h²hubeh}”(h]”Œcsi-2-parallel-and-bt-656-buses”ah ]”h"]”Œ csi-2, parallel and bt.656 buses”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K ubh×)”}”(hhh]”(hÜ)”}”(hŒHandling clocks”h]”hŒHandling clocks”…””}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjoh²hh³hÇh´Kubhì)”}”(hXCamera sensors have an internal clock tree including a PLL and a number of divisors. The clock tree is generally configured by the driver based on a few input parameters that are specific to the hardware: the external clock frequency and the link frequency. The two parameters generally are obtained from system firmware. **No other frequencies should be used in any circumstances.**”h]”(hXBCamera sensors have an internal clock tree including a PLL and a number of divisors. The clock tree is generally configured by the driver based on a few input parameters that are specific to the hardware: the external clock frequency and the link frequency. The two parameters generally are obtained from system firmware. ”…””}”(hj€h²hh³Nh´NubhŒstrong”“”)”}”(hŒ=**No other frequencies should be used in any circumstances.**”h]”hŒ9No other frequencies should be used in any circumstances.”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhj€ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khjoh²hubhì)”}”(hX:The reason why the clock frequencies are so important is that the clock signals come out of the SoC, and in many cases a specific frequency is designed to be used in the system. Using another frequency may cause harmful effects elsewhere. Therefore only the pre-determined frequencies are configurable by the user.”h]”hX:The reason why the clock frequencies are so important is that the clock signals come out of the SoC, and in many cases a specific frequency is designed to be used in the system. Using another frequency may cause harmful effects elsewhere. Therefore only the pre-determined frequencies are configurable by the user.”…””}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khjoh²hubhì)”}”(hXNThe external clock frequency shall be retrieved by obtaining the external clock using the ``devm_v4l2_sensor_clk_get()`` helper function, and then getting its frequency with ``clk_get_rate()``. Usage of the helper function guarantees correct behaviour regardless of whether the sensor is integrated in a DT-based or ACPI-based system.”h]”(hŒZThe external clock frequency shall be retrieved by obtaining the external clock using the ”…””}”(hj¬h²hh³Nh´NubhŒliteral”“”)”}”(hŒ``devm_v4l2_sensor_clk_get()``”h]”hŒdevm_v4l2_sensor_clk_get()”…””}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj¬ubhŒ6 helper function, and then getting its frequency with ”…””}”(hj¬h²hh³Nh´Nubjµ)”}”(hŒ``clk_get_rate()``”h]”hŒclk_get_rate()”…””}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj¬ubhŒŽ. Usage of the helper function guarantees correct behaviour regardless of whether the sensor is integrated in a DT-based or ACPI-based system.”…””}”(hj¬h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K hjoh²hubh×)”}”(hhh]”(hÜ)”}”(hŒACPI”h]”hŒACPI”…””}”(hjãh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjàh²hh³hÇh´K'ubhì)”}”(hXACPI-based systems typically don't register the sensor external clock with the kernel, but specify the external clock frequency in the ``clock-frequency`` _DSD property. The ``devm_v4l2_sensor_clk_get()`` helper creates and returns a fixed clock set at that rate.”h]”(hŒ‰ACPI-based systems typically don’t register the sensor external clock with the kernel, but specify the external clock frequency in the ”…””}”(hjñh²hh³Nh´Nubjµ)”}”(hŒ``clock-frequency``”h]”hŒclock-frequency”…””}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjñubhŒ _DSD property. The ”…””}”(hjñh²hh³Nh´Nubjµ)”}”(hŒ``devm_v4l2_sensor_clk_get()``”h]”hŒdevm_v4l2_sensor_clk_get()”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjñubhŒ; helper creates and returns a fixed clock set at that rate.”…””}”(hjñh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K)hjàh²hubeh}”(h]”Œacpi”ah ]”h"]”Œacpi”ah$]”h&]”uh1hÖhjoh²hh³hÇh´K'ubh×)”}”(hhh]”(hÜ)”}”(hŒ Devicetree”h]”hŒ Devicetree”…””}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj+h²hh³hÇh´K/ubhì)”}”(hXDevicetree-based systems declare the sensor external clock in the device tree and reference it from the sensor node. The preferred way to select the external clock frequency is to use the ``assigned-clocks``, ``assigned-clock-parents`` and ``assigned-clock-rates`` properties in the sensor node to set the clock rate. See the `clock device tree bindings `_ for more information. The ``devm_v4l2_sensor_clk_get()`` helper retrieves and returns that clock.”h]”(hŒ¼Devicetree-based systems declare the sensor external clock in the device tree and reference it from the sensor node. The preferred way to select the external clock frequency is to use the ”…””}”(hj<h²hh³Nh´Nubjµ)”}”(hŒ``assigned-clocks``”h]”hŒassigned-clocks”…””}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj<ubhŒ, ”…””}”(hj<h²hh³Nh´Nubjµ)”}”(hŒ``assigned-clock-parents``”h]”hŒassigned-clock-parents”…””}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj<ubhŒ and ”…””}”(hj<h²hh³Nh´Nubjµ)”}”(hŒ``assigned-clock-rates``”h]”hŒassigned-clock-rates”…””}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj<ubhŒ> properties in the sensor node to set the clock rate. See the ”…””}”(hj<h²hh³Nh´NubhŒ reference”“”)”}”(hŒw`clock device tree bindings `_”h]”hŒclock device tree bindings”…””}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œclock device tree bindings”Œrefuri”ŒWhttps://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/clock/clock.yaml”uh1jzhj<ubhÉ)”}”(hŒZ ”h]”h}”(h]”Œclock-device-tree-bindings”ah ]”h"]”Œclock device tree bindings”ah$]”h&]”Œrefuri”juh1hÈŒ referenced”Khj<ubhŒ for more information. The ”…””}”(hj<h²hh³Nh´Nubjµ)”}”(hŒ``devm_v4l2_sensor_clk_get()``”h]”hŒdevm_v4l2_sensor_clk_get()”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj<ubhŒ) helper retrieves and returns that clock.”…””}”(hj<h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K1hj+h²hubhì)”}”(hXThis approach has the drawback that there's no guarantee that the frequency hasn't been modified directly or indirectly by another driver, or supported by the board's clock tree to begin with. Changes to the Common Clock Framework API are required to ensure reliability.”h]”hXThis approach has the drawback that there’s no guarantee that the frequency hasn’t been modified directly or indirectly by another driver, or supported by the board’s clock tree to begin with. Changes to the Common Clock Framework API are required to ensure reliability.”…””}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K:hj+h²hubeh}”(h]”Œ devicetree”ah ]”h"]”Œ devicetree”ah$]”h&]”uh1hÖhjoh²hh³hÇh´K/ubeh}”(h]”Œhandling-clocks”ah ]”h"]”Œhandling clocks”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒPower management”h]”hŒPower management”…””}”(hjÙh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjÖh²hh³hÇh´K@ubhì)”}”(hŒ²Camera sensors are used in conjunction with other devices to form a camera pipeline. They must obey the rules listed herein to ensure coherent power management over the pipeline.”h]”hŒ²Camera sensors are used in conjunction with other devices to form a camera pipeline. They must obey the rules listed herein to ensure coherent power management over the pipeline.”…””}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KBhjÖh²hubhì)”}”(hXkCamera sensor drivers are responsible for controlling the power state of the device they otherwise control as well. They shall use runtime PM to manage power states. Runtime PM shall be enabled at probe time and disabled at remove time. Drivers should enable runtime PM autosuspend. Also see :ref:`async sub-device registration `.”h]”(hX$Camera sensor drivers are responsible for controlling the power state of the device they otherwise control as well. They shall use runtime PM to manage power states. Runtime PM shall be enabled at probe time and disabled at remove time. Drivers should enable runtime PM autosuspend. Also see ”…””}”(hjõh²hh³Nh´Nubh)”}”(hŒF:ref:`async sub-device registration `”h]”hú)”}”(hjÿh]”hŒasync sub-device registration”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1hùhjýubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jŒ refdomain”j Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒmedia-registering-async-subdevs”uh1hh³hÇh´KFhjõubhŒ.”…””}”(hjõh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KFhjÖh²hubhì)”}”(hXThe runtime PM handlers shall handle clocks, regulators, GPIOs, and other system resources required to power the sensor up and down. For drivers that don't use any of those resources (such as drivers that support ACPI systems only), the runtime PM handlers may be left unimplemented.”h]”hXThe runtime PM handlers shall handle clocks, regulators, GPIOs, and other system resources required to power the sensor up and down. For drivers that don’t use any of those resources (such as drivers that support ACPI systems only), the runtime PM handlers may be left unimplemented.”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KLhjÖh²hubhì)”}”(hX«In general, the device shall be powered on at least when its registers are being accessed and when it is streaming. Drivers should use ``pm_runtime_resume_and_get()`` when starting streaming and ``pm_runtime_put()`` or ``pm_runtime_put_autosuspend()`` when stopping streaming. They may power the device up at probe time (for example to read identification registers), but should not keep it powered unconditionally after probe.”h]”(hŒ‡In general, the device shall be powered on at least when its registers are being accessed and when it is streaming. Drivers should use ”…””}”(hj5h²hh³Nh´Nubjµ)”}”(hŒ``pm_runtime_resume_and_get()``”h]”hŒpm_runtime_resume_and_get()”…””}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj5ubhŒ when starting streaming and ”…””}”(hj5h²hh³Nh´Nubjµ)”}”(hŒ``pm_runtime_put()``”h]”hŒpm_runtime_put()”…””}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj5ubhŒ or ”…””}”(hj5h²hh³Nh´Nubjµ)”}”(hŒ ``pm_runtime_put_autosuspend()``”h]”hŒpm_runtime_put_autosuspend()”…””}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj5ubhŒ° when stopping streaming. They may power the device up at probe time (for example to read identification registers), but should not keep it powered unconditionally after probe.”…””}”(hj5h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KQhjÖh²hubhì)”}”(hXzAt system suspend time, the whole camera pipeline must stop streaming, and restart when the system is resumed. This requires coordination between the camera sensor and the rest of the camera pipeline. Bridge drivers are responsible for this coordination, and instruct camera sensors to stop and restart streaming by calling the appropriate subdev operations (``.enable_streams()`` or ``.disable_streams()``). Camera sensor drivers shall therefore **not** keep track of the streaming state to stop streaming in the PM suspend handler and restart it in the resume handler. Drivers should in general not implement the system PM handlers.”h]”(hXgAt system suspend time, the whole camera pipeline must stop streaming, and restart when the system is resumed. This requires coordination between the camera sensor and the rest of the camera pipeline. Bridge drivers are responsible for this coordination, and instruct camera sensors to stop and restart streaming by calling the appropriate subdev operations (”…””}”(hjyh²hh³Nh´Nubjµ)”}”(hŒ``.enable_streams()``”h]”hŒ.enable_streams()”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjyubhŒ or ”…””}”(hjyh²hh³Nh´Nubjµ)”}”(hŒ``.disable_streams()``”h]”hŒ.disable_streams()”…””}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjyubhŒ)). Camera sensor drivers shall therefore ”…””}”(hjyh²hh³Nh´Nubj‰)”}”(hŒ**not**”h]”hŒnot”…””}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhjyubhŒ´ keep track of the streaming state to stop streaming in the PM suspend handler and restart it in the resume handler. Drivers should in general not implement the system PM handlers.”…””}”(hjyh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KYhjÖh²hubhì)”}”(hX«Camera sensor drivers shall **not** implement the subdev ``.s_power()`` operation, as it is deprecated. While this operation is implemented in some existing drivers as they predate the deprecation, new drivers shall use runtime PM instead. If you feel you need to begin calling ``.s_power()`` from an ISP or a bridge driver, instead add runtime PM support to the sensor driver you are using and drop its ``.s_power()`` handler.”h]”(hŒCamera sensor drivers shall ”…””}”(hj½h²hh³Nh´Nubj‰)”}”(hŒ**not**”h]”hŒnot”…””}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhj½ubhŒ implement the subdev ”…””}”(hj½h²hh³Nh´Nubjµ)”}”(hŒ``.s_power()``”h]”hŒ .s_power()”…””}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj½ubhŒÏ operation, as it is deprecated. While this operation is implemented in some existing drivers as they predate the deprecation, new drivers shall use runtime PM instead. If you feel you need to begin calling ”…””}”(hj½h²hh³Nh´Nubjµ)”}”(hŒ``.s_power()``”h]”hŒ .s_power()”…””}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj½ubhŒp from an ISP or a bridge driver, instead add runtime PM support to the sensor driver you are using and drop its ”…””}”(hj½h²hh³Nh´Nubjµ)”}”(hŒ``.s_power()``”h]”hŒ .s_power()”…””}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj½ubhŒ handler.”…””}”(hj½h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KchjÖh²hubhì)”}”(hŒ?Please also see :ref:`examples `.”h]”(hŒPlease also see ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ.:ref:`examples `”h]”hú)”}”(hjh]”hŒexamples”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1hùhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jŒ refdomain”j)Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒmedia-camera-sensor-examples”uh1hh³hÇh´KjhjubhŒ.”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KjhjÖh²hubh×)”}”(hhh]”(hÜ)”}”(hŒControl framework”h]”hŒControl framework”…””}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjEh²hh³hÇh´Kmubhì)”}”(hX``v4l2_ctrl_handler_setup()`` function may not be used in the device's runtime PM ``runtime_resume`` callback, as it has no way to figure out the power state of the device. This is because the power state of the device is only changed after the power state transition has taken place. The ``s_ctrl`` callback can be used to obtain device's power state after the power state transition:”h]”(jµ)”}”(hŒ``v4l2_ctrl_handler_setup()``”h]”hŒv4l2_ctrl_handler_setup()”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjVubhŒ7 function may not be used in the device’s runtime PM ”…””}”(hjVh²hh³Nh´Nubjµ)”}”(hŒ``runtime_resume``”h]”hŒruntime_resume”…””}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjVubhŒ½ callback, as it has no way to figure out the power state of the device. This is because the power state of the device is only changed after the power state transition has taken place. The ”…””}”(hjVh²hh³Nh´Nubjµ)”}”(hŒ ``s_ctrl``”h]”hŒs_ctrl”…””}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjVubhŒX callback can be used to obtain device’s power state after the power state transition:”…””}”(hjVh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KohjEh²hubhŒindex”“”)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œentries”]”(Œsingle”Œ%pm_runtime_get_if_in_use (C function)”Œc.pm_runtime_get_if_in_use”hNt”auh1j–hjEh²hh³Nh´NubhŒdesc”“”)”}”(hhh]”(hŒdesc_signature”“”)”}”(hŒ1int pm_runtime_get_if_in_use(struct device *dev);”h]”hŒdesc_signature_line”“”)”}”(hŒ1int pm_runtime_get_if_in_use(struct device *dev);”h]”(hŒdesc_sig_keyword_type”“”)”}”(hŒint”h]”hŒint”…””}”(hjºh²hh³Nh´Nubah}”(h]”h ]”Œkt”ah"]”h$]”h&]”uh1j¸hj´h²hh³hÇh´KuubhŒdesc_sig_space”“”)”}”(hŒ ”h]”hŒ ”…””}”(hjËh²hh³Nh´Nubah}”(h]”h ]”Œw”ah"]”h$]”h&]”uh1jÉhj´h²hh³hÇh´KuubhŒ desc_name”“”)”}”(hŒpm_runtime_get_if_in_use”h]”hŒ desc_sig_name”“”)”}”(hŒpm_runtime_get_if_in_use”h]”hŒpm_runtime_get_if_in_use”…””}”(hjâh²hh³Nh´Nubah}”(h]”h ]”Œn”ah"]”h$]”h&]”uh1jàhjÜubah}”(h]”h ]”(Œsig-name”Œdescname”eh"]”h$]”h&]”hÅhÆuh1jÚhj´h²hh³hÇh´KuubhŒdesc_parameterlist”“”)”}”(hŒ(struct device *dev)”h]”hŒdesc_parameter”“”)”}”(hŒstruct device *dev”h]”(hŒdesc_sig_keyword”“”)”}”(hŒstruct”h]”hŒstruct”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”Œk”ah"]”h$]”h&]”uh1jhjubjÊ)”}”(hŒ ”h]”hŒ ”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”jÖah"]”h$]”h&]”uh1jÉhjubh)”}”(hhh]”já)”}”(hŒdevice”h]”hŒdevice”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”jíah"]”h$]”h&]”uh1jàhj$ubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”Œc”Œreftype”Œ identifier”Œ reftarget”j)Œmodname”NŒ classname”NŒ c:parent_key”Œsphinx.domains.c”Œ LookupKey”“”)”}”Œdata”]”jCŒ ASTIdentifier”“”)”}”j>jäsbŒc.pm_runtime_get_if_in_use”†”asbuh1hhjubjÊ)”}”(hŒ ”h]”hŒ ”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”jÖah"]”h$]”h&]”uh1jÉhjubhŒdesc_sig_punctuation”“”)”}”(hŒ*”h]”hŒ*”…””}”(hj`h²hh³Nh´Nubah}”(h]”h ]”Œp”ah"]”h$]”h&]”uh1j^hjubjá)”}”(hŒdev”h]”hŒdev”…””}”(hjoh²hh³Nh´Nubah}”(h]”h ]”jíah"]”h$]”h&]”uh1jàhjubeh}”(h]”h ]”h"]”h$]”h&]”Œnoemph”ˆhÅhÆuh1jÿhjûubah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jùhj´h²hh³hÇh´Kuubj_)”}”(hŒ;”h]”hŒ;”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”jkah"]”h$]”h&]”uh1j^hj´h²hh³hÇh´Kuubeh}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒ add_permalink”ˆuh1j²Œsphinx_line_type”Œ declarator”hj®h²hh³hÇh´Kuubah}”(h]”j¥ah ]”(Œsig”Œ sig-object”eh"]”h$]”h&]”Œ is_multiline”ˆŒ _toc_parts”)Œ _toc_name”huh1j¬h³hÇh´Kuhj©h²hubhŒ desc_content”“”)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj©h²hh³hÇh´Kuubeh}”(h]”h ]”(j<Œfunction”eh"]”h$]”h&]”Œdomain”j<Œobjtype”jºŒdesctype”jºŒnoindex”‰Œ noindexentry”‰Œnocontentsentry”‰uh1j§h²hhjEh³Nh´Nubhì)”}”(hŒ¯The function returns a non-zero value if it succeeded getting the power count or runtime PM was disabled, in either of which cases the driver may proceed to access the device.”h]”hŒ¯The function returns a non-zero value if it succeeded getting the power count or runtime PM was disabled, in either of which cases the driver may proceed to access the device.”…””}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KwhjEh²hubeh}”(h]”Œcontrol-framework”ah ]”h"]”Œcontrol framework”ah$]”h&]”uh1hÖhjÖh²hh³hÇh´Kmubeh}”(h]”Œpower-management”ah ]”h"]”Œpower management”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K@ubh×)”}”(hhh]”(hÜ)”}”(hŒ"Rotation, orientation and flipping”h]”hŒ"Rotation, orientation and flipping”…””}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjâh²hh³hÇh´K|ubhì)”}”(hŒ¶Use ``v4l2_fwnode_device_parse()`` to obtain rotation and orientation information from system firmware and ``v4l2_ctrl_new_fwnode_properties()`` to register the appropriate controls.”h]”(hŒUse ”…””}”(hjóh²hh³Nh´Nubjµ)”}”(hŒ``v4l2_fwnode_device_parse()``”h]”hŒv4l2_fwnode_device_parse()”…””}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjóubhŒI to obtain rotation and orientation information from system firmware and ”…””}”(hjóh²hh³Nh´Nubjµ)”}”(hŒ%``v4l2_ctrl_new_fwnode_properties()``”h]”hŒ!v4l2_ctrl_new_fwnode_properties()”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjóubhŒ& to register the appropriate controls.”…””}”(hjóh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K~hjâh²hubhÉ)”}”(hŒ!.. _media-camera-sensor-examples:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÔŒmedia-camera-sensor-examples”uh1hÈh´K‚hjâh²hh³hÇubeh}”(h]”Œ!rotation-orientation-and-flipping”ah ]”h"]”Œ"rotation, orientation and flipping”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K|ubh×)”}”(hhh]”(hÜ)”}”(hŒExample drivers”h]”hŒExample drivers”…””}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj8h²hh³hÇh´K…ubhì)”}”(hŒçFeatures implemented by sensor drivers vary, and depending on the set of supported features and other qualities, particular sensor drivers better serve the purpose of an example. The following drivers are known to be good examples:”h]”hŒçFeatures implemented by sensor drivers vary, and depending on the set of supported features and other qualities, particular sensor drivers better serve the purpose of an example. The following drivers are known to be good examples:”…””}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K‡hj8h²hubhŒtable”“”)”}”(hhh]”(hÜ)”}”(hŒExample sensor drivers”h]”hŒExample sensor drivers”…””}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÇh´K‹hjYubhŒtgroup”“”)”}”(hhh]”(hŒcolspec”“”)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1johjlubjp)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1johjlubjp)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1johjlubjp)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1johjlubhŒtbody”“”)”}”(hhh]”(hŒrow”“”)”}”(hhh]”(hŒentry”“”)”}”(hhh]”hì)”}”(hŒ Driver name”h]”hŒ Driver name”…””}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khj¥ubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hj ubj¤)”}”(hhh]”hì)”}”(hŒFile(s)”h]”hŒFile(s)”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khj¼ubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hj ubj¤)”}”(hhh]”hì)”}”(hŒ Driver type”h]”hŒ Driver type”…””}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K‘hjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hj ubj¤)”}”(hhh]”hì)”}”(hŒ Example topic”h]”hŒ Example topic”…””}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K’hjêubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jžhj›ubjŸ)”}”(hhh]”(j¤)”}”(hhh]”hì)”}”(hŒCCS”h]”hŒCCS”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K“hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjubj¤)”}”(hhh]”hì)”}”(hŒ``drivers/media/i2c/ccs/``”h]”jµ)”}”(hj&h]”hŒdrivers/media/i2c/ccs/”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj$ubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K”hj!ubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjubj¤)”}”(hhh]”hì)”}”(hŒFreely configurable”h]”hŒFreely configurable”…””}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K•hjAubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjubj¤)”}”(hhh]”hì)”}”(hŒ$Power management (ACPI and DT), UAPI”h]”hŒ$Power management (ACPI and DT), UAPI”…””}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K–hjXubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jžhj›ubjŸ)”}”(hhh]”(j¤)”}”(hhh]”hì)”}”(hŒimx219”h]”hŒimx219”…””}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K—hjxubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjuubj¤)”}”(hhh]”hì)”}”(hŒ``drivers/media/i2c/imx219.c``”h]”jµ)”}”(hj”h]”hŒdrivers/media/i2c/imx219.c”…””}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hj’ubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K˜hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjuubj¤)”}”(hhh]”hì)”}”(hŒRegister list based”h]”hŒRegister list based”…””}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K™hj¯ubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjuubj¤)”}”(hhh]”hì)”}”(hŒ+Power management (DT), UAPI, mode selection”h]”hŒ+Power management (DT), UAPI, mode selection”…””}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KšhjÆubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjuubeh}”(h]”h ]”h"]”h$]”h&]”uh1jžhj›ubjŸ)”}”(hhh]”(j¤)”}”(hhh]”hì)”}”(hŒimx319”h]”hŒimx319”…””}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K›hjæubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjãubj¤)”}”(hhh]”hì)”}”(hŒ``drivers/media/i2c/imx319.c``”h]”jµ)”}”(hjh]”hŒdrivers/media/i2c/imx319.c”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j´hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Kœhjýubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjãubj¤)”}”(hhh]”hì)”}”(hŒRegister list based”h]”hŒRegister list based”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjãubj¤)”}”(hhh]”hì)”}”(hŒPower management (ACPI and DT)”h]”hŒPower management (ACPI and DT)”…””}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Kžhj4ubah}”(h]”h ]”h"]”h$]”h&]”uh1j£hjãubeh}”(h]”h ]”h"]”h$]”h&]”uh1jžhj›ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j™hjlubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jjhjYubeh}”(h]”Œid1”ah ]”h"]”h$]”h&]”uh1jWhj8h²hh³Nh´Nubeh}”(h]”(Œexample-drivers”j/eh ]”h"]”(Œexample drivers”Œmedia-camera-sensor-examples”eh$]”h&]”uh1hÖhhØh²hh³hÇh´K…Œexpect_referenced_by_name”}”jkj%sŒexpect_referenced_by_id”}”j/j%subeh}”(h]”(Œwriting-camera-sensor-drivers”hÕeh ]”h"]”(Œwriting camera sensor drivers”Œ#media_writing_camera_sensor_drivers”eh$]”h&]”uh1hÖhhh²hh³hÇh´Kjn}”jxhÊsjp}”hÕhÊsubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”j£Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŸŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”(hÕ]”hÊaj/]”j%auŒnameids”}”(jxhÕjwjtjljijÓjÐj(j%jËjÈj—j”jßjÜj×jÔj5j2jkj/jjjguŒ nametypes”}”(jxˆjw‰jl‰jÓ‰j(‰jˉj—ˆj߉j׉j5‰jkˆjj‰uh}”(hÕhØjthØjij$jÐjoj%jàjÈj+j”jŽjÜjÖjÔjEj¥j®j2jâj/j8jgj8j`jYuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j­Ks…”R”Œparse_messages”]”Œtransform_messages”]”(hŒsystem_message”“”)”}”(hhh]”hì)”}”(hhh]”hŒIHyperlink target "media-writing-camera-sensor-drivers" is not referenced.”…””}”hj sbah}”(h]”h ]”h"]”h$]”h&]”uh1hëhj ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1j ubj )”}”(hhh]”hì)”}”(hhh]”hŒBHyperlink target "media-camera-sensor-examples" is not referenced.”…””}”hj% sbah}”(h]”h ]”h"]”h$]”h&]”uh1hëhj" ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j Œsource”hÇŒline”K‚uh1j ubeŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.