Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: media: camera-sensor: Mention v4l2_devm_sensor_clk_get() for obtaining the clock

Add the new v4l2 helper devm_v4l2_sensor_clk_get() to Documentation. the
helper works on both DT- and ACPI-based platforms to retrieve a
reference to the clock producer from firmware.

Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Mehdi Djait and committed by
Hans Verkuil
e2b1ebd7 2d240b12

+17 -7
+17 -7
Documentation/driver-api/media/camera-sensor.rst
··· 29 29 elsewhere. Therefore only the pre-determined frequencies are configurable by the 30 30 user. 31 31 32 + The external clock frequency shall be retrieved by obtaining the external clock 33 + using the ``devm_v4l2_sensor_clk_get()`` helper function, and then getting its 34 + frequency with ``clk_get_rate()``. Usage of the helper function guarantees 35 + correct behaviour regardless of whether the sensor is integrated in a DT-based 36 + or ACPI-based system. 37 + 32 38 ACPI 33 39 ~~~~ 34 40 35 - Read the ``clock-frequency`` _DSD property to denote the frequency. The driver 36 - can rely on this frequency being used. 41 + ACPI-based systems typically don't register the sensor external clock with the 42 + kernel, but specify the external clock frequency in the ``clock-frequency`` 43 + _DSD property. The ``devm_v4l2_sensor_clk_get()`` helper creates and returns a 44 + fixed clock set at that rate. 37 45 38 46 Devicetree 39 47 ~~~~~~~~~~ 40 48 41 - The preferred way to achieve this is using ``assigned-clocks``, 42 - ``assigned-clock-parents`` and ``assigned-clock-rates`` properties. See the 43 - `clock device tree bindings 49 + Devicetree-based systems declare the sensor external clock in the device tree 50 + and reference it from the sensor node. The preferred way to select the external 51 + clock frequency is to use the ``assigned-clocks``, ``assigned-clock-parents`` 52 + and ``assigned-clock-rates`` properties in the sensor node to set the clock 53 + rate. See the `clock device tree bindings 44 54 <https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/clock/clock.yaml>`_ 45 - for more information. The driver then gets the frequency using 46 - ``clk_get_rate()``. 55 + for more information. The ``devm_v4l2_sensor_clk_get()`` helper retrieves and 56 + returns that clock. 47 57 48 58 This approach has the drawback that there's no guarantee that the frequency 49 59 hasn't been modified directly or indirectly by another driver, or supported by