Skip to contentSkip to conversation

media: Documentation: Initialisation finishes before subdev registration

PATCH New Sakari Ailus 1 participant 1 message Nov 2, 2023

Subsystems (2)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

PATCH v2 1/1 media: Documentation: Initialisation finishes before subdev registration

Document that sub-device initialisation needs to complete before the async sub-device is registered as there is no further driver action needed before the sensor becomes accessible via the UAPI.

---
since v1:

- Reword text discussing async sub-device registration and driver's responsibilities before it.

- Add a reference from camera sensor PM documentation to this section, replacing the text added there in v1.

 Documentation/driver-api/media/camera-sensor.rst | 3 ++-
 Documentation/driver-api/media/v4l2-subdev.rst   | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
Documentation/driver-api/media/camera-sensor.rst +2 -1
index 6456145f96ed..7a3c610e4c7b 100644
@@ -60,7 +60,8 @@ management over the pipeline.
 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.
+time. Drivers should enable runtime PM autosuspend. Also see
+:ref:`async sub-device registration <media-registering-async-subdevs>`.
 
 The runtime PM handlers shall handle clocks, regulators, GPIOs, and other
 system resources required to power the sensor up and down. For drivers that
Documentation/driver-api/media/v4l2-subdev.rst +7 -0
index e56b50b3f203..13c664555067 100644
@@ -181,6 +181,8 @@ You can unregister a sub-device using:
 Afterwards the subdev module can be unloaded and
 :c:type:`sd <v4l2_subdev>`->dev == ``NULL``.
 
+.. _media-registering-async-subdevs:
+
 Registering asynchronous sub-devices
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -195,6 +197,11 @@ performed using the :c:func:`v4l2_async_unregister_subdev` call. Subdevices
 registered this way are stored in a global list of subdevices, ready to be
 picked up by bridge drivers.
 
+Drivers must complete all initialization of the sub-device before
+registering it using :c:func:`v4l2_async_register_subdev`, including
+enabling runtime PM. This is because the sub-device becomes accessible
+as soon as it gets registered.
+
 Asynchronous sub-device notifiers
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
Signature · 1 line
2.39.2