diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-08-20 15:26:04 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-08-20 15:26:04 -0400 |
commit | f0b433e9f362e0b7f0ce7d1489dd7feba068605d (patch) | |
tree | d4bfd9489cf4a96a55d83af20919f477a846d585 /include/media/videobuf2-core.h | |
parent | fa2f5bf09610d3c216d4c74855edbe00d636467c (diff) | |
parent | 28c42c28309244d0b15d1b385e33429d59997679 (diff) |
Merge tag 'asoc-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Additional updates for 3.6
A batch more bugfixes, all driver-specific and fairly small and
unremarkable in a global context. The biggest batch are for the newly
added Arizona drivers.
Diffstat (limited to 'include/media/videobuf2-core.h')
-rw-r--r-- | include/media/videobuf2-core.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index a15d1f1b319e..8dd9b6cc296b 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -244,12 +244,23 @@ struct vb2_ops { | |||
244 | void (*buf_queue)(struct vb2_buffer *vb); | 244 | void (*buf_queue)(struct vb2_buffer *vb); |
245 | }; | 245 | }; |
246 | 246 | ||
247 | struct v4l2_fh; | ||
248 | |||
247 | /** | 249 | /** |
248 | * struct vb2_queue - a videobuf queue | 250 | * struct vb2_queue - a videobuf queue |
249 | * | 251 | * |
250 | * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h | 252 | * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h |
251 | * @io_modes: supported io methods (see vb2_io_modes enum) | 253 | * @io_modes: supported io methods (see vb2_io_modes enum) |
252 | * @io_flags: additional io flags (see vb2_fileio_flags enum) | 254 | * @io_flags: additional io flags (see vb2_fileio_flags enum) |
255 | * @lock: pointer to a mutex that protects the vb2_queue struct. The | ||
256 | * driver can set this to a mutex to let the v4l2 core serialize | ||
257 | * the queuing ioctls. If the driver wants to handle locking | ||
258 | * itself, then this should be set to NULL. This lock is not used | ||
259 | * by the videobuf2 core API. | ||
260 | * @owner: The filehandle that 'owns' the buffers, i.e. the filehandle | ||
261 | * that called reqbufs, create_buffers or started fileio. | ||
262 | * This field is not used by the videobuf2 core API, but it allows | ||
263 | * drivers to easily associate an owner filehandle with the queue. | ||
253 | * @ops: driver-specific callbacks | 264 | * @ops: driver-specific callbacks |
254 | * @mem_ops: memory allocator specific callbacks | 265 | * @mem_ops: memory allocator specific callbacks |
255 | * @drv_priv: driver private data | 266 | * @drv_priv: driver private data |
@@ -273,6 +284,8 @@ struct vb2_queue { | |||
273 | enum v4l2_buf_type type; | 284 | enum v4l2_buf_type type; |
274 | unsigned int io_modes; | 285 | unsigned int io_modes; |
275 | unsigned int io_flags; | 286 | unsigned int io_flags; |
287 | struct mutex *lock; | ||
288 | struct v4l2_fh *owner; | ||
276 | 289 | ||
277 | const struct vb2_ops *ops; | 290 | const struct vb2_ops *ops; |
278 | const struct vb2_mem_ops *mem_ops; | 291 | const struct vb2_mem_ops *mem_ops; |
@@ -404,4 +417,45 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no) | |||
404 | return 0; | 417 | return 0; |
405 | } | 418 | } |
406 | 419 | ||
420 | /* | ||
421 | * The following functions are not part of the vb2 core API, but are simple | ||
422 | * helper functions that you can use in your struct v4l2_file_operations, | ||
423 | * struct v4l2_ioctl_ops and struct vb2_ops. They will serialize if vb2_queue->lock | ||
424 | * or video_device->lock is set, and they will set and test vb2_queue->owner | ||
425 | * to check if the calling filehandle is permitted to do the queuing operation. | ||
426 | */ | ||
427 | |||
428 | /* struct v4l2_ioctl_ops helpers */ | ||
429 | |||
430 | int vb2_ioctl_reqbufs(struct file *file, void *priv, | ||
431 | struct v4l2_requestbuffers *p); | ||
432 | int vb2_ioctl_create_bufs(struct file *file, void *priv, | ||
433 | struct v4l2_create_buffers *p); | ||
434 | int vb2_ioctl_prepare_buf(struct file *file, void *priv, | ||
435 | struct v4l2_buffer *p); | ||
436 | int vb2_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *p); | ||
437 | int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p); | ||
438 | int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p); | ||
439 | int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i); | ||
440 | int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i); | ||
441 | |||
442 | /* struct v4l2_file_operations helpers */ | ||
443 | |||
444 | int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma); | ||
445 | int vb2_fop_release(struct file *file); | ||
446 | ssize_t vb2_fop_write(struct file *file, char __user *buf, | ||
447 | size_t count, loff_t *ppos); | ||
448 | ssize_t vb2_fop_read(struct file *file, char __user *buf, | ||
449 | size_t count, loff_t *ppos); | ||
450 | unsigned int vb2_fop_poll(struct file *file, poll_table *wait); | ||
451 | #ifndef CONFIG_MMU | ||
452 | unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr, | ||
453 | unsigned long len, unsigned long pgoff, unsigned long flags); | ||
454 | #endif | ||
455 | |||
456 | /* struct vb2_ops helpers, only use if vq->lock is non-NULL. */ | ||
457 | |||
458 | void vb2_ops_wait_prepare(struct vb2_queue *vq); | ||
459 | void vb2_ops_wait_finish(struct vb2_queue *vq); | ||
460 | |||
407 | #endif /* _MEDIA_VIDEOBUF2_CORE_H */ | 461 | #endif /* _MEDIA_VIDEOBUF2_CORE_H */ |