162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * uvc_queue.c -- USB Video Class driver - Buffers management 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2005-2010 662306a36Sopenharmony_ci * Laurent Pinchart (laurent.pinchart@ideasonboard.com) 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/atomic.h> 1062306a36Sopenharmony_ci#include <linux/kernel.h> 1162306a36Sopenharmony_ci#include <linux/mm.h> 1262306a36Sopenharmony_ci#include <linux/list.h> 1362306a36Sopenharmony_ci#include <linux/module.h> 1462306a36Sopenharmony_ci#include <linux/usb.h> 1562306a36Sopenharmony_ci#include <linux/videodev2.h> 1662306a36Sopenharmony_ci#include <linux/vmalloc.h> 1762306a36Sopenharmony_ci#include <linux/wait.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#include <media/v4l2-common.h> 2062306a36Sopenharmony_ci#include <media/videobuf2-dma-sg.h> 2162306a36Sopenharmony_ci#include <media/videobuf2-vmalloc.h> 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#include "uvc.h" 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* ------------------------------------------------------------------------ 2662306a36Sopenharmony_ci * Video buffers queue management. 2762306a36Sopenharmony_ci * 2862306a36Sopenharmony_ci * Video queues is initialized by uvcg_queue_init(). The function performs 2962306a36Sopenharmony_ci * basic initialization of the uvc_video_queue struct and never fails. 3062306a36Sopenharmony_ci * 3162306a36Sopenharmony_ci * Video buffers are managed by videobuf2. The driver uses a mutex to protect 3262306a36Sopenharmony_ci * the videobuf2 queue operations by serializing calls to videobuf2 and a 3362306a36Sopenharmony_ci * spinlock to protect the IRQ queue that holds the buffers to be processed by 3462306a36Sopenharmony_ci * the driver. 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/* ----------------------------------------------------------------------------- 3862306a36Sopenharmony_ci * videobuf2 queue operations 3962306a36Sopenharmony_ci */ 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_cistatic int uvc_queue_setup(struct vb2_queue *vq, 4262306a36Sopenharmony_ci unsigned int *nbuffers, unsigned int *nplanes, 4362306a36Sopenharmony_ci unsigned int sizes[], struct device *alloc_devs[]) 4462306a36Sopenharmony_ci{ 4562306a36Sopenharmony_ci struct uvc_video_queue *queue = vb2_get_drv_priv(vq); 4662306a36Sopenharmony_ci struct uvc_video *video = container_of(queue, struct uvc_video, queue); 4762306a36Sopenharmony_ci unsigned int req_size; 4862306a36Sopenharmony_ci unsigned int nreq; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci if (*nbuffers > UVC_MAX_VIDEO_BUFFERS) 5162306a36Sopenharmony_ci *nbuffers = UVC_MAX_VIDEO_BUFFERS; 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci *nplanes = 1; 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci sizes[0] = video->imagesize; 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci req_size = video->ep->maxpacket 5862306a36Sopenharmony_ci * max_t(unsigned int, video->ep->maxburst, 1) 5962306a36Sopenharmony_ci * (video->ep->mult); 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci /* We divide by two, to increase the chance to run 6262306a36Sopenharmony_ci * into fewer requests for smaller framesizes. 6362306a36Sopenharmony_ci */ 6462306a36Sopenharmony_ci nreq = DIV_ROUND_UP(DIV_ROUND_UP(sizes[0], 2), req_size); 6562306a36Sopenharmony_ci nreq = clamp(nreq, 4U, 64U); 6662306a36Sopenharmony_ci video->uvc_num_requests = nreq; 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci return 0; 6962306a36Sopenharmony_ci} 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_cistatic int uvc_buffer_prepare(struct vb2_buffer *vb) 7262306a36Sopenharmony_ci{ 7362306a36Sopenharmony_ci struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); 7462306a36Sopenharmony_ci struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 7562306a36Sopenharmony_ci struct uvc_buffer *buf = container_of(vbuf, struct uvc_buffer, buf); 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && 7862306a36Sopenharmony_ci vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) { 7962306a36Sopenharmony_ci uvc_trace(UVC_TRACE_CAPTURE, "[E] Bytes used out of bounds.\n"); 8062306a36Sopenharmony_ci return -EINVAL; 8162306a36Sopenharmony_ci } 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci if (unlikely(queue->flags & UVC_QUEUE_DISCONNECTED)) 8462306a36Sopenharmony_ci return -ENODEV; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci buf->state = UVC_BUF_STATE_QUEUED; 8762306a36Sopenharmony_ci if (queue->use_sg) { 8862306a36Sopenharmony_ci buf->sgt = vb2_dma_sg_plane_desc(vb, 0); 8962306a36Sopenharmony_ci buf->sg = buf->sgt->sgl; 9062306a36Sopenharmony_ci } else { 9162306a36Sopenharmony_ci buf->mem = vb2_plane_vaddr(vb, 0); 9262306a36Sopenharmony_ci } 9362306a36Sopenharmony_ci buf->length = vb2_plane_size(vb, 0); 9462306a36Sopenharmony_ci if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) 9562306a36Sopenharmony_ci buf->bytesused = 0; 9662306a36Sopenharmony_ci else 9762306a36Sopenharmony_ci buf->bytesused = vb2_get_plane_payload(vb, 0); 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci return 0; 10062306a36Sopenharmony_ci} 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cistatic void uvc_buffer_queue(struct vb2_buffer *vb) 10362306a36Sopenharmony_ci{ 10462306a36Sopenharmony_ci struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); 10562306a36Sopenharmony_ci struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); 10662306a36Sopenharmony_ci struct uvc_buffer *buf = container_of(vbuf, struct uvc_buffer, buf); 10762306a36Sopenharmony_ci unsigned long flags; 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci spin_lock_irqsave(&queue->irqlock, flags); 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci if (likely(!(queue->flags & UVC_QUEUE_DISCONNECTED))) { 11262306a36Sopenharmony_ci list_add_tail(&buf->queue, &queue->irqqueue); 11362306a36Sopenharmony_ci } else { 11462306a36Sopenharmony_ci /* 11562306a36Sopenharmony_ci * If the device is disconnected return the buffer to userspace 11662306a36Sopenharmony_ci * directly. The next QBUF call will fail with -ENODEV. 11762306a36Sopenharmony_ci */ 11862306a36Sopenharmony_ci buf->state = UVC_BUF_STATE_ERROR; 11962306a36Sopenharmony_ci vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); 12062306a36Sopenharmony_ci } 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci spin_unlock_irqrestore(&queue->irqlock, flags); 12362306a36Sopenharmony_ci} 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_cistatic const struct vb2_ops uvc_queue_qops = { 12662306a36Sopenharmony_ci .queue_setup = uvc_queue_setup, 12762306a36Sopenharmony_ci .buf_prepare = uvc_buffer_prepare, 12862306a36Sopenharmony_ci .buf_queue = uvc_buffer_queue, 12962306a36Sopenharmony_ci .wait_prepare = vb2_ops_wait_prepare, 13062306a36Sopenharmony_ci .wait_finish = vb2_ops_wait_finish, 13162306a36Sopenharmony_ci}; 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ciint uvcg_queue_init(struct uvc_video_queue *queue, struct device *dev, enum v4l2_buf_type type, 13462306a36Sopenharmony_ci struct mutex *lock) 13562306a36Sopenharmony_ci{ 13662306a36Sopenharmony_ci struct uvc_video *video = container_of(queue, struct uvc_video, queue); 13762306a36Sopenharmony_ci struct usb_composite_dev *cdev = video->uvc->func.config->cdev; 13862306a36Sopenharmony_ci int ret; 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci queue->queue.type = type; 14162306a36Sopenharmony_ci queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; 14262306a36Sopenharmony_ci queue->queue.drv_priv = queue; 14362306a36Sopenharmony_ci queue->queue.buf_struct_size = sizeof(struct uvc_buffer); 14462306a36Sopenharmony_ci queue->queue.ops = &uvc_queue_qops; 14562306a36Sopenharmony_ci queue->queue.lock = lock; 14662306a36Sopenharmony_ci if (cdev->gadget->sg_supported) { 14762306a36Sopenharmony_ci queue->queue.mem_ops = &vb2_dma_sg_memops; 14862306a36Sopenharmony_ci queue->use_sg = 1; 14962306a36Sopenharmony_ci } else { 15062306a36Sopenharmony_ci queue->queue.mem_ops = &vb2_vmalloc_memops; 15162306a36Sopenharmony_ci } 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY 15462306a36Sopenharmony_ci | V4L2_BUF_FLAG_TSTAMP_SRC_EOF; 15562306a36Sopenharmony_ci queue->queue.dev = dev; 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci ret = vb2_queue_init(&queue->queue); 15862306a36Sopenharmony_ci if (ret) 15962306a36Sopenharmony_ci return ret; 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci spin_lock_init(&queue->irqlock); 16262306a36Sopenharmony_ci INIT_LIST_HEAD(&queue->irqqueue); 16362306a36Sopenharmony_ci queue->flags = 0; 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci return 0; 16662306a36Sopenharmony_ci} 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* 16962306a36Sopenharmony_ci * Free the video buffers. 17062306a36Sopenharmony_ci */ 17162306a36Sopenharmony_civoid uvcg_free_buffers(struct uvc_video_queue *queue) 17262306a36Sopenharmony_ci{ 17362306a36Sopenharmony_ci vb2_queue_release(&queue->queue); 17462306a36Sopenharmony_ci} 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci/* 17762306a36Sopenharmony_ci * Allocate the video buffers. 17862306a36Sopenharmony_ci */ 17962306a36Sopenharmony_ciint uvcg_alloc_buffers(struct uvc_video_queue *queue, 18062306a36Sopenharmony_ci struct v4l2_requestbuffers *rb) 18162306a36Sopenharmony_ci{ 18262306a36Sopenharmony_ci int ret; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci ret = vb2_reqbufs(&queue->queue, rb); 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci return ret ? ret : rb->count; 18762306a36Sopenharmony_ci} 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ciint uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) 19062306a36Sopenharmony_ci{ 19162306a36Sopenharmony_ci return vb2_querybuf(&queue->queue, buf); 19262306a36Sopenharmony_ci} 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ciint uvcg_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) 19562306a36Sopenharmony_ci{ 19662306a36Sopenharmony_ci return vb2_qbuf(&queue->queue, NULL, buf); 19762306a36Sopenharmony_ci} 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci/* 20062306a36Sopenharmony_ci * Dequeue a video buffer. If nonblocking is false, block until a buffer is 20162306a36Sopenharmony_ci * available. 20262306a36Sopenharmony_ci */ 20362306a36Sopenharmony_ciint uvcg_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf, 20462306a36Sopenharmony_ci int nonblocking) 20562306a36Sopenharmony_ci{ 20662306a36Sopenharmony_ci return vb2_dqbuf(&queue->queue, buf, nonblocking); 20762306a36Sopenharmony_ci} 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci/* 21062306a36Sopenharmony_ci * Poll the video queue. 21162306a36Sopenharmony_ci * 21262306a36Sopenharmony_ci * This function implements video queue polling and is intended to be used by 21362306a36Sopenharmony_ci * the device poll handler. 21462306a36Sopenharmony_ci */ 21562306a36Sopenharmony_ci__poll_t uvcg_queue_poll(struct uvc_video_queue *queue, struct file *file, 21662306a36Sopenharmony_ci poll_table *wait) 21762306a36Sopenharmony_ci{ 21862306a36Sopenharmony_ci return vb2_poll(&queue->queue, file, wait); 21962306a36Sopenharmony_ci} 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ciint uvcg_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) 22262306a36Sopenharmony_ci{ 22362306a36Sopenharmony_ci return vb2_mmap(&queue->queue, vma); 22462306a36Sopenharmony_ci} 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci#ifndef CONFIG_MMU 22762306a36Sopenharmony_ci/* 22862306a36Sopenharmony_ci * Get unmapped area. 22962306a36Sopenharmony_ci * 23062306a36Sopenharmony_ci * NO-MMU arch need this function to make mmap() work correctly. 23162306a36Sopenharmony_ci */ 23262306a36Sopenharmony_ciunsigned long uvcg_queue_get_unmapped_area(struct uvc_video_queue *queue, 23362306a36Sopenharmony_ci unsigned long pgoff) 23462306a36Sopenharmony_ci{ 23562306a36Sopenharmony_ci return vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0); 23662306a36Sopenharmony_ci} 23762306a36Sopenharmony_ci#endif 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci/* 24062306a36Sopenharmony_ci * Cancel the video buffers queue. 24162306a36Sopenharmony_ci * 24262306a36Sopenharmony_ci * Cancelling the queue marks all buffers on the irq queue as erroneous, 24362306a36Sopenharmony_ci * wakes them up and removes them from the queue. 24462306a36Sopenharmony_ci * 24562306a36Sopenharmony_ci * If the disconnect parameter is set, further calls to uvc_queue_buffer will 24662306a36Sopenharmony_ci * fail with -ENODEV. 24762306a36Sopenharmony_ci * 24862306a36Sopenharmony_ci * This function acquires the irq spinlock and can be called from interrupt 24962306a36Sopenharmony_ci * context. 25062306a36Sopenharmony_ci */ 25162306a36Sopenharmony_civoid uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect) 25262306a36Sopenharmony_ci{ 25362306a36Sopenharmony_ci struct uvc_buffer *buf; 25462306a36Sopenharmony_ci unsigned long flags; 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci spin_lock_irqsave(&queue->irqlock, flags); 25762306a36Sopenharmony_ci while (!list_empty(&queue->irqqueue)) { 25862306a36Sopenharmony_ci buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, 25962306a36Sopenharmony_ci queue); 26062306a36Sopenharmony_ci list_del(&buf->queue); 26162306a36Sopenharmony_ci buf->state = UVC_BUF_STATE_ERROR; 26262306a36Sopenharmony_ci vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR); 26362306a36Sopenharmony_ci } 26462306a36Sopenharmony_ci queue->buf_used = 0; 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci /* 26762306a36Sopenharmony_ci * This must be protected by the irqlock spinlock to avoid race 26862306a36Sopenharmony_ci * conditions between uvc_queue_buffer and the disconnection event that 26962306a36Sopenharmony_ci * could result in an interruptible wait in uvc_dequeue_buffer. Do not 27062306a36Sopenharmony_ci * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED 27162306a36Sopenharmony_ci * state outside the queue code. 27262306a36Sopenharmony_ci */ 27362306a36Sopenharmony_ci if (disconnect) 27462306a36Sopenharmony_ci queue->flags |= UVC_QUEUE_DISCONNECTED; 27562306a36Sopenharmony_ci spin_unlock_irqrestore(&queue->irqlock, flags); 27662306a36Sopenharmony_ci} 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ci/* 27962306a36Sopenharmony_ci * Enable or disable the video buffers queue. 28062306a36Sopenharmony_ci * 28162306a36Sopenharmony_ci * The queue must be enabled before starting video acquisition and must be 28262306a36Sopenharmony_ci * disabled after stopping it. This ensures that the video buffers queue 28362306a36Sopenharmony_ci * state can be properly initialized before buffers are accessed from the 28462306a36Sopenharmony_ci * interrupt handler. 28562306a36Sopenharmony_ci * 28662306a36Sopenharmony_ci * Enabling the video queue initializes parameters (such as sequence number, 28762306a36Sopenharmony_ci * sync pattern, ...). If the queue is already enabled, return -EBUSY. 28862306a36Sopenharmony_ci * 28962306a36Sopenharmony_ci * Disabling the video queue cancels the queue and removes all buffers from 29062306a36Sopenharmony_ci * the main queue. 29162306a36Sopenharmony_ci * 29262306a36Sopenharmony_ci * This function can't be called from interrupt context. Use 29362306a36Sopenharmony_ci * uvcg_queue_cancel() instead. 29462306a36Sopenharmony_ci */ 29562306a36Sopenharmony_ciint uvcg_queue_enable(struct uvc_video_queue *queue, int enable) 29662306a36Sopenharmony_ci{ 29762306a36Sopenharmony_ci unsigned long flags; 29862306a36Sopenharmony_ci int ret = 0; 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci if (enable) { 30162306a36Sopenharmony_ci ret = vb2_streamon(&queue->queue, queue->queue.type); 30262306a36Sopenharmony_ci if (ret < 0) 30362306a36Sopenharmony_ci return ret; 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci queue->sequence = 0; 30662306a36Sopenharmony_ci queue->buf_used = 0; 30762306a36Sopenharmony_ci queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; 30862306a36Sopenharmony_ci } else { 30962306a36Sopenharmony_ci ret = vb2_streamoff(&queue->queue, queue->queue.type); 31062306a36Sopenharmony_ci if (ret < 0) 31162306a36Sopenharmony_ci return ret; 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci spin_lock_irqsave(&queue->irqlock, flags); 31462306a36Sopenharmony_ci INIT_LIST_HEAD(&queue->irqqueue); 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci /* 31762306a36Sopenharmony_ci * FIXME: We need to clear the DISCONNECTED flag to ensure that 31862306a36Sopenharmony_ci * applications will be able to queue buffers for the next 31962306a36Sopenharmony_ci * streaming run. However, clearing it here doesn't guarantee 32062306a36Sopenharmony_ci * that the device will be reconnected in the meantime. 32162306a36Sopenharmony_ci */ 32262306a36Sopenharmony_ci queue->flags &= ~UVC_QUEUE_DISCONNECTED; 32362306a36Sopenharmony_ci spin_unlock_irqrestore(&queue->irqlock, flags); 32462306a36Sopenharmony_ci } 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci return ret; 32762306a36Sopenharmony_ci} 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci/* called with &queue_irqlock held.. */ 33062306a36Sopenharmony_civoid uvcg_complete_buffer(struct uvc_video_queue *queue, 33162306a36Sopenharmony_ci struct uvc_buffer *buf) 33262306a36Sopenharmony_ci{ 33362306a36Sopenharmony_ci if (queue->flags & UVC_QUEUE_DROP_INCOMPLETE) { 33462306a36Sopenharmony_ci queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; 33562306a36Sopenharmony_ci buf->state = UVC_BUF_STATE_ERROR; 33662306a36Sopenharmony_ci vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0); 33762306a36Sopenharmony_ci vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR); 33862306a36Sopenharmony_ci return; 33962306a36Sopenharmony_ci } 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_ci buf->buf.field = V4L2_FIELD_NONE; 34262306a36Sopenharmony_ci buf->buf.sequence = queue->sequence++; 34362306a36Sopenharmony_ci buf->buf.vb2_buf.timestamp = ktime_get_ns(); 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused); 34662306a36Sopenharmony_ci vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_DONE); 34762306a36Sopenharmony_ci} 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_cistruct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue) 35062306a36Sopenharmony_ci{ 35162306a36Sopenharmony_ci struct uvc_buffer *buf = NULL; 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci if (!list_empty(&queue->irqqueue)) 35462306a36Sopenharmony_ci buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, 35562306a36Sopenharmony_ci queue); 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci return buf; 35862306a36Sopenharmony_ci} 35962306a36Sopenharmony_ci 360