aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/uvc_queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/function/uvc_queue.c')
-rw-r--r--drivers/usb/gadget/function/uvc_queue.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
index 1c29bc954db9..8ea8b3b227b4 100644
--- a/drivers/usb/gadget/function/uvc_queue.c
+++ b/drivers/usb/gadget/function/uvc_queue.c
@@ -28,7 +28,7 @@
28/* ------------------------------------------------------------------------ 28/* ------------------------------------------------------------------------
29 * Video buffers queue management. 29 * Video buffers queue management.
30 * 30 *
31 * Video queues is initialized by uvc_queue_init(). The function performs 31 * Video queues is initialized by uvcg_queue_init(). The function performs
32 * basic initialization of the uvc_video_queue struct and never fails. 32 * basic initialization of the uvc_video_queue struct and never fails.
33 * 33 *
34 * Video buffers are managed by videobuf2. The driver uses a mutex to protect 34 * Video buffers are managed by videobuf2. The driver uses a mutex to protect
@@ -126,13 +126,12 @@ static struct vb2_ops uvc_queue_qops = {
126 .wait_finish = uvc_wait_finish, 126 .wait_finish = uvc_wait_finish,
127}; 127};
128 128
129static int uvc_queue_init(struct uvc_video_queue *queue, 129int uvcg_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type)
130 enum v4l2_buf_type type)
131{ 130{
132 int ret; 131 int ret;
133 132
134 queue->queue.type = type; 133 queue->queue.type = type;
135 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR; 134 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
136 queue->queue.drv_priv = queue; 135 queue->queue.drv_priv = queue;
137 queue->queue.buf_struct_size = sizeof(struct uvc_buffer); 136 queue->queue.buf_struct_size = sizeof(struct uvc_buffer);
138 queue->queue.ops = &uvc_queue_qops; 137 queue->queue.ops = &uvc_queue_qops;
@@ -154,7 +153,7 @@ static int uvc_queue_init(struct uvc_video_queue *queue,
154/* 153/*
155 * Free the video buffers. 154 * Free the video buffers.
156 */ 155 */
157static void uvc_free_buffers(struct uvc_video_queue *queue) 156void uvcg_free_buffers(struct uvc_video_queue *queue)
158{ 157{
159 mutex_lock(&queue->mutex); 158 mutex_lock(&queue->mutex);
160 vb2_queue_release(&queue->queue); 159 vb2_queue_release(&queue->queue);
@@ -164,8 +163,8 @@ static void uvc_free_buffers(struct uvc_video_queue *queue)
164/* 163/*
165 * Allocate the video buffers. 164 * Allocate the video buffers.
166 */ 165 */
167static int uvc_alloc_buffers(struct uvc_video_queue *queue, 166int uvcg_alloc_buffers(struct uvc_video_queue *queue,
168 struct v4l2_requestbuffers *rb) 167 struct v4l2_requestbuffers *rb)
169{ 168{
170 int ret; 169 int ret;
171 170
@@ -176,8 +175,7 @@ static int uvc_alloc_buffers(struct uvc_video_queue *queue,
176 return ret ? ret : rb->count; 175 return ret ? ret : rb->count;
177} 176}
178 177
179static int uvc_query_buffer(struct uvc_video_queue *queue, 178int uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
180 struct v4l2_buffer *buf)
181{ 179{
182 int ret; 180 int ret;
183 181
@@ -188,8 +186,7 @@ static int uvc_query_buffer(struct uvc_video_queue *queue,
188 return ret; 186 return ret;
189} 187}
190 188
191static int uvc_queue_buffer(struct uvc_video_queue *queue, 189int uvcg_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
192 struct v4l2_buffer *buf)
193{ 190{
194 unsigned long flags; 191 unsigned long flags;
195 int ret; 192 int ret;
@@ -213,8 +210,8 @@ done:
213 * Dequeue a video buffer. If nonblocking is false, block until a buffer is 210 * Dequeue a video buffer. If nonblocking is false, block until a buffer is
214 * available. 211 * available.
215 */ 212 */
216static int uvc_dequeue_buffer(struct uvc_video_queue *queue, 213int uvcg_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf,
217 struct v4l2_buffer *buf, int nonblocking) 214 int nonblocking)
218{ 215{
219 int ret; 216 int ret;
220 217
@@ -231,8 +228,8 @@ static int uvc_dequeue_buffer(struct uvc_video_queue *queue,
231 * This function implements video queue polling and is intended to be used by 228 * This function implements video queue polling and is intended to be used by
232 * the device poll handler. 229 * the device poll handler.
233 */ 230 */
234static unsigned int uvc_queue_poll(struct uvc_video_queue *queue, 231unsigned int uvcg_queue_poll(struct uvc_video_queue *queue, struct file *file,
235 struct file *file, poll_table *wait) 232 poll_table *wait)
236{ 233{
237 unsigned int ret; 234 unsigned int ret;
238 235
@@ -243,8 +240,7 @@ static unsigned int uvc_queue_poll(struct uvc_video_queue *queue,
243 return ret; 240 return ret;
244} 241}
245 242
246static int uvc_queue_mmap(struct uvc_video_queue *queue, 243int uvcg_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma)
247 struct vm_area_struct *vma)
248{ 244{
249 int ret; 245 int ret;
250 246
@@ -261,8 +257,8 @@ static int uvc_queue_mmap(struct uvc_video_queue *queue,
261 * 257 *
262 * NO-MMU arch need this function to make mmap() work correctly. 258 * NO-MMU arch need this function to make mmap() work correctly.
263 */ 259 */
264static unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, 260unsigned long uvcg_queue_get_unmapped_area(struct uvc_video_queue *queue,
265 unsigned long pgoff) 261 unsigned long pgoff)
266{ 262{
267 unsigned long ret; 263 unsigned long ret;
268 264
@@ -285,7 +281,7 @@ static unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
285 * This function acquires the irq spinlock and can be called from interrupt 281 * This function acquires the irq spinlock and can be called from interrupt
286 * context. 282 * context.
287 */ 283 */
288static void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) 284void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect)
289{ 285{
290 struct uvc_buffer *buf; 286 struct uvc_buffer *buf;
291 unsigned long flags; 287 unsigned long flags;
@@ -324,9 +320,9 @@ static void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
324 * the main queue. 320 * the main queue.
325 * 321 *
326 * This function can't be called from interrupt context. Use 322 * This function can't be called from interrupt context. Use
327 * uvc_queue_cancel() instead. 323 * uvcg_queue_cancel() instead.
328 */ 324 */
329static int uvc_queue_enable(struct uvc_video_queue *queue, int enable) 325int uvcg_queue_enable(struct uvc_video_queue *queue, int enable)
330{ 326{
331 unsigned long flags; 327 unsigned long flags;
332 int ret = 0; 328 int ret = 0;
@@ -363,8 +359,8 @@ done:
363} 359}
364 360
365/* called with &queue_irqlock held.. */ 361/* called with &queue_irqlock held.. */
366static struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, 362struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue,
367 struct uvc_buffer *buf) 363 struct uvc_buffer *buf)
368{ 364{
369 struct uvc_buffer *nextbuf; 365 struct uvc_buffer *nextbuf;
370 366
@@ -392,7 +388,7 @@ static struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
392 return nextbuf; 388 return nextbuf;
393} 389}
394 390
395static struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) 391struct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue)
396{ 392{
397 struct uvc_buffer *buf = NULL; 393 struct uvc_buffer *buf = NULL;
398 394