Lines Matching full:stream

159 static int uvc_v4l2_try_format(struct uvc_streaming *stream,  in uvc_v4l2_try_format()  argument
172 if (fmt->type != stream->type) in uvc_v4l2_try_format()
176 uvc_dbg(stream->dev, FORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u\n", in uvc_v4l2_try_format()
185 for (i = 0; i < stream->nformats; ++i) { in uvc_v4l2_try_format()
186 format = &stream->format[i]; in uvc_v4l2_try_format()
191 if (i == stream->nformats) { in uvc_v4l2_try_format()
192 format = stream->def_format; in uvc_v4l2_try_format()
221 uvc_dbg(stream->dev, FORMAT, "Unsupported size %ux%u\n", in uvc_v4l2_try_format()
228 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
252 mutex_lock(&stream->mutex); in uvc_v4l2_try_format()
253 if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) in uvc_v4l2_try_format()
255 stream->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_try_format()
258 ret = uvc_probe_video(stream, probe); in uvc_v4l2_try_format()
259 mutex_unlock(&stream->mutex); in uvc_v4l2_try_format()
269 for (i = 0; i < stream->nformats; ++i) { in uvc_v4l2_try_format()
270 if (probe->bFormatIndex == stream->format[i].index) { in uvc_v4l2_try_format()
271 format = &stream->format[i]; in uvc_v4l2_try_format()
276 if (i == stream->nformats) in uvc_v4l2_try_format()
277 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
289 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
311 static int uvc_v4l2_get_format(struct uvc_streaming *stream, in uvc_v4l2_get_format() argument
318 if (fmt->type != stream->type) in uvc_v4l2_get_format()
321 mutex_lock(&stream->mutex); in uvc_v4l2_get_format()
322 format = stream->cur_format; in uvc_v4l2_get_format()
323 frame = stream->cur_frame; in uvc_v4l2_get_format()
335 fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_get_format()
341 mutex_unlock(&stream->mutex); in uvc_v4l2_get_format()
345 static int uvc_v4l2_set_format(struct uvc_streaming *stream, in uvc_v4l2_set_format() argument
353 if (fmt->type != stream->type) in uvc_v4l2_set_format()
356 ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); in uvc_v4l2_set_format()
360 mutex_lock(&stream->mutex); in uvc_v4l2_set_format()
362 if (uvc_queue_allocated(&stream->queue)) { in uvc_v4l2_set_format()
367 stream->ctrl = probe; in uvc_v4l2_set_format()
368 stream->cur_format = format; in uvc_v4l2_set_format()
369 stream->cur_frame = frame; in uvc_v4l2_set_format()
372 mutex_unlock(&stream->mutex); in uvc_v4l2_set_format()
376 static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, in uvc_v4l2_get_streamparm() argument
381 if (parm->type != stream->type) in uvc_v4l2_get_streamparm()
384 mutex_lock(&stream->mutex); in uvc_v4l2_get_streamparm()
385 numerator = stream->ctrl.dwFrameInterval; in uvc_v4l2_get_streamparm()
386 mutex_unlock(&stream->mutex); in uvc_v4l2_get_streamparm()
392 parm->type = stream->type; in uvc_v4l2_get_streamparm()
394 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in uvc_v4l2_get_streamparm()
411 static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, in uvc_v4l2_set_streamparm() argument
422 if (parm->type != stream->type) in uvc_v4l2_set_streamparm()
432 uvc_dbg(stream->dev, FORMAT, "Setting frame interval to %u/%u (%u)\n", in uvc_v4l2_set_streamparm()
435 mutex_lock(&stream->mutex); in uvc_v4l2_set_streamparm()
437 if (uvc_queue_streaming(&stream->queue)) { in uvc_v4l2_set_streamparm()
438 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
442 format = stream->cur_format; in uvc_v4l2_set_streamparm()
443 frame = stream->cur_frame; in uvc_v4l2_set_streamparm()
444 probe = stream->ctrl; in uvc_v4l2_set_streamparm()
452 if (&format->frame[i] == stream->cur_frame) in uvc_v4l2_set_streamparm()
455 if (format->frame[i].wWidth != stream->cur_frame->wWidth || in uvc_v4l2_set_streamparm()
456 format->frame[i].wHeight != stream->cur_frame->wHeight) in uvc_v4l2_set_streamparm()
471 ret = uvc_probe_video(stream, &probe); in uvc_v4l2_set_streamparm()
473 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
477 stream->ctrl = probe; in uvc_v4l2_set_streamparm()
478 stream->cur_frame = frame; in uvc_v4l2_set_streamparm()
479 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
532 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
533 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
544 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
560 struct uvc_streaming *stream; in uvc_v4l2_open() local
564 stream = video_drvdata(file); in uvc_v4l2_open()
565 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_open()
567 ret = usb_autopm_get_interface(stream->dev->intf); in uvc_v4l2_open()
574 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_open()
578 mutex_lock(&stream->dev->lock); in uvc_v4l2_open()
579 if (stream->dev->users == 0) { in uvc_v4l2_open()
580 ret = uvc_status_start(stream->dev, GFP_KERNEL); in uvc_v4l2_open()
582 mutex_unlock(&stream->dev->lock); in uvc_v4l2_open()
583 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_open()
589 stream->dev->users++; in uvc_v4l2_open()
590 mutex_unlock(&stream->dev->lock); in uvc_v4l2_open()
592 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
594 handle->chain = stream->chain; in uvc_v4l2_open()
595 handle->stream = stream; in uvc_v4l2_open()
605 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release() local
607 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_release()
611 uvc_queue_release(&stream->queue); in uvc_v4l2_release()
620 mutex_lock(&stream->dev->lock); in uvc_v4l2_release()
621 if (--stream->dev->users == 0) in uvc_v4l2_release()
622 uvc_status_stop(stream->dev); in uvc_v4l2_release()
623 mutex_unlock(&stream->dev->lock); in uvc_v4l2_release()
625 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_release()
634 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap() local
637 strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card)); in uvc_ioctl_querycap()
638 usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); in uvc_ioctl_querycap()
645 static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream, in uvc_ioctl_enum_fmt() argument
652 if (fmt->type != stream->type || fmt->index >= stream->nformats) in uvc_ioctl_enum_fmt()
659 format = &stream->format[fmt->index]; in uvc_ioctl_enum_fmt()
673 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap() local
675 return uvc_ioctl_enum_fmt(stream, fmt); in uvc_ioctl_enum_fmt_vid_cap()
682 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out() local
684 return uvc_ioctl_enum_fmt(stream, fmt); in uvc_ioctl_enum_fmt_vid_out()
691 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap() local
693 return uvc_v4l2_get_format(stream, fmt); in uvc_ioctl_g_fmt_vid_cap()
700 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out() local
702 return uvc_v4l2_get_format(stream, fmt); in uvc_ioctl_g_fmt_vid_out()
709 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap() local
716 return uvc_v4l2_set_format(stream, fmt); in uvc_ioctl_s_fmt_vid_cap()
723 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out() local
730 return uvc_v4l2_set_format(stream, fmt); in uvc_ioctl_s_fmt_vid_out()
737 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap() local
740 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL); in uvc_ioctl_try_fmt_vid_cap()
747 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out() local
750 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL); in uvc_ioctl_try_fmt_vid_out()
757 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs() local
764 mutex_lock(&stream->mutex); in uvc_ioctl_reqbufs()
765 ret = uvc_request_buffers(&stream->queue, rb); in uvc_ioctl_reqbufs()
766 mutex_unlock(&stream->mutex); in uvc_ioctl_reqbufs()
780 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf() local
785 return uvc_query_buffer(&stream->queue, buf); in uvc_ioctl_querybuf()
791 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf() local
796 return uvc_queue_buffer(&stream->queue, in uvc_ioctl_qbuf()
797 stream->vdev.v4l2_dev->mdev, buf); in uvc_ioctl_qbuf()
804 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf() local
809 return uvc_export_buffer(&stream->queue, exp); in uvc_ioctl_expbuf()
815 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf() local
820 return uvc_dequeue_buffer(&stream->queue, buf, in uvc_ioctl_dqbuf()
828 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs() local
835 return uvc_create_buffers(&stream->queue, cb); in uvc_ioctl_create_bufs()
842 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon() local
848 mutex_lock(&stream->mutex); in uvc_ioctl_streamon()
849 ret = uvc_queue_streamon(&stream->queue, type); in uvc_ioctl_streamon()
850 mutex_unlock(&stream->mutex); in uvc_ioctl_streamon()
859 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff() local
864 mutex_lock(&stream->mutex); in uvc_ioctl_streamoff()
865 uvc_queue_streamoff(&stream->queue, type); in uvc_ioctl_streamoff()
866 mutex_unlock(&stream->mutex); in uvc_ioctl_streamoff()
1145 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection() local
1147 if (sel->type != stream->type) in uvc_ioctl_g_selection()
1153 if (stream->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in uvc_ioctl_g_selection()
1158 if (stream->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) in uvc_ioctl_g_selection()
1167 mutex_lock(&stream->mutex); in uvc_ioctl_g_selection()
1168 sel->r.width = stream->cur_frame->wWidth; in uvc_ioctl_g_selection()
1169 sel->r.height = stream->cur_frame->wHeight; in uvc_ioctl_g_selection()
1170 mutex_unlock(&stream->mutex); in uvc_ioctl_g_selection()
1179 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm() local
1181 return uvc_v4l2_get_streamparm(stream, parm); in uvc_ioctl_g_parm()
1188 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm() local
1195 return uvc_v4l2_set_streamparm(stream, parm); in uvc_ioctl_s_parm()
1202 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes() local
1209 for (i = 0; i < stream->nformats; i++) { in uvc_ioctl_enum_framesizes()
1210 if (stream->format[i].fcc == fsize->pixel_format) { in uvc_ioctl_enum_framesizes()
1211 format = &stream->format[i]; in uvc_ioctl_enum_framesizes()
1242 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals() local
1250 for (i = 0; i < stream->nformats; i++) { in uvc_ioctl_enum_frameintervals()
1251 if (stream->format[i].fcc == fival->pixel_format) { in uvc_ioctl_enum_frameintervals()
1252 format = &stream->format[i]; in uvc_ioctl_enum_frameintervals()
1465 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_read() local
1467 uvc_dbg(stream->dev, CALLS, "%s: not implemented\n", __func__); in uvc_v4l2_read()
1474 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap() local
1476 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_mmap()
1478 return uvc_queue_mmap(&stream->queue, vma); in uvc_v4l2_mmap()
1484 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll() local
1486 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_poll()
1488 return uvc_queue_poll(&stream->queue, file, wait); in uvc_v4l2_poll()
1497 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area() local
1499 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_get_unmapped_area()
1501 return uvc_queue_get_unmapped_area(&stream->queue, pgoff); in uvc_v4l2_get_unmapped_area()