Lines Matching full:stream

211 static int uvc_v4l2_try_format(struct uvc_streaming *stream,  in uvc_v4l2_try_format()  argument
225 if (fmt->type != stream->type) in uvc_v4l2_try_format()
229 uvc_dbg(stream->dev, FORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u\n", in uvc_v4l2_try_format()
238 for (i = 0; i < stream->nformats; ++i) { in uvc_v4l2_try_format()
239 format = &stream->formats[i]; in uvc_v4l2_try_format()
244 if (i == stream->nformats) { in uvc_v4l2_try_format()
245 format = stream->def_format; in uvc_v4l2_try_format()
274 uvc_dbg(stream->dev, FORMAT, "Unsupported size %ux%u\n", in uvc_v4l2_try_format()
281 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
305 mutex_lock(&stream->mutex); in uvc_v4l2_try_format()
306 if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) in uvc_v4l2_try_format()
308 stream->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_try_format()
311 ret = uvc_probe_video(stream, probe); in uvc_v4l2_try_format()
312 mutex_unlock(&stream->mutex); in uvc_v4l2_try_format()
322 for (i = 0; i < stream->nformats; ++i) { in uvc_v4l2_try_format()
323 if (probe->bFormatIndex == stream->formats[i].index) { in uvc_v4l2_try_format()
324 format = &stream->formats[i]; in uvc_v4l2_try_format()
329 if (i == stream->nformats) in uvc_v4l2_try_format()
330 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
342 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
364 static int uvc_v4l2_get_format(struct uvc_streaming *stream, in uvc_v4l2_get_format() argument
371 if (fmt->type != stream->type) in uvc_v4l2_get_format()
374 mutex_lock(&stream->mutex); in uvc_v4l2_get_format()
375 format = stream->cur_format; in uvc_v4l2_get_format()
376 frame = stream->cur_frame; in uvc_v4l2_get_format()
388 fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_get_format()
394 mutex_unlock(&stream->mutex); in uvc_v4l2_get_format()
398 static int uvc_v4l2_set_format(struct uvc_streaming *stream, in uvc_v4l2_set_format() argument
406 if (fmt->type != stream->type) in uvc_v4l2_set_format()
409 ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); in uvc_v4l2_set_format()
413 mutex_lock(&stream->mutex); in uvc_v4l2_set_format()
415 if (uvc_queue_allocated(&stream->queue)) { in uvc_v4l2_set_format()
420 stream->ctrl = probe; in uvc_v4l2_set_format()
421 stream->cur_format = format; in uvc_v4l2_set_format()
422 stream->cur_frame = frame; in uvc_v4l2_set_format()
425 mutex_unlock(&stream->mutex); in uvc_v4l2_set_format()
429 static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, in uvc_v4l2_get_streamparm() argument
434 if (parm->type != stream->type) in uvc_v4l2_get_streamparm()
437 mutex_lock(&stream->mutex); in uvc_v4l2_get_streamparm()
438 numerator = stream->ctrl.dwFrameInterval; in uvc_v4l2_get_streamparm()
439 mutex_unlock(&stream->mutex); in uvc_v4l2_get_streamparm()
445 parm->type = stream->type; in uvc_v4l2_get_streamparm()
447 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in uvc_v4l2_get_streamparm()
464 static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, in uvc_v4l2_set_streamparm() argument
475 if (parm->type != stream->type) in uvc_v4l2_set_streamparm()
485 uvc_dbg(stream->dev, FORMAT, "Setting frame interval to %u/%u (%u)\n", in uvc_v4l2_set_streamparm()
488 mutex_lock(&stream->mutex); in uvc_v4l2_set_streamparm()
490 if (uvc_queue_streaming(&stream->queue)) { in uvc_v4l2_set_streamparm()
491 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
495 format = stream->cur_format; in uvc_v4l2_set_streamparm()
496 frame = stream->cur_frame; in uvc_v4l2_set_streamparm()
497 probe = stream->ctrl; in uvc_v4l2_set_streamparm()
505 if (&format->frames[i] == stream->cur_frame) in uvc_v4l2_set_streamparm()
508 if (format->frames[i].wWidth != stream->cur_frame->wWidth || in uvc_v4l2_set_streamparm()
509 format->frames[i].wHeight != stream->cur_frame->wHeight) in uvc_v4l2_set_streamparm()
524 ret = uvc_probe_video(stream, &probe); in uvc_v4l2_set_streamparm()
526 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
530 stream->ctrl = probe; in uvc_v4l2_set_streamparm()
531 stream->cur_frame = frame; in uvc_v4l2_set_streamparm()
532 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
585 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
586 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
597 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
613 struct uvc_streaming *stream; in uvc_v4l2_open() local
617 stream = video_drvdata(file); in uvc_v4l2_open()
618 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_open()
620 ret = usb_autopm_get_interface(stream->dev->intf); in uvc_v4l2_open()
627 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_open()
631 mutex_lock(&stream->dev->lock); in uvc_v4l2_open()
632 if (stream->dev->users == 0) { in uvc_v4l2_open()
633 ret = uvc_status_start(stream->dev, GFP_KERNEL); in uvc_v4l2_open()
635 mutex_unlock(&stream->dev->lock); in uvc_v4l2_open()
636 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_open()
642 stream->dev->users++; in uvc_v4l2_open()
643 mutex_unlock(&stream->dev->lock); in uvc_v4l2_open()
645 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
647 handle->chain = stream->chain; in uvc_v4l2_open()
648 handle->stream = stream; in uvc_v4l2_open()
658 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release() local
660 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_release()
664 uvc_queue_release(&stream->queue); in uvc_v4l2_release()
673 mutex_lock(&stream->dev->lock); in uvc_v4l2_release()
674 if (--stream->dev->users == 0) in uvc_v4l2_release()
675 uvc_status_stop(stream->dev); in uvc_v4l2_release()
676 mutex_unlock(&stream->dev->lock); in uvc_v4l2_release()
678 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_release()
687 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap() local
690 strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card)); in uvc_ioctl_querycap()
691 usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); in uvc_ioctl_querycap()
698 static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream, in uvc_ioctl_enum_fmt() argument
705 if (fmt->type != stream->type || fmt->index >= stream->nformats) in uvc_ioctl_enum_fmt()
712 format = &stream->formats[fmt->index]; in uvc_ioctl_enum_fmt()
724 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap() local
726 return uvc_ioctl_enum_fmt(stream, fmt); in uvc_ioctl_enum_fmt_vid_cap()
733 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out() local
735 return uvc_ioctl_enum_fmt(stream, fmt); in uvc_ioctl_enum_fmt_vid_out()
742 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap() local
744 return uvc_v4l2_get_format(stream, fmt); in uvc_ioctl_g_fmt_vid_cap()
751 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out() local
753 return uvc_v4l2_get_format(stream, fmt); in uvc_ioctl_g_fmt_vid_out()
760 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap() local
767 return uvc_v4l2_set_format(stream, fmt); in uvc_ioctl_s_fmt_vid_cap()
774 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out() local
781 return uvc_v4l2_set_format(stream, fmt); in uvc_ioctl_s_fmt_vid_out()
788 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap() local
791 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL); in uvc_ioctl_try_fmt_vid_cap()
798 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out() local
801 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL); in uvc_ioctl_try_fmt_vid_out()
808 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs() local
815 mutex_lock(&stream->mutex); in uvc_ioctl_reqbufs()
816 ret = uvc_request_buffers(&stream->queue, rb); in uvc_ioctl_reqbufs()
817 mutex_unlock(&stream->mutex); in uvc_ioctl_reqbufs()
831 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf() local
836 return uvc_query_buffer(&stream->queue, buf); in uvc_ioctl_querybuf()
842 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf() local
847 return uvc_queue_buffer(&stream->queue, in uvc_ioctl_qbuf()
848 stream->vdev.v4l2_dev->mdev, buf); in uvc_ioctl_qbuf()
855 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf() local
860 return uvc_export_buffer(&stream->queue, exp); in uvc_ioctl_expbuf()
866 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf() local
871 return uvc_dequeue_buffer(&stream->queue, buf, in uvc_ioctl_dqbuf()
879 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs() local
886 return uvc_create_buffers(&stream->queue, cb); in uvc_ioctl_create_bufs()
893 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon() local
899 mutex_lock(&stream->mutex); in uvc_ioctl_streamon()
900 ret = uvc_queue_streamon(&stream->queue, type); in uvc_ioctl_streamon()
901 mutex_unlock(&stream->mutex); in uvc_ioctl_streamon()
910 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff() local
915 mutex_lock(&stream->mutex); in uvc_ioctl_streamoff()
916 uvc_queue_streamoff(&stream->queue, type); in uvc_ioctl_streamoff()
917 mutex_unlock(&stream->mutex); in uvc_ioctl_streamoff()
1195 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection() local
1197 if (sel->type != stream->type) in uvc_ioctl_g_selection()
1203 if (stream->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in uvc_ioctl_g_selection()
1208 if (stream->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) in uvc_ioctl_g_selection()
1217 mutex_lock(&stream->mutex); in uvc_ioctl_g_selection()
1218 sel->r.width = stream->cur_frame->wWidth; in uvc_ioctl_g_selection()
1219 sel->r.height = stream->cur_frame->wHeight; in uvc_ioctl_g_selection()
1220 mutex_unlock(&stream->mutex); in uvc_ioctl_g_selection()
1229 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm() local
1231 return uvc_v4l2_get_streamparm(stream, parm); in uvc_ioctl_g_parm()
1238 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm() local
1245 return uvc_v4l2_set_streamparm(stream, parm); in uvc_ioctl_s_parm()
1252 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes() local
1259 for (i = 0; i < stream->nformats; i++) { in uvc_ioctl_enum_framesizes()
1260 if (stream->formats[i].fcc == fsize->pixel_format) { in uvc_ioctl_enum_framesizes()
1261 format = &stream->formats[i]; in uvc_ioctl_enum_framesizes()
1292 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals() local
1300 for (i = 0; i < stream->nformats; i++) { in uvc_ioctl_enum_frameintervals()
1301 if (stream->formats[i].fcc == fival->pixel_format) { in uvc_ioctl_enum_frameintervals()
1302 format = &stream->formats[i]; in uvc_ioctl_enum_frameintervals()
1515 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_read() local
1517 uvc_dbg(stream->dev, CALLS, "%s: not implemented\n", __func__); in uvc_v4l2_read()
1524 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap() local
1526 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_mmap()
1528 return uvc_queue_mmap(&stream->queue, vma); in uvc_v4l2_mmap()
1534 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll() local
1536 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_poll()
1538 return uvc_queue_poll(&stream->queue, file, wait); in uvc_v4l2_poll()
1547 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area() local
1549 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_get_unmapped_area()
1551 return uvc_queue_get_unmapped_area(&stream->queue, pgoff); in uvc_v4l2_get_unmapped_area()