aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/video4linux/v4l2-framework.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 9b1d81c26b7d..a128e012a45c 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -453,6 +453,10 @@ You should also set these fields:
453- ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance 453- ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance
454 (highly recommended to use this and it might become compulsory in the 454 (highly recommended to use this and it might become compulsory in the
455 future!), then set this to your v4l2_ioctl_ops struct. 455 future!), then set this to your v4l2_ioctl_ops struct.
456- lock: leave to NULL if you want to do all the locking in the driver.
457 Otherwise you give it a pointer to a struct mutex_lock and before any
458 of the v4l2_file_operations is called this lock will be taken by the
459 core and released afterwards.
456- parent: you only set this if v4l2_device was registered with NULL as 460- parent: you only set this if v4l2_device was registered with NULL as
457 the parent device struct. This only happens in cases where one hardware 461 the parent device struct. This only happens in cases where one hardware
458 device has multiple PCI devices that all share the same v4l2_device core. 462 device has multiple PCI devices that all share the same v4l2_device core.
@@ -469,6 +473,22 @@ If you use v4l2_ioctl_ops, then you should set either .unlocked_ioctl or
469The v4l2_file_operations struct is a subset of file_operations. The main 473The v4l2_file_operations struct is a subset of file_operations. The main
470difference is that the inode argument is omitted since it is never used. 474difference is that the inode argument is omitted since it is never used.
471 475
476v4l2_file_operations and locking
477--------------------------------
478
479You can set a pointer to a mutex_lock in struct video_device. Usually this
480will be either a top-level mutex or a mutex per device node. If you want
481finer-grained locking then you have to set it to NULL and do you own locking.
482
483If a lock is specified then all file operations will be serialized on that
484lock. If you use videobuf then you must pass the same lock to the videobuf
485queue initialize function: if videobuf has to wait for a frame to arrive, then
486it will temporarily unlock the lock and relock it afterwards. If your driver
487also waits in the code, then you should do the same to allow other processes
488to access the device node while the first process is waiting for something.
489
490The implementation of a hotplug disconnect should also take the lock before
491calling v4l2_device_disconnect and video_unregister_device.
472 492
473video_device registration 493video_device registration
474------------------------- 494-------------------------