diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index fad3d24c964d..40dc1dd3292b 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2063,8 +2063,12 @@ int vb2_core_queue_init(struct vb2_queue *q) if (q->buf_struct_size == 0) q->buf_struct_size = sizeof(struct vb2_buffer); - q->dma_dir = q->is_output - ? DMA_TO_DEVICE : DMA_FROM_DEVICE; + if (q->is_output) + q->dma_dir = DMA_TO_DEVICE; + else + q->dma_dir = q->use_dma_bidirectional + ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE; + return 0; } EXPORT_SYMBOL_GPL(vb2_core_queue_init); diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index f18ac1fe522b..8c4e172b80ca 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -380,6 +380,9 @@ struct vb2_buf_ops { * @fileio_read_once: report EOF after reading the first buffer * @fileio_write_immediately: queue buffer after each write() call * @allow_zero_bytesused: allow bytesused == 0 to be passed to the driver + * @use_dma_bidirectional: use DMA_BIDIRECTIONAL for CAPTURE buffers; this + * allows HW to read from the CAPTURE buffers in + * addition to writing; ignored for OUTPUT queues * @lock: pointer to a mutex that protects the vb2_queue struct. The * driver can set this to a mutex to let the v4l2 core serialize * the queuing ioctls. If the driver wants to handle locking @@ -443,6 +446,7 @@ struct vb2_queue { unsigned fileio_read_once:1; unsigned fileio_write_immediately:1; unsigned allow_zero_bytesused:1; + unsigned use_dma_bidirectional:1; struct mutex *lock; void *owner;