Lines Matching refs:video
43 static int uvc_v4l2_query_menu(struct uvc_video_device *video, in uvc_v4l2_query_menu() argument
50 ctrl = uvc_find_control(video, query_menu->id, &mapping); in uvc_v4l2_query_menu()
100 static int uvc_v4l2_try_format(struct uvc_video_device *video, in uvc_v4l2_try_format() argument
113 if (fmt->type != video->streaming->type) in uvc_v4l2_try_format()
123 for (i = 0; i < video->streaming->nformats; ++i) { in uvc_v4l2_try_format()
124 format = &video->streaming->format[i]; in uvc_v4l2_try_format()
188 if (video->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) in uvc_v4l2_try_format()
190 video->streaming->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_try_format()
193 if ((ret = uvc_probe_video(video, probe)) < 0) in uvc_v4l2_try_format()
213 static int uvc_v4l2_get_format(struct uvc_video_device *video, in uvc_v4l2_get_format() argument
216 struct uvc_format *format = video->streaming->cur_format; in uvc_v4l2_get_format()
217 struct uvc_frame *frame = video->streaming->cur_frame; in uvc_v4l2_get_format()
219 if (fmt->type != video->streaming->type) in uvc_v4l2_get_format()
230 fmt->fmt.pix.sizeimage = video->streaming->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_get_format()
237 static int uvc_v4l2_set_format(struct uvc_video_device *video, in uvc_v4l2_set_format() argument
245 if (fmt->type != video->streaming->type) in uvc_v4l2_set_format()
248 if (uvc_queue_streaming(&video->queue)) in uvc_v4l2_set_format()
251 ret = uvc_v4l2_try_format(video, fmt, &probe, &format, &frame); in uvc_v4l2_set_format()
255 memcpy(&video->streaming->ctrl, &probe, sizeof probe); in uvc_v4l2_set_format()
256 video->streaming->cur_format = format; in uvc_v4l2_set_format()
257 video->streaming->cur_frame = frame; in uvc_v4l2_set_format()
262 static int uvc_v4l2_get_streamparm(struct uvc_video_device *video, in uvc_v4l2_get_streamparm() argument
267 if (parm->type != video->streaming->type) in uvc_v4l2_get_streamparm()
270 numerator = video->streaming->ctrl.dwFrameInterval; in uvc_v4l2_get_streamparm()
275 parm->type = video->streaming->type; in uvc_v4l2_get_streamparm()
277 if (video->streaming->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in uvc_v4l2_get_streamparm()
294 static int uvc_v4l2_set_streamparm(struct uvc_video_device *video, in uvc_v4l2_set_streamparm() argument
297 struct uvc_frame *frame = video->streaming->cur_frame; in uvc_v4l2_set_streamparm()
303 if (parm->type != video->streaming->type) in uvc_v4l2_set_streamparm()
306 if (uvc_queue_streaming(&video->queue)) in uvc_v4l2_set_streamparm()
314 memcpy(&probe, &video->streaming->ctrl, sizeof probe); in uvc_v4l2_set_streamparm()
323 if ((ret = uvc_probe_video(video, &probe)) < 0) in uvc_v4l2_set_streamparm()
326 memcpy(&video->streaming->ctrl, &probe, sizeof probe); in uvc_v4l2_set_streamparm()
411 struct uvc_video_device *video; in uvc_v4l2_open() local
417 video = video_drvdata(file); in uvc_v4l2_open()
419 if (video->dev->state & UVC_DEV_DISCONNECTED) { in uvc_v4l2_open()
424 ret = usb_autopm_get_interface(video->dev->intf); in uvc_v4l2_open()
431 usb_autopm_put_interface(video->dev->intf); in uvc_v4l2_open()
436 handle->device = video; in uvc_v4l2_open()
440 kref_get(&video->dev->kref); in uvc_v4l2_open()
449 struct uvc_video_device *video = video_drvdata(file); in uvc_v4l2_release() local
456 uvc_video_enable(video, 0); in uvc_v4l2_release()
458 mutex_lock(&video->queue.mutex); in uvc_v4l2_release()
459 if (uvc_free_buffers(&video->queue) < 0) in uvc_v4l2_release()
462 mutex_unlock(&video->queue.mutex); in uvc_v4l2_release()
470 usb_autopm_put_interface(video->dev->intf); in uvc_v4l2_release()
471 kref_put(&video->dev->kref, uvc_delete); in uvc_v4l2_release()
478 struct uvc_video_device *video = video_get_drvdata(vdev); in uvc_v4l2_do_ioctl() local
491 strncpy(cap->bus_info, video->dev->udev->bus->bus_name, in uvc_v4l2_do_ioctl()
494 if (video->streaming->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in uvc_v4l2_do_ioctl()
505 return uvc_query_v4l2_ctrl(video, arg); in uvc_v4l2_do_ioctl()
515 uvc_ctrl_begin(video); in uvc_v4l2_do_ioctl()
516 ret = uvc_ctrl_get(video, &xctrl); in uvc_v4l2_do_ioctl()
517 uvc_ctrl_rollback(video); in uvc_v4l2_do_ioctl()
532 uvc_ctrl_begin(video); in uvc_v4l2_do_ioctl()
533 ret = uvc_ctrl_set(video, &xctrl); in uvc_v4l2_do_ioctl()
535 uvc_ctrl_rollback(video); in uvc_v4l2_do_ioctl()
538 ret = uvc_ctrl_commit(video); in uvc_v4l2_do_ioctl()
543 return uvc_v4l2_query_menu(video, arg); in uvc_v4l2_do_ioctl()
551 uvc_ctrl_begin(video); in uvc_v4l2_do_ioctl()
553 ret = uvc_ctrl_get(video, ctrl); in uvc_v4l2_do_ioctl()
555 uvc_ctrl_rollback(video); in uvc_v4l2_do_ioctl()
561 ret = uvc_ctrl_rollback(video); in uvc_v4l2_do_ioctl()
572 ret = uvc_ctrl_begin(video); in uvc_v4l2_do_ioctl()
577 ret = uvc_ctrl_set(video, ctrl); in uvc_v4l2_do_ioctl()
579 uvc_ctrl_rollback(video); in uvc_v4l2_do_ioctl()
588 ret = uvc_ctrl_commit(video); in uvc_v4l2_do_ioctl()
590 ret = uvc_ctrl_rollback(video); in uvc_v4l2_do_ioctl()
597 const struct uvc_entity *selector = video->selector; in uvc_v4l2_do_ioctl()
604 (video->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { in uvc_v4l2_do_ioctl()
607 iterm = list_first_entry(&video->iterms, in uvc_v4l2_do_ioctl()
612 list_for_each_entry(iterm, video->iterms.next, chain) { in uvc_v4l2_do_ioctl()
633 if (video->selector == NULL || in uvc_v4l2_do_ioctl()
634 (video->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { in uvc_v4l2_do_ioctl()
639 ret = uvc_query_ctrl(video->dev, GET_CUR, video->selector->id, in uvc_v4l2_do_ioctl()
640 video->dev->intfnum, SU_INPUT_SELECT_CONTROL, in uvc_v4l2_do_ioctl()
656 if (video->selector == NULL || in uvc_v4l2_do_ioctl()
657 (video->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { in uvc_v4l2_do_ioctl()
663 if (input > video->selector->selector.bNrInPins) in uvc_v4l2_do_ioctl()
666 return uvc_query_ctrl(video->dev, SET_CUR, video->selector->id, in uvc_v4l2_do_ioctl()
667 video->dev->intfnum, SU_INPUT_SELECT_CONTROL, in uvc_v4l2_do_ioctl()
677 if (fmt->type != video->streaming->type || in uvc_v4l2_do_ioctl()
678 fmt->index >= video->streaming->nformats) in uvc_v4l2_do_ioctl()
681 format = &video->streaming->format[fmt->index]; in uvc_v4l2_do_ioctl()
699 return uvc_v4l2_try_format(video, arg, &probe, NULL, NULL); in uvc_v4l2_do_ioctl()
706 return uvc_v4l2_set_format(video, arg); in uvc_v4l2_do_ioctl()
709 return uvc_v4l2_get_format(video, arg); in uvc_v4l2_do_ioctl()
720 for (i = 0; i < video->streaming->nformats; i++) { in uvc_v4l2_do_ioctl()
721 if (video->streaming->format[i].fcc == in uvc_v4l2_do_ioctl()
723 format = &video->streaming->format[i]; in uvc_v4l2_do_ioctl()
749 for (i = 0; i < video->streaming->nformats; i++) { in uvc_v4l2_do_ioctl()
750 if (video->streaming->format[i].fcc == in uvc_v4l2_do_ioctl()
752 format = &video->streaming->format[i]; in uvc_v4l2_do_ioctl()
802 return uvc_v4l2_get_streamparm(video, arg); in uvc_v4l2_do_ioctl()
808 return uvc_v4l2_set_streamparm(video, arg); in uvc_v4l2_do_ioctl()
814 struct uvc_frame *frame = video->streaming->cur_frame; in uvc_v4l2_do_ioctl()
816 if (ccap->type != video->streaming->type) in uvc_v4l2_do_ioctl()
840 video->streaming->ctrl.dwMaxVideoFrameSize; in uvc_v4l2_do_ioctl()
842 if (rb->type != video->streaming->type || in uvc_v4l2_do_ioctl()
849 ret = uvc_alloc_buffers(&video->queue, rb->count, bufsize); in uvc_v4l2_do_ioctl()
862 if (buf->type != video->streaming->type) in uvc_v4l2_do_ioctl()
868 return uvc_query_buffer(&video->queue, buf); in uvc_v4l2_do_ioctl()
875 return uvc_queue_buffer(&video->queue, arg); in uvc_v4l2_do_ioctl()
881 return uvc_dequeue_buffer(&video->queue, arg, in uvc_v4l2_do_ioctl()
888 if (*type != video->streaming->type) in uvc_v4l2_do_ioctl()
894 if ((ret = uvc_video_enable(video, 1)) < 0) in uvc_v4l2_do_ioctl()
903 if (*type != video->streaming->type) in uvc_v4l2_do_ioctl()
909 return uvc_video_enable(video, 0); in uvc_v4l2_do_ioctl()
983 return uvc_xu_ctrl_query(video, arg, 0); in uvc_v4l2_do_ioctl()
986 return uvc_xu_ctrl_query(video, arg, 1); in uvc_v4l2_do_ioctl()
1040 struct uvc_video_device *video = video_drvdata(file); in uvc_v4l2_mmap() local
1052 mutex_lock(&video->queue.mutex); in uvc_v4l2_mmap()
1054 for (i = 0; i < video->queue.count; ++i) { in uvc_v4l2_mmap()
1055 buffer = &video->queue.buffer[i]; in uvc_v4l2_mmap()
1060 if (i == video->queue.count || size != video->queue.buf_size) { in uvc_v4l2_mmap()
1071 addr = (unsigned long)video->queue.mem + buffer->buf.m.offset; in uvc_v4l2_mmap()
1087 mutex_unlock(&video->queue.mutex); in uvc_v4l2_mmap()
1093 struct uvc_video_device *video = video_drvdata(file); in uvc_v4l2_poll() local
1097 return uvc_queue_poll(&video->queue, file, wait); in uvc_v4l2_poll()