Lines Matching refs:stream

158 static int uvc_v4l2_try_format(struct uvc_streaming *stream,  in uvc_v4l2_try_format()  argument
171 if (fmt->type != stream->type) in uvc_v4l2_try_format()
175 uvc_dbg(stream->dev, FORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u\n", in uvc_v4l2_try_format()
183 for (i = 0; i < stream->nformats; ++i) { in uvc_v4l2_try_format()
184 format = &stream->format[i]; in uvc_v4l2_try_format()
189 if (i == stream->nformats) { in uvc_v4l2_try_format()
190 format = stream->def_format; in uvc_v4l2_try_format()
218 uvc_dbg(stream->dev, FORMAT, "Unsupported size %ux%u\n", in uvc_v4l2_try_format()
225 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
248 mutex_lock(&stream->mutex); in uvc_v4l2_try_format()
249 if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) in uvc_v4l2_try_format()
251 stream->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_try_format()
254 ret = uvc_probe_video(stream, probe); in uvc_v4l2_try_format()
255 mutex_unlock(&stream->mutex); in uvc_v4l2_try_format()
264 for (i = 0; i < stream->nformats; ++i) { in uvc_v4l2_try_format()
265 if (probe->bFormatIndex == stream->format[i].index) { in uvc_v4l2_try_format()
266 format = &stream->format[i]; in uvc_v4l2_try_format()
271 if (i == stream->nformats) in uvc_v4l2_try_format()
272 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
284 uvc_dbg(stream->dev, FORMAT, in uvc_v4l2_try_format()
307 static int uvc_v4l2_get_format(struct uvc_streaming *stream, in uvc_v4l2_get_format() argument
314 if (fmt->type != stream->type) in uvc_v4l2_get_format()
317 mutex_lock(&stream->mutex); in uvc_v4l2_get_format()
318 format = stream->cur_format; in uvc_v4l2_get_format()
319 frame = stream->cur_frame; in uvc_v4l2_get_format()
331 fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_get_format()
337 mutex_unlock(&stream->mutex); in uvc_v4l2_get_format()
341 static int uvc_v4l2_set_format(struct uvc_streaming *stream, in uvc_v4l2_set_format() argument
349 if (fmt->type != stream->type) in uvc_v4l2_set_format()
352 ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); in uvc_v4l2_set_format()
356 mutex_lock(&stream->mutex); in uvc_v4l2_set_format()
358 if (uvc_queue_allocated(&stream->queue)) { in uvc_v4l2_set_format()
363 stream->ctrl = probe; in uvc_v4l2_set_format()
364 stream->cur_format = format; in uvc_v4l2_set_format()
365 stream->cur_frame = frame; in uvc_v4l2_set_format()
368 mutex_unlock(&stream->mutex); in uvc_v4l2_set_format()
372 static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, in uvc_v4l2_get_streamparm() argument
377 if (parm->type != stream->type) in uvc_v4l2_get_streamparm()
380 mutex_lock(&stream->mutex); in uvc_v4l2_get_streamparm()
381 numerator = stream->ctrl.dwFrameInterval; in uvc_v4l2_get_streamparm()
382 mutex_unlock(&stream->mutex); in uvc_v4l2_get_streamparm()
388 parm->type = stream->type; in uvc_v4l2_get_streamparm()
390 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in uvc_v4l2_get_streamparm()
407 static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, in uvc_v4l2_set_streamparm() argument
418 if (parm->type != stream->type) in uvc_v4l2_set_streamparm()
428 uvc_dbg(stream->dev, FORMAT, "Setting frame interval to %u/%u (%u)\n", in uvc_v4l2_set_streamparm()
431 mutex_lock(&stream->mutex); in uvc_v4l2_set_streamparm()
433 if (uvc_queue_streaming(&stream->queue)) { in uvc_v4l2_set_streamparm()
434 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
438 format = stream->cur_format; in uvc_v4l2_set_streamparm()
439 frame = stream->cur_frame; in uvc_v4l2_set_streamparm()
440 probe = stream->ctrl; in uvc_v4l2_set_streamparm()
448 if (&format->frame[i] == stream->cur_frame) in uvc_v4l2_set_streamparm()
451 if (format->frame[i].wWidth != stream->cur_frame->wWidth || in uvc_v4l2_set_streamparm()
452 format->frame[i].wHeight != stream->cur_frame->wHeight) in uvc_v4l2_set_streamparm()
467 ret = uvc_probe_video(stream, &probe); in uvc_v4l2_set_streamparm()
469 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
473 stream->ctrl = probe; in uvc_v4l2_set_streamparm()
474 stream->cur_frame = frame; in uvc_v4l2_set_streamparm()
475 mutex_unlock(&stream->mutex); in uvc_v4l2_set_streamparm()
528 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
529 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
540 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
556 struct uvc_streaming *stream; in uvc_v4l2_open() local
560 stream = video_drvdata(file); in uvc_v4l2_open()
561 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_open()
563 ret = usb_autopm_get_interface(stream->dev->intf); in uvc_v4l2_open()
570 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_open()
574 mutex_lock(&stream->dev->lock); in uvc_v4l2_open()
575 if (stream->dev->users == 0) { in uvc_v4l2_open()
576 ret = uvc_status_start(stream->dev, GFP_KERNEL); in uvc_v4l2_open()
578 mutex_unlock(&stream->dev->lock); in uvc_v4l2_open()
579 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_open()
585 stream->dev->users++; in uvc_v4l2_open()
586 mutex_unlock(&stream->dev->lock); in uvc_v4l2_open()
588 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
590 handle->chain = stream->chain; in uvc_v4l2_open()
591 handle->stream = stream; in uvc_v4l2_open()
601 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release() local
603 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_release()
607 uvc_queue_release(&stream->queue); in uvc_v4l2_release()
616 mutex_lock(&stream->dev->lock); in uvc_v4l2_release()
617 if (--stream->dev->users == 0) in uvc_v4l2_release()
618 uvc_status_stop(stream->dev); in uvc_v4l2_release()
619 mutex_unlock(&stream->dev->lock); in uvc_v4l2_release()
621 usb_autopm_put_interface(stream->dev->intf); in uvc_v4l2_release()
630 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap() local
633 strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card)); in uvc_ioctl_querycap()
634 usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); in uvc_ioctl_querycap()
641 static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream, in uvc_ioctl_enum_fmt() argument
648 if (fmt->type != stream->type || fmt->index >= stream->nformats) in uvc_ioctl_enum_fmt()
655 format = &stream->format[fmt->index]; in uvc_ioctl_enum_fmt()
669 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap() local
671 return uvc_ioctl_enum_fmt(stream, fmt); in uvc_ioctl_enum_fmt_vid_cap()
678 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out() local
680 return uvc_ioctl_enum_fmt(stream, fmt); in uvc_ioctl_enum_fmt_vid_out()
687 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap() local
689 return uvc_v4l2_get_format(stream, fmt); in uvc_ioctl_g_fmt_vid_cap()
696 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out() local
698 return uvc_v4l2_get_format(stream, fmt); in uvc_ioctl_g_fmt_vid_out()
705 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap() local
712 return uvc_v4l2_set_format(stream, fmt); in uvc_ioctl_s_fmt_vid_cap()
719 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out() local
726 return uvc_v4l2_set_format(stream, fmt); in uvc_ioctl_s_fmt_vid_out()
733 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap() local
736 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL); in uvc_ioctl_try_fmt_vid_cap()
743 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out() local
746 return uvc_v4l2_try_format(stream, fmt, &probe, NULL, NULL); in uvc_ioctl_try_fmt_vid_out()
753 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs() local
760 mutex_lock(&stream->mutex); in uvc_ioctl_reqbufs()
761 ret = uvc_request_buffers(&stream->queue, rb); in uvc_ioctl_reqbufs()
762 mutex_unlock(&stream->mutex); in uvc_ioctl_reqbufs()
776 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf() local
781 return uvc_query_buffer(&stream->queue, buf); in uvc_ioctl_querybuf()
787 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf() local
792 return uvc_queue_buffer(&stream->queue, in uvc_ioctl_qbuf()
793 stream->vdev.v4l2_dev->mdev, buf); in uvc_ioctl_qbuf()
800 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf() local
805 return uvc_export_buffer(&stream->queue, exp); in uvc_ioctl_expbuf()
811 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf() local
816 return uvc_dequeue_buffer(&stream->queue, buf, in uvc_ioctl_dqbuf()
824 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs() local
831 return uvc_create_buffers(&stream->queue, cb); in uvc_ioctl_create_bufs()
838 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon() local
844 mutex_lock(&stream->mutex); in uvc_ioctl_streamon()
845 ret = uvc_queue_streamon(&stream->queue, type); in uvc_ioctl_streamon()
846 mutex_unlock(&stream->mutex); in uvc_ioctl_streamon()
855 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff() local
860 mutex_lock(&stream->mutex); in uvc_ioctl_streamoff()
861 uvc_queue_streamoff(&stream->queue, type); in uvc_ioctl_streamoff()
862 mutex_unlock(&stream->mutex); in uvc_ioctl_streamoff()
1141 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection() local
1143 if (sel->type != stream->type) in uvc_ioctl_g_selection()
1149 if (stream->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in uvc_ioctl_g_selection()
1154 if (stream->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) in uvc_ioctl_g_selection()
1163 mutex_lock(&stream->mutex); in uvc_ioctl_g_selection()
1164 sel->r.width = stream->cur_frame->wWidth; in uvc_ioctl_g_selection()
1165 sel->r.height = stream->cur_frame->wHeight; in uvc_ioctl_g_selection()
1166 mutex_unlock(&stream->mutex); in uvc_ioctl_g_selection()
1175 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm() local
1177 return uvc_v4l2_get_streamparm(stream, parm); in uvc_ioctl_g_parm()
1184 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm() local
1191 return uvc_v4l2_set_streamparm(stream, parm); in uvc_ioctl_s_parm()
1198 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes() local
1205 for (i = 0; i < stream->nformats; i++) { in uvc_ioctl_enum_framesizes()
1206 if (stream->format[i].fcc == fsize->pixel_format) { in uvc_ioctl_enum_framesizes()
1207 format = &stream->format[i]; in uvc_ioctl_enum_framesizes()
1238 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals() local
1246 for (i = 0; i < stream->nformats; i++) { in uvc_ioctl_enum_frameintervals()
1247 if (stream->format[i].fcc == fival->pixel_format) { in uvc_ioctl_enum_frameintervals()
1248 format = &stream->format[i]; in uvc_ioctl_enum_frameintervals()
1461 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_read() local
1463 uvc_dbg(stream->dev, CALLS, "%s: not implemented\n", __func__); in uvc_v4l2_read()
1470 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap() local
1472 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_mmap()
1474 return uvc_queue_mmap(&stream->queue, vma); in uvc_v4l2_mmap()
1480 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll() local
1482 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_poll()
1484 return uvc_queue_poll(&stream->queue, file, wait); in uvc_v4l2_poll()
1493 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area() local
1495 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); in uvc_v4l2_get_unmapped_area()
1497 return uvc_queue_get_unmapped_area(&stream->queue, pgoff); in uvc_v4l2_get_unmapped_area()