diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-06-17 01:50:33 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-28 14:00:43 -0400 |
commit | c67f1a300a72a67c1fa71cada8380bbe8412d046 (patch) | |
tree | e7002cd9f0e148f1e09151dd9618a8dc8305cf9f /Documentation/video4linux/v4l2-framework.txt | |
parent | f687f3263e99e34289e076352fad23974ee072ab (diff) |
[media] V4L2: add documentation for V4L2 clock helpers and asynchronous probing
Add documentation for the V4L2 clock and V4L2 asynchronous probing APIs
to v4l2-framework.txt.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation/video4linux/v4l2-framework.txt')
-rw-r--r-- | Documentation/video4linux/v4l2-framework.txt | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index b5e6347b720f..6c4866b49eb5 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -325,8 +325,27 @@ that width, height and the media bus pixel code are equal on both source and | |||
325 | sink of the link. Subdev drivers are also free to use this function to | 325 | sink of the link. Subdev drivers are also free to use this function to |
326 | perform the checks mentioned above in addition to their own checks. | 326 | perform the checks mentioned above in addition to their own checks. |
327 | 327 | ||
328 | A device (bridge) driver needs to register the v4l2_subdev with the | 328 | There are currently two ways to register subdevices with the V4L2 core. The |
329 | v4l2_device: | 329 | first (traditional) possibility is to have subdevices registered by bridge |
330 | drivers. This can be done when the bridge driver has the complete information | ||
331 | about subdevices connected to it and knows exactly when to register them. This | ||
332 | is typically the case for internal subdevices, like video data processing units | ||
333 | within SoCs or complex PCI(e) boards, camera sensors in USB cameras or connected | ||
334 | to SoCs, which pass information about them to bridge drivers, usually in their | ||
335 | platform data. | ||
336 | |||
337 | There are however also situations where subdevices have to be registered | ||
338 | asynchronously to bridge devices. An example of such a configuration is a Device | ||
339 | Tree based system where information about subdevices is made available to the | ||
340 | system independently from the bridge devices, e.g. when subdevices are defined | ||
341 | in DT as I2C device nodes. The API used in this second case is described further | ||
342 | below. | ||
343 | |||
344 | Using one or the other registration method only affects the probing process, the | ||
345 | run-time bridge-subdevice interaction is in both cases the same. | ||
346 | |||
347 | In the synchronous case a device (bridge) driver needs to register the | ||
348 | v4l2_subdev with the v4l2_device: | ||
330 | 349 | ||
331 | int err = v4l2_device_register_subdev(v4l2_dev, sd); | 350 | int err = v4l2_device_register_subdev(v4l2_dev, sd); |
332 | 351 | ||
@@ -393,6 +412,30 @@ controlled through GPIO pins. This distinction is only relevant when setting | |||
393 | up the device, but once the subdev is registered it is completely transparent. | 412 | up the device, but once the subdev is registered it is completely transparent. |
394 | 413 | ||
395 | 414 | ||
415 | In the asynchronous case subdevice probing can be invoked independently of the | ||
416 | bridge driver availability. The subdevice driver then has to verify whether all | ||
417 | the requirements for a successful probing are satisfied. This can include a | ||
418 | check for a master clock availability. If any of the conditions aren't satisfied | ||
419 | the driver might decide to return -EPROBE_DEFER to request further reprobing | ||
420 | attempts. Once all conditions are met the subdevice shall be registered using | ||
421 | the v4l2_async_register_subdev() function. Unregistration is performed using | ||
422 | the v4l2_async_unregister_subdev() call. Subdevices registered this way are | ||
423 | stored in a global list of subdevices, ready to be picked up by bridge drivers. | ||
424 | |||
425 | Bridge drivers in turn have to register a notifier object with an array of | ||
426 | subdevice descriptors that the bridge device needs for its operation. This is | ||
427 | performed using the v4l2_async_notifier_register() call. To unregister the | ||
428 | notifier the driver has to call v4l2_async_notifier_unregister(). The former of | ||
429 | the two functions takes two arguments: a pointer to struct v4l2_device and a | ||
430 | pointer to struct v4l2_async_notifier. The latter contains a pointer to an array | ||
431 | of pointers to subdevice descriptors of type struct v4l2_async_subdev type. The | ||
432 | V4L2 core will then use these descriptors to match asynchronously registered | ||
433 | subdevices to them. If a match is detected the .bound() notifier callback is | ||
434 | called. After all subdevices have been located the .complete() callback is | ||
435 | called. When a subdevice is removed from the system the .unbind() method is | ||
436 | called. All three callbacks are optional. | ||
437 | |||
438 | |||
396 | V4L2 sub-device userspace API | 439 | V4L2 sub-device userspace API |
397 | ----------------------------- | 440 | ----------------------------- |
398 | 441 | ||
@@ -1065,3 +1108,29 @@ available event type is 'class base + 1'. | |||
1065 | 1108 | ||
1066 | An example on how the V4L2 events may be used can be found in the OMAP | 1109 | An example on how the V4L2 events may be used can be found in the OMAP |
1067 | 3 ISP driver (drivers/media/platform/omap3isp). | 1110 | 3 ISP driver (drivers/media/platform/omap3isp). |
1111 | |||
1112 | |||
1113 | V4L2 clocks | ||
1114 | ----------- | ||
1115 | |||
1116 | Many subdevices, like camera sensors, TV decoders and encoders, need a clock | ||
1117 | signal to be supplied by the system. Often this clock is supplied by the | ||
1118 | respective bridge device. The Linux kernel provides a Common Clock Framework for | ||
1119 | this purpose. However, it is not (yet) available on all architectures. Besides, | ||
1120 | the nature of the multi-functional (clock, data + synchronisation, I2C control) | ||
1121 | connection of subdevices to the system might impose special requirements on the | ||
1122 | clock API usage. E.g. V4L2 has to support clock provider driver unregistration | ||
1123 | while a subdevice driver is holding a reference to the clock. For these reasons | ||
1124 | a V4L2 clock helper API has been developed and is provided to bridge and | ||
1125 | subdevice drivers. | ||
1126 | |||
1127 | The API consists of two parts: two functions to register and unregister a V4L2 | ||
1128 | clock source: v4l2_clk_register() and v4l2_clk_unregister() and calls to control | ||
1129 | a clock object, similar to the respective generic clock API calls: | ||
1130 | v4l2_clk_get(), v4l2_clk_put(), v4l2_clk_enable(), v4l2_clk_disable(), | ||
1131 | v4l2_clk_get_rate(), and v4l2_clk_set_rate(). Clock suppliers have to provide | ||
1132 | clock operations that will be called when clock users invoke respective API | ||
1133 | methods. | ||
1134 | |||
1135 | It is expected that once the CCF becomes available on all relevant | ||
1136 | architectures this API will be removed. | ||