Lines Matching full:dev

86 	struct vivid_dev *dev = vb2_get_drv_priv(vq);  in vid_cap_queue_setup()  local
87 unsigned buffers = tpg_g_buffers(&dev->tpg); in vid_cap_queue_setup()
88 unsigned h = dev->fmt_cap_rect.height; in vid_cap_queue_setup()
91 if (dev->field_cap == V4L2_FIELD_ALTERNATE) { in vid_cap_queue_setup()
100 if (dev->queue_setup_error) { in vid_cap_queue_setup()
105 dev->queue_setup_error = false; in vid_cap_queue_setup()
116 if (sizes[p] < tpg_g_line_width(&dev->tpg, p) * h + in vid_cap_queue_setup()
117 dev->fmt_cap->data_offset[p]) in vid_cap_queue_setup()
122 sizes[p] = (tpg_g_line_width(&dev->tpg, p) * h) / in vid_cap_queue_setup()
123 dev->fmt_cap->vdownsampling[p] + in vid_cap_queue_setup()
124 dev->fmt_cap->data_offset[p]; in vid_cap_queue_setup()
132 dprintk(dev, 1, "%s: count=%d\n", __func__, *nbuffers); in vid_cap_queue_setup()
134 dprintk(dev, 1, "%s: size[%u]=%u\n", __func__, p, sizes[p]); in vid_cap_queue_setup()
141 struct vivid_dev *dev = vb2_get_drv_priv(vb->vb2_queue); in vid_cap_buf_prepare() local
143 unsigned buffers = tpg_g_buffers(&dev->tpg); in vid_cap_buf_prepare()
146 dprintk(dev, 1, "%s\n", __func__); in vid_cap_buf_prepare()
148 if (WARN_ON(NULL == dev->fmt_cap)) in vid_cap_buf_prepare()
151 if (dev->buf_prepare_error) { in vid_cap_buf_prepare()
156 dev->buf_prepare_error = false; in vid_cap_buf_prepare()
160 size = (tpg_g_line_width(&dev->tpg, p) * in vid_cap_buf_prepare()
161 dev->fmt_cap_rect.height) / in vid_cap_buf_prepare()
162 dev->fmt_cap->vdownsampling[p] + in vid_cap_buf_prepare()
163 dev->fmt_cap->data_offset[p]; in vid_cap_buf_prepare()
166 dprintk(dev, 1, "%s data will not fit into plane %u (%lu < %lu)\n", in vid_cap_buf_prepare()
172 vb->planes[p].data_offset = dev->fmt_cap->data_offset[p]; in vid_cap_buf_prepare()
181 struct vivid_dev *dev = vb2_get_drv_priv(vb->vb2_queue); in vid_cap_buf_finish() local
186 if (!vivid_is_sdtv_cap(dev)) in vid_cap_buf_finish()
194 if (dev->std_cap[dev->input] & V4L2_STD_525_60) in vid_cap_buf_finish()
207 struct vivid_dev *dev = vb2_get_drv_priv(vb->vb2_queue); in vid_cap_buf_queue() local
210 dprintk(dev, 1, "%s\n", __func__); in vid_cap_buf_queue()
212 spin_lock(&dev->slock); in vid_cap_buf_queue()
213 list_add_tail(&buf->list, &dev->vid_cap_active); in vid_cap_buf_queue()
214 spin_unlock(&dev->slock); in vid_cap_buf_queue()
219 struct vivid_dev *dev = vb2_get_drv_priv(vq); in vid_cap_start_streaming() local
223 if (vb2_is_streaming(&dev->vb_vid_out_q)) in vid_cap_start_streaming()
224 dev->can_loop_video = vivid_vid_can_loop(dev); in vid_cap_start_streaming()
226 dev->vid_cap_seq_count = 0; in vid_cap_start_streaming()
227 dprintk(dev, 1, "%s\n", __func__); in vid_cap_start_streaming()
229 dev->must_blank[i] = tpg_g_perc_fill(&dev->tpg) < 100; in vid_cap_start_streaming()
230 if (dev->start_streaming_error) { in vid_cap_start_streaming()
231 dev->start_streaming_error = false; in vid_cap_start_streaming()
234 err = vivid_start_generating_vid_cap(dev, &dev->vid_cap_streaming); in vid_cap_start_streaming()
239 list_for_each_entry_safe(buf, tmp, &dev->vid_cap_active, list) { in vid_cap_start_streaming()
251 struct vivid_dev *dev = vb2_get_drv_priv(vq); in vid_cap_stop_streaming() local
253 dprintk(dev, 1, "%s\n", __func__); in vid_cap_stop_streaming()
254 vivid_stop_generating_vid_cap(dev, &dev->vid_cap_streaming); in vid_cap_stop_streaming()
255 dev->can_loop_video = false; in vid_cap_stop_streaming()
260 struct vivid_dev *dev = vb2_get_drv_priv(vb->vb2_queue); in vid_cap_buf_request_complete() local
262 v4l2_ctrl_request_complete(vb->req_obj.req, &dev->ctrl_hdl_vid_cap); in vid_cap_buf_request_complete()
282 void vivid_update_quality(struct vivid_dev *dev) in vivid_update_quality() argument
286 if (dev->loop_video && (vivid_is_svid_cap(dev) || vivid_is_hdmi_cap(dev))) { in vivid_update_quality()
291 tpg_s_quality(&dev->tpg, TPG_QUAL_NOISE, 0); in vivid_update_quality()
294 if (vivid_is_hdmi_cap(dev) && in vivid_update_quality()
295 VIVID_INVALID_SIGNAL(dev->dv_timings_signal_mode[dev->input])) { in vivid_update_quality()
296 tpg_s_quality(&dev->tpg, TPG_QUAL_NOISE, 0); in vivid_update_quality()
299 if (vivid_is_sdtv_cap(dev) && in vivid_update_quality()
300 VIVID_INVALID_SIGNAL(dev->std_signal_mode[dev->input])) { in vivid_update_quality()
301 tpg_s_quality(&dev->tpg, TPG_QUAL_NOISE, 0); in vivid_update_quality()
304 if (!vivid_is_tv_cap(dev)) { in vivid_update_quality()
305 tpg_s_quality(&dev->tpg, TPG_QUAL_COLOR, 0); in vivid_update_quality()
315 freq_modulus = (dev->tv_freq - 676 /* (43.25-1) * 16 */) % (6 * 16); in vivid_update_quality()
317 tpg_s_quality(&dev->tpg, TPG_QUAL_NOISE, in vivid_update_quality()
318 next_pseudo_random32(dev->tv_freq ^ 0x55) & 0x3f); in vivid_update_quality()
322 tpg_s_quality(&dev->tpg, TPG_QUAL_GRAY, 0); in vivid_update_quality()
324 tpg_s_quality(&dev->tpg, TPG_QUAL_COLOR, 0); in vivid_update_quality()
330 static enum tpg_quality vivid_get_quality(struct vivid_dev *dev, s32 *afc) in vivid_get_quality() argument
336 if (tpg_g_quality(&dev->tpg) == TPG_QUAL_COLOR || in vivid_get_quality()
337 tpg_g_quality(&dev->tpg) == TPG_QUAL_NOISE) in vivid_get_quality()
338 return tpg_g_quality(&dev->tpg); in vivid_get_quality()
346 freq_modulus = (dev->tv_freq - 676 /* (43.25-1) * 16 */) % (6 * 16); in vivid_get_quality()
352 enum tpg_video_aspect vivid_get_video_aspect(const struct vivid_dev *dev) in vivid_get_video_aspect() argument
354 if (vivid_is_sdtv_cap(dev)) in vivid_get_video_aspect()
355 return dev->std_aspect_ratio[dev->input]; in vivid_get_video_aspect()
357 if (vivid_is_hdmi_cap(dev)) in vivid_get_video_aspect()
358 return dev->dv_timings_aspect_ratio[dev->input]; in vivid_get_video_aspect()
363 static enum tpg_pixel_aspect vivid_get_pixel_aspect(const struct vivid_dev *dev) in vivid_get_pixel_aspect() argument
365 if (vivid_is_sdtv_cap(dev)) in vivid_get_pixel_aspect()
366 return (dev->std_cap[dev->input] & V4L2_STD_525_60) ? in vivid_get_pixel_aspect()
369 if (vivid_is_hdmi_cap(dev) && in vivid_get_pixel_aspect()
370 dev->src_rect.width == 720 && dev->src_rect.height <= 576) in vivid_get_pixel_aspect()
371 return dev->src_rect.height == 480 ? in vivid_get_pixel_aspect()
381 void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls) in vivid_update_format_cap() argument
383 struct v4l2_bt_timings *bt = &dev->dv_timings_cap[dev->input].bt; in vivid_update_format_cap()
388 switch (dev->input_type[dev->input]) { in vivid_update_format_cap()
391 dev->src_rect.width = webcam_sizes[dev->webcam_size_idx].width; in vivid_update_format_cap()
392 dev->src_rect.height = webcam_sizes[dev->webcam_size_idx].height; in vivid_update_format_cap()
393 dev->timeperframe_vid_cap = webcam_intervals[dev->webcam_ival_idx]; in vivid_update_format_cap()
394 dev->field_cap = V4L2_FIELD_NONE; in vivid_update_format_cap()
395 tpg_s_rgb_range(&dev->tpg, V4L2_DV_RGB_RANGE_AUTO); in vivid_update_format_cap()
399 dev->field_cap = dev->tv_field_cap; in vivid_update_format_cap()
400 dev->src_rect.width = 720; in vivid_update_format_cap()
401 if (dev->std_cap[dev->input] & V4L2_STD_525_60) { in vivid_update_format_cap()
402 dev->src_rect.height = 480; in vivid_update_format_cap()
403 dev->timeperframe_vid_cap = (struct v4l2_fract) { 1001, 30000 }; in vivid_update_format_cap()
404 dev->service_set_cap = V4L2_SLICED_CAPTION_525; in vivid_update_format_cap()
406 dev->src_rect.height = 576; in vivid_update_format_cap()
407 dev->timeperframe_vid_cap = (struct v4l2_fract) { 1000, 25000 }; in vivid_update_format_cap()
408 dev->service_set_cap = V4L2_SLICED_WSS_625 | V4L2_SLICED_TELETEXT_B; in vivid_update_format_cap()
410 tpg_s_rgb_range(&dev->tpg, V4L2_DV_RGB_RANGE_AUTO); in vivid_update_format_cap()
413 dev->src_rect.width = bt->width; in vivid_update_format_cap()
414 dev->src_rect.height = bt->height; in vivid_update_format_cap()
416 if (dev->reduced_fps && can_reduce_fps(bt)) { in vivid_update_format_cap()
423 dev->timeperframe_vid_cap = (struct v4l2_fract) { in vivid_update_format_cap()
427 dev->field_cap = V4L2_FIELD_ALTERNATE; in vivid_update_format_cap()
429 dev->field_cap = V4L2_FIELD_NONE; in vivid_update_format_cap()
435 if (keep_controls || !dev->colorspace) in vivid_update_format_cap()
439 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_170M); in vivid_update_format_cap()
441 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_709); in vivid_update_format_cap()
442 v4l2_ctrl_s_ctrl(dev->real_rgb_range_cap, 1); in vivid_update_format_cap()
444 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_SRGB); in vivid_update_format_cap()
445 v4l2_ctrl_s_ctrl(dev->real_rgb_range_cap, 0); in vivid_update_format_cap()
447 tpg_s_rgb_range(&dev->tpg, v4l2_ctrl_g_ctrl(dev->rgb_range_cap)); in vivid_update_format_cap()
450 vfree(dev->bitmap_cap); in vivid_update_format_cap()
451 dev->bitmap_cap = NULL; in vivid_update_format_cap()
452 vivid_update_quality(dev); in vivid_update_format_cap()
453 tpg_reset_source(&dev->tpg, dev->src_rect.width, dev->src_rect.height, dev->field_cap); in vivid_update_format_cap()
454 dev->crop_cap = dev->src_rect; in vivid_update_format_cap()
455 dev->crop_bounds_cap = dev->src_rect; in vivid_update_format_cap()
456 if (dev->bitmap_cap && in vivid_update_format_cap()
457 (dev->compose_cap.width != dev->crop_cap.width || in vivid_update_format_cap()
458 dev->compose_cap.height != dev->crop_cap.height)) { in vivid_update_format_cap()
459 vfree(dev->bitmap_cap); in vivid_update_format_cap()
460 dev->bitmap_cap = NULL; in vivid_update_format_cap()
462 dev->compose_cap = dev->crop_cap; in vivid_update_format_cap()
463 if (V4L2_FIELD_HAS_T_OR_B(dev->field_cap)) in vivid_update_format_cap()
464 dev->compose_cap.height /= 2; in vivid_update_format_cap()
465 dev->fmt_cap_rect = dev->compose_cap; in vivid_update_format_cap()
466 tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev)); in vivid_update_format_cap()
467 tpg_s_pixel_aspect(&dev->tpg, vivid_get_pixel_aspect(dev)); in vivid_update_format_cap()
468 tpg_update_mv_step(&dev->tpg); in vivid_update_format_cap()
477 dims[0] = roundup(dev->src_rect.width, PIXEL_ARRAY_DIV); in vivid_update_format_cap()
478 dims[1] = roundup(dev->src_rect.height, PIXEL_ARRAY_DIV); in vivid_update_format_cap()
479 v4l2_ctrl_modify_dimensions(dev->pixel_array, dims); in vivid_update_format_cap()
483 static enum v4l2_field vivid_field_cap(struct vivid_dev *dev, enum v4l2_field field) in vivid_field_cap() argument
485 if (vivid_is_sdtv_cap(dev)) { in vivid_field_cap()
500 if (vivid_is_hdmi_cap(dev)) in vivid_field_cap()
501 return dev->dv_timings_cap[dev->input].bt.interlaced ? in vivid_field_cap()
506 static unsigned vivid_colorspace_cap(struct vivid_dev *dev) in vivid_colorspace_cap() argument
508 if (!dev->loop_video || vivid_is_webcam(dev) || vivid_is_tv_cap(dev)) in vivid_colorspace_cap()
509 return tpg_g_colorspace(&dev->tpg); in vivid_colorspace_cap()
510 return dev->colorspace_out; in vivid_colorspace_cap()
513 static unsigned vivid_xfer_func_cap(struct vivid_dev *dev) in vivid_xfer_func_cap() argument
515 if (!dev->loop_video || vivid_is_webcam(dev) || vivid_is_tv_cap(dev)) in vivid_xfer_func_cap()
516 return tpg_g_xfer_func(&dev->tpg); in vivid_xfer_func_cap()
517 return dev->xfer_func_out; in vivid_xfer_func_cap()
520 static unsigned vivid_ycbcr_enc_cap(struct vivid_dev *dev) in vivid_ycbcr_enc_cap() argument
522 if (!dev->loop_video || vivid_is_webcam(dev) || vivid_is_tv_cap(dev)) in vivid_ycbcr_enc_cap()
523 return tpg_g_ycbcr_enc(&dev->tpg); in vivid_ycbcr_enc_cap()
524 return dev->ycbcr_enc_out; in vivid_ycbcr_enc_cap()
527 static unsigned int vivid_hsv_enc_cap(struct vivid_dev *dev) in vivid_hsv_enc_cap() argument
529 if (!dev->loop_video || vivid_is_webcam(dev) || vivid_is_tv_cap(dev)) in vivid_hsv_enc_cap()
530 return tpg_g_hsv_enc(&dev->tpg); in vivid_hsv_enc_cap()
531 return dev->hsv_enc_out; in vivid_hsv_enc_cap()
534 static unsigned vivid_quantization_cap(struct vivid_dev *dev) in vivid_quantization_cap() argument
536 if (!dev->loop_video || vivid_is_webcam(dev) || vivid_is_tv_cap(dev)) in vivid_quantization_cap()
537 return tpg_g_quantization(&dev->tpg); in vivid_quantization_cap()
538 return dev->quantization_out; in vivid_quantization_cap()
544 struct vivid_dev *dev = video_drvdata(file); in vivid_g_fmt_vid_cap() local
548 mp->width = dev->fmt_cap_rect.width; in vivid_g_fmt_vid_cap()
549 mp->height = dev->fmt_cap_rect.height; in vivid_g_fmt_vid_cap()
550 mp->field = dev->field_cap; in vivid_g_fmt_vid_cap()
551 mp->pixelformat = dev->fmt_cap->fourcc; in vivid_g_fmt_vid_cap()
552 mp->colorspace = vivid_colorspace_cap(dev); in vivid_g_fmt_vid_cap()
553 mp->xfer_func = vivid_xfer_func_cap(dev); in vivid_g_fmt_vid_cap()
554 if (dev->fmt_cap->color_enc == TGP_COLOR_ENC_HSV) in vivid_g_fmt_vid_cap()
555 mp->hsv_enc = vivid_hsv_enc_cap(dev); in vivid_g_fmt_vid_cap()
557 mp->ycbcr_enc = vivid_ycbcr_enc_cap(dev); in vivid_g_fmt_vid_cap()
558 mp->quantization = vivid_quantization_cap(dev); in vivid_g_fmt_vid_cap()
559 mp->num_planes = dev->fmt_cap->buffers; in vivid_g_fmt_vid_cap()
561 mp->plane_fmt[p].bytesperline = tpg_g_bytesperline(&dev->tpg, p); in vivid_g_fmt_vid_cap()
563 (tpg_g_line_width(&dev->tpg, p) * mp->height) / in vivid_g_fmt_vid_cap()
564 dev->fmt_cap->vdownsampling[p] + in vivid_g_fmt_vid_cap()
565 dev->fmt_cap->data_offset[p]; in vivid_g_fmt_vid_cap()
575 struct vivid_dev *dev = video_drvdata(file); in vivid_try_fmt_vid_cap() local
583 fmt = vivid_get_format(dev, mp->pixelformat); in vivid_try_fmt_vid_cap()
585 dprintk(dev, 1, "Fourcc format (0x%08x) unknown.\n", in vivid_try_fmt_vid_cap()
588 fmt = vivid_get_format(dev, mp->pixelformat); in vivid_try_fmt_vid_cap()
591 mp->field = vivid_field_cap(dev, mp->field); in vivid_try_fmt_vid_cap()
592 if (vivid_is_webcam(dev)) { in vivid_try_fmt_vid_cap()
600 } else if (vivid_is_sdtv_cap(dev)) { in vivid_try_fmt_vid_cap()
602 h = (dev->std_cap[dev->input] & V4L2_STD_525_60) ? 480 : 576; in vivid_try_fmt_vid_cap()
604 w = dev->src_rect.width; in vivid_try_fmt_vid_cap()
605 h = dev->src_rect.height; in vivid_try_fmt_vid_cap()
609 if (vivid_is_webcam(dev) || in vivid_try_fmt_vid_cap()
610 (!dev->has_scaler_cap && !dev->has_crop_cap && !dev->has_compose_cap)) { in vivid_try_fmt_vid_cap()
618 if (dev->has_scaler_cap && !dev->has_compose_cap) { in vivid_try_fmt_vid_cap()
622 } else if (!dev->has_scaler_cap && dev->has_crop_cap && !dev->has_compose_cap) { in vivid_try_fmt_vid_cap()
623 v4l2_rect_set_max_size(&r, &dev->src_rect); in vivid_try_fmt_vid_cap()
624 } else if (!dev->has_scaler_cap && !dev->has_crop_cap) { in vivid_try_fmt_vid_cap()
625 v4l2_rect_set_min_size(&r, &dev->src_rect); in vivid_try_fmt_vid_cap()
656 mp->colorspace = vivid_colorspace_cap(dev); in vivid_try_fmt_vid_cap()
659 mp->xfer_func = vivid_xfer_func_cap(dev); in vivid_try_fmt_vid_cap()
663 mp->hsv_enc = vivid_hsv_enc_cap(dev); in vivid_try_fmt_vid_cap()
666 mp->ycbcr_enc = vivid_ycbcr_enc_cap(dev); in vivid_try_fmt_vid_cap()
668 mp->ycbcr_enc = vivid_ycbcr_enc_cap(dev); in vivid_try_fmt_vid_cap()
674 mp->quantization = vivid_quantization_cap(dev); in vivid_try_fmt_vid_cap()
676 mp->quantization = vivid_quantization_cap(dev); in vivid_try_fmt_vid_cap()
687 struct vivid_dev *dev = video_drvdata(file); in vivid_s_fmt_vid_cap() local
688 struct v4l2_rect *crop = &dev->crop_cap; in vivid_s_fmt_vid_cap()
689 struct v4l2_rect *compose = &dev->compose_cap; in vivid_s_fmt_vid_cap()
690 struct vb2_queue *q = &dev->vb_vid_cap_q; in vivid_s_fmt_vid_cap()
700 dprintk(dev, 1, "%s device busy\n", __func__); in vivid_s_fmt_vid_cap()
704 if (dev->overlay_cap_owner && dev->fb_cap.fmt.pixelformat != mp->pixelformat) { in vivid_s_fmt_vid_cap()
705 dprintk(dev, 1, "overlay is active, can't change pixelformat\n"); in vivid_s_fmt_vid_cap()
709 dev->fmt_cap = vivid_get_format(dev, mp->pixelformat); in vivid_s_fmt_vid_cap()
715 if (!vivid_is_webcam(dev) && in vivid_s_fmt_vid_cap()
716 (dev->has_scaler_cap || dev->has_crop_cap || dev->has_compose_cap)) { in vivid_s_fmt_vid_cap()
719 if (dev->has_scaler_cap) { in vivid_s_fmt_vid_cap()
720 if (dev->has_compose_cap) in vivid_s_fmt_vid_cap()
724 if (dev->has_crop_cap && !dev->has_compose_cap) { in vivid_s_fmt_vid_cap()
738 v4l2_rect_map_inside(crop, &dev->crop_bounds_cap); in vivid_s_fmt_vid_cap()
739 } else if (dev->has_crop_cap) { in vivid_s_fmt_vid_cap()
753 v4l2_rect_map_inside(crop, &dev->crop_bounds_cap); in vivid_s_fmt_vid_cap()
755 } else if (dev->has_crop_cap && !dev->has_compose_cap) { in vivid_s_fmt_vid_cap()
758 v4l2_rect_map_inside(crop, &dev->crop_bounds_cap); in vivid_s_fmt_vid_cap()
762 } else if (!dev->has_crop_cap) { in vivid_s_fmt_vid_cap()
767 v4l2_rect_map_inside(crop, &dev->crop_bounds_cap); in vivid_s_fmt_vid_cap()
775 } else if (vivid_is_webcam(dev)) { in vivid_s_fmt_vid_cap()
781 dev->webcam_size_idx = i; in vivid_s_fmt_vid_cap()
782 if (dev->webcam_ival_idx >= 2 * (VIVID_WEBCAM_SIZES - i)) in vivid_s_fmt_vid_cap()
783 dev->webcam_ival_idx = 2 * (VIVID_WEBCAM_SIZES - i) - 1; in vivid_s_fmt_vid_cap()
784 vivid_update_format_cap(dev, false); in vivid_s_fmt_vid_cap()
793 dev->fmt_cap_rect.width = mp->width; in vivid_s_fmt_vid_cap()
794 dev->fmt_cap_rect.height = mp->height; in vivid_s_fmt_vid_cap()
795 tpg_s_buf_height(&dev->tpg, mp->height); in vivid_s_fmt_vid_cap()
796 tpg_s_fourcc(&dev->tpg, dev->fmt_cap->fourcc); in vivid_s_fmt_vid_cap()
797 for (p = 0; p < tpg_g_buffers(&dev->tpg); p++) in vivid_s_fmt_vid_cap()
798 tpg_s_bytesperline(&dev->tpg, p, mp->plane_fmt[p].bytesperline); in vivid_s_fmt_vid_cap()
799 dev->field_cap = mp->field; in vivid_s_fmt_vid_cap()
800 if (dev->field_cap == V4L2_FIELD_ALTERNATE) in vivid_s_fmt_vid_cap()
801 tpg_s_field(&dev->tpg, V4L2_FIELD_TOP, true); in vivid_s_fmt_vid_cap()
803 tpg_s_field(&dev->tpg, dev->field_cap, false); in vivid_s_fmt_vid_cap()
804 tpg_s_crop_compose(&dev->tpg, &dev->crop_cap, &dev->compose_cap); in vivid_s_fmt_vid_cap()
805 if (vivid_is_sdtv_cap(dev)) in vivid_s_fmt_vid_cap()
806 dev->tv_field_cap = mp->field; in vivid_s_fmt_vid_cap()
807 tpg_update_mv_step(&dev->tpg); in vivid_s_fmt_vid_cap()
808 dev->tpg.colorspace = mp->colorspace; in vivid_s_fmt_vid_cap()
809 dev->tpg.xfer_func = mp->xfer_func; in vivid_s_fmt_vid_cap()
810 if (dev->fmt_cap->color_enc == TGP_COLOR_ENC_YCBCR) in vivid_s_fmt_vid_cap()
811 dev->tpg.ycbcr_enc = mp->ycbcr_enc; in vivid_s_fmt_vid_cap()
813 dev->tpg.hsv_enc = mp->hsv_enc; in vivid_s_fmt_vid_cap()
814 dev->tpg.quantization = mp->quantization; in vivid_s_fmt_vid_cap()
822 struct vivid_dev *dev = video_drvdata(file); in vidioc_g_fmt_vid_cap_mplane() local
824 if (!dev->multiplanar) in vidioc_g_fmt_vid_cap_mplane()
832 struct vivid_dev *dev = video_drvdata(file); in vidioc_try_fmt_vid_cap_mplane() local
834 if (!dev->multiplanar) in vidioc_try_fmt_vid_cap_mplane()
842 struct vivid_dev *dev = video_drvdata(file); in vidioc_s_fmt_vid_cap_mplane() local
844 if (!dev->multiplanar) in vidioc_s_fmt_vid_cap_mplane()
852 struct vivid_dev *dev = video_drvdata(file); in vidioc_g_fmt_vid_cap() local
854 if (dev->multiplanar) in vidioc_g_fmt_vid_cap()
862 struct vivid_dev *dev = video_drvdata(file); in vidioc_try_fmt_vid_cap() local
864 if (dev->multiplanar) in vidioc_try_fmt_vid_cap()
872 struct vivid_dev *dev = video_drvdata(file); in vidioc_s_fmt_vid_cap() local
874 if (dev->multiplanar) in vidioc_s_fmt_vid_cap()
882 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_g_selection() local
884 if (!dev->has_crop_cap && !dev->has_compose_cap) in vivid_vid_cap_g_selection()
888 if (vivid_is_webcam(dev)) in vivid_vid_cap_g_selection()
894 if (!dev->has_crop_cap) in vivid_vid_cap_g_selection()
896 sel->r = dev->crop_cap; in vivid_vid_cap_g_selection()
900 if (!dev->has_crop_cap) in vivid_vid_cap_g_selection()
902 sel->r = dev->src_rect; in vivid_vid_cap_g_selection()
905 if (!dev->has_compose_cap) in vivid_vid_cap_g_selection()
910 if (!dev->has_compose_cap) in vivid_vid_cap_g_selection()
912 sel->r = dev->compose_cap; in vivid_vid_cap_g_selection()
915 if (!dev->has_compose_cap) in vivid_vid_cap_g_selection()
917 sel->r = dev->fmt_cap_rect; in vivid_vid_cap_g_selection()
927 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_s_selection() local
928 struct v4l2_rect *crop = &dev->crop_cap; in vivid_vid_cap_s_selection()
929 struct v4l2_rect *compose = &dev->compose_cap; in vivid_vid_cap_s_selection()
932 unsigned factor = V4L2_FIELD_HAS_T_OR_B(dev->field_cap) ? 2 : 1; in vivid_vid_cap_s_selection()
935 if (!dev->has_crop_cap && !dev->has_compose_cap) in vivid_vid_cap_s_selection()
939 if (vivid_is_webcam(dev)) in vivid_vid_cap_s_selection()
944 if (!dev->has_crop_cap) in vivid_vid_cap_s_selection()
950 v4l2_rect_set_max_size(&s->r, &dev->src_rect); in vivid_vid_cap_s_selection()
951 v4l2_rect_map_inside(&s->r, &dev->crop_bounds_cap); in vivid_vid_cap_s_selection()
954 if (dev->has_scaler_cap) { in vivid_vid_cap_s_selection()
955 struct v4l2_rect fmt = dev->fmt_cap_rect; in vivid_vid_cap_s_selection()
968 if (!dev->has_compose_cap) in vivid_vid_cap_s_selection()
970 if (!v4l2_rect_same_size(&dev->fmt_cap_rect, &fmt) && in vivid_vid_cap_s_selection()
971 vb2_is_busy(&dev->vb_vid_cap_q)) in vivid_vid_cap_s_selection()
973 if (dev->has_compose_cap) { in vivid_vid_cap_s_selection()
977 dev->fmt_cap_rect = fmt; in vivid_vid_cap_s_selection()
978 tpg_s_buf_height(&dev->tpg, fmt.height); in vivid_vid_cap_s_selection()
979 } else if (dev->has_compose_cap) { in vivid_vid_cap_s_selection()
980 struct v4l2_rect fmt = dev->fmt_cap_rect; in vivid_vid_cap_s_selection()
983 if (!v4l2_rect_same_size(&dev->fmt_cap_rect, &fmt) && in vivid_vid_cap_s_selection()
984 vb2_is_busy(&dev->vb_vid_cap_q)) in vivid_vid_cap_s_selection()
986 dev->fmt_cap_rect = fmt; in vivid_vid_cap_s_selection()
987 tpg_s_buf_height(&dev->tpg, fmt.height); in vivid_vid_cap_s_selection()
989 v4l2_rect_map_inside(compose, &dev->fmt_cap_rect); in vivid_vid_cap_s_selection()
991 if (!v4l2_rect_same_size(&s->r, &dev->fmt_cap_rect) && in vivid_vid_cap_s_selection()
992 vb2_is_busy(&dev->vb_vid_cap_q)) in vivid_vid_cap_s_selection()
994 v4l2_rect_set_size_to(&dev->fmt_cap_rect, &s->r); in vivid_vid_cap_s_selection()
996 v4l2_rect_map_inside(compose, &dev->fmt_cap_rect); in vivid_vid_cap_s_selection()
997 tpg_s_buf_height(&dev->tpg, dev->fmt_cap_rect.height); in vivid_vid_cap_s_selection()
1004 if (!dev->has_compose_cap) in vivid_vid_cap_s_selection()
1010 v4l2_rect_set_max_size(&s->r, &dev->fmt_cap_rect); in vivid_vid_cap_s_selection()
1011 if (dev->has_scaler_cap) { in vivid_vid_cap_s_selection()
1014 dev->src_rect.width * MAX_ZOOM, in vivid_vid_cap_s_selection()
1015 (dev->src_rect.height / factor) * MAX_ZOOM in vivid_vid_cap_s_selection()
1019 if (dev->has_crop_cap) { in vivid_vid_cap_s_selection()
1033 v4l2_rect_map_inside(crop, &dev->crop_bounds_cap); in vivid_vid_cap_s_selection()
1035 } else if (dev->has_crop_cap) { in vivid_vid_cap_s_selection()
1038 v4l2_rect_set_max_size(&s->r, &dev->src_rect); in vivid_vid_cap_s_selection()
1040 v4l2_rect_map_inside(crop, &dev->crop_bounds_cap); in vivid_vid_cap_s_selection()
1044 v4l2_rect_set_size_to(&s->r, &dev->src_rect); in vivid_vid_cap_s_selection()
1047 v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect); in vivid_vid_cap_s_selection()
1054 if (dev->bitmap_cap && (compose->width != orig_compose_w || in vivid_vid_cap_s_selection()
1056 vfree(dev->bitmap_cap); in vivid_vid_cap_s_selection()
1057 dev->bitmap_cap = NULL; in vivid_vid_cap_s_selection()
1059 tpg_s_crop_compose(&dev->tpg, crop, compose); in vivid_vid_cap_s_selection()
1066 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_g_pixelaspect() local
1071 switch (vivid_get_pixel_aspect(dev)) { in vivid_vid_cap_g_pixelaspect()
1089 struct vivid_dev *dev = video_drvdata(file); in vidioc_enum_fmt_vid_overlay() local
1092 if (dev->multiplanar) in vidioc_enum_fmt_vid_overlay()
1107 struct vivid_dev *dev = video_drvdata(file); in vidioc_g_fmt_vid_overlay() local
1108 const struct v4l2_rect *compose = &dev->compose_cap; in vidioc_g_fmt_vid_overlay()
1112 if (dev->multiplanar) in vidioc_g_fmt_vid_overlay()
1115 win->w.top = dev->overlay_cap_top; in vidioc_g_fmt_vid_overlay()
1116 win->w.left = dev->overlay_cap_left; in vidioc_g_fmt_vid_overlay()
1119 win->field = dev->overlay_cap_field; in vidioc_g_fmt_vid_overlay()
1120 win->clipcount = dev->clipcount_cap; in vidioc_g_fmt_vid_overlay()
1121 if (clipcount > dev->clipcount_cap) in vidioc_g_fmt_vid_overlay()
1122 clipcount = dev->clipcount_cap; in vidioc_g_fmt_vid_overlay()
1123 if (dev->bitmap_cap == NULL) in vidioc_g_fmt_vid_overlay()
1126 if (copy_to_user(win->bitmap, dev->bitmap_cap, in vidioc_g_fmt_vid_overlay()
1131 memcpy(win->clips, dev->clips_cap, in vidioc_g_fmt_vid_overlay()
1132 clipcount * sizeof(dev->clips_cap[0])); in vidioc_g_fmt_vid_overlay()
1139 struct vivid_dev *dev = video_drvdata(file); in vidioc_try_fmt_vid_overlay() local
1140 const struct v4l2_rect *compose = &dev->compose_cap; in vidioc_try_fmt_vid_overlay()
1144 if (dev->multiplanar) in vidioc_try_fmt_vid_overlay()
1148 -dev->fb_cap.fmt.width, dev->fb_cap.fmt.width); in vidioc_try_fmt_vid_overlay()
1150 -dev->fb_cap.fmt.height, dev->fb_cap.fmt.height); in vidioc_try_fmt_vid_overlay()
1162 memcpy(dev->try_clips_cap, win->clips, in vidioc_try_fmt_vid_overlay()
1163 win->clipcount * sizeof(dev->clips_cap[0])); in vidioc_try_fmt_vid_overlay()
1165 struct v4l2_rect *r = &dev->try_clips_cap[i].c; in vidioc_try_fmt_vid_overlay()
1167 r->top = clamp_t(s32, r->top, 0, dev->fb_cap.fmt.height - 1); in vidioc_try_fmt_vid_overlay()
1168 r->height = clamp_t(s32, r->height, 1, dev->fb_cap.fmt.height - r->top); in vidioc_try_fmt_vid_overlay()
1169 r->left = clamp_t(u32, r->left, 0, dev->fb_cap.fmt.width - 1); in vidioc_try_fmt_vid_overlay()
1170 r->width = clamp_t(u32, r->width, 1, dev->fb_cap.fmt.width - r->left); in vidioc_try_fmt_vid_overlay()
1177 struct v4l2_rect *r1 = &dev->try_clips_cap[i].c; in vidioc_try_fmt_vid_overlay()
1180 struct v4l2_rect *r2 = &dev->try_clips_cap[j].c; in vidioc_try_fmt_vid_overlay()
1186 memcpy(win->clips, dev->try_clips_cap, in vidioc_try_fmt_vid_overlay()
1187 win->clipcount * sizeof(dev->clips_cap[0])); in vidioc_try_fmt_vid_overlay()
1195 struct vivid_dev *dev = video_drvdata(file); in vidioc_s_fmt_vid_overlay() local
1196 const struct v4l2_rect *compose = &dev->compose_cap; in vidioc_s_fmt_vid_overlay()
1200 unsigned clips_size = win->clipcount * sizeof(dev->clips_cap[0]); in vidioc_s_fmt_vid_overlay()
1217 dev->overlay_cap_top = win->w.top; in vidioc_s_fmt_vid_overlay()
1218 dev->overlay_cap_left = win->w.left; in vidioc_s_fmt_vid_overlay()
1219 dev->overlay_cap_field = win->field; in vidioc_s_fmt_vid_overlay()
1220 vfree(dev->bitmap_cap); in vidioc_s_fmt_vid_overlay()
1221 dev->bitmap_cap = new_bitmap; in vidioc_s_fmt_vid_overlay()
1222 dev->clipcount_cap = win->clipcount; in vidioc_s_fmt_vid_overlay()
1223 if (dev->clipcount_cap) in vidioc_s_fmt_vid_overlay()
1224 memcpy(dev->clips_cap, dev->try_clips_cap, clips_size); in vidioc_s_fmt_vid_overlay()
1230 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_overlay() local
1232 if (dev->multiplanar) in vivid_vid_cap_overlay()
1235 if (i && dev->fb_vbase_cap == NULL) in vivid_vid_cap_overlay()
1238 if (i && dev->fb_cap.fmt.pixelformat != dev->fmt_cap->fourcc) { in vivid_vid_cap_overlay()
1239 dprintk(dev, 1, "mismatch between overlay and video capture pixelformats\n"); in vivid_vid_cap_overlay()
1243 if (dev->overlay_cap_owner && dev->overlay_cap_owner != fh) in vivid_vid_cap_overlay()
1245 dev->overlay_cap_owner = i ? fh : NULL; in vivid_vid_cap_overlay()
1252 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_g_fbuf() local
1254 if (dev->multiplanar) in vivid_vid_cap_g_fbuf()
1257 *a = dev->fb_cap; in vivid_vid_cap_g_fbuf()
1270 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_s_fbuf() local
1273 if (dev->multiplanar) in vivid_vid_cap_s_fbuf()
1279 if (dev->overlay_cap_owner) in vivid_vid_cap_s_fbuf()
1283 dev->fb_cap.base = NULL; in vivid_vid_cap_s_fbuf()
1284 dev->fb_vbase_cap = NULL; in vivid_vid_cap_s_fbuf()
1290 fmt = vivid_get_format(dev, a->fmt.pixelformat); in vivid_vid_cap_s_fbuf()
1305 dev->fb_vbase_cap = phys_to_virt((unsigned long)a->base); in vivid_vid_cap_s_fbuf()
1306 dev->fb_cap = *a; in vivid_vid_cap_s_fbuf()
1307 dev->overlay_cap_left = clamp_t(int, dev->overlay_cap_left, in vivid_vid_cap_s_fbuf()
1308 -dev->fb_cap.fmt.width, dev->fb_cap.fmt.width); in vivid_vid_cap_s_fbuf()
1309 dev->overlay_cap_top = clamp_t(int, dev->overlay_cap_top, in vivid_vid_cap_s_fbuf()
1310 -dev->fb_cap.fmt.height, dev->fb_cap.fmt.height); in vivid_vid_cap_s_fbuf()
1322 struct vivid_dev *dev = video_drvdata(file); in vidioc_enum_input() local
1324 if (inp->index >= dev->num_inputs) in vidioc_enum_input()
1328 switch (dev->input_type[inp->index]) { in vidioc_enum_input()
1331 dev->input_name_counter[inp->index]); in vidioc_enum_input()
1336 dev->input_name_counter[inp->index]); in vidioc_enum_input()
1339 if (dev->has_audio_inputs) in vidioc_enum_input()
1345 dev->input_name_counter[inp->index]); in vidioc_enum_input()
1347 if (dev->has_audio_inputs) in vidioc_enum_input()
1353 dev->input_name_counter[inp->index]); in vidioc_enum_input()
1355 if (dev->edid_blocks == 0 || in vidioc_enum_input()
1356 dev->dv_timings_signal_mode[dev->input] == NO_SIGNAL) in vidioc_enum_input()
1358 else if (dev->dv_timings_signal_mode[dev->input] == NO_LOCK || in vidioc_enum_input()
1359 dev->dv_timings_signal_mode[dev->input] == OUT_OF_RANGE) in vidioc_enum_input()
1363 if (dev->sensor_hflip) in vidioc_enum_input()
1365 if (dev->sensor_vflip) in vidioc_enum_input()
1367 if (dev->input == inp->index && vivid_is_sdtv_cap(dev)) { in vidioc_enum_input()
1368 if (dev->std_signal_mode[dev->input] == NO_SIGNAL) { in vidioc_enum_input()
1370 } else if (dev->std_signal_mode[dev->input] == NO_LOCK) { in vidioc_enum_input()
1372 } else if (vivid_is_tv_cap(dev)) { in vidioc_enum_input()
1373 switch (tpg_g_quality(&dev->tpg)) { in vidioc_enum_input()
1390 struct vivid_dev *dev = video_drvdata(file); in vidioc_g_input() local
1392 *i = dev->input; in vidioc_g_input()
1398 struct vivid_dev *dev = video_drvdata(file); in vidioc_s_input() local
1399 struct v4l2_bt_timings *bt = &dev->dv_timings_cap[dev->input].bt; in vidioc_s_input()
1402 if (i >= dev->num_inputs) in vidioc_s_input()
1405 if (i == dev->input) in vidioc_s_input()
1408 if (vb2_is_busy(&dev->vb_vid_cap_q) || in vidioc_s_input()
1409 vb2_is_busy(&dev->vb_vbi_cap_q) || in vidioc_s_input()
1410 vb2_is_busy(&dev->vb_meta_cap_q)) in vidioc_s_input()
1413 dev->input = i; in vidioc_s_input()
1414 dev->vid_cap_dev.tvnorms = 0; in vidioc_s_input()
1415 if (dev->input_type[i] == TV || dev->input_type[i] == SVID) { in vidioc_s_input()
1416 dev->tv_audio_input = (dev->input_type[i] == TV) ? 0 : 1; in vidioc_s_input()
1417 dev->vid_cap_dev.tvnorms = V4L2_STD_ALL; in vidioc_s_input()
1419 dev->vbi_cap_dev.tvnorms = dev->vid_cap_dev.tvnorms; in vidioc_s_input()
1420 dev->meta_cap_dev.tvnorms = dev->vid_cap_dev.tvnorms; in vidioc_s_input()
1421 vivid_update_format_cap(dev, false); in vidioc_s_input()
1423 if (dev->colorspace) { in vidioc_s_input()
1424 switch (dev->input_type[i]) { in vidioc_s_input()
1426 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_SRGB); in vidioc_s_input()
1430 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_170M); in vidioc_s_input()
1434 if (dev->src_rect.width == 720 && dev->src_rect.height <= 576) in vidioc_s_input()
1435 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_170M); in vidioc_s_input()
1437 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_709); in vidioc_s_input()
1439 v4l2_ctrl_s_ctrl(dev->colorspace, VIVID_CS_SRGB); in vidioc_s_input()
1452 brightness = 128 * i + dev->input_brightness[i]; in vidioc_s_input()
1453 v4l2_ctrl_modify_range(dev->brightness, in vidioc_s_input()
1455 v4l2_ctrl_s_ctrl(dev->brightness, brightness); in vidioc_s_input()
1458 v4l2_ctrl_activate(dev->ctrl_dv_timings_signal_mode, in vidioc_s_input()
1459 vivid_is_hdmi_cap(dev)); in vidioc_s_input()
1460 v4l2_ctrl_activate(dev->ctrl_dv_timings, vivid_is_hdmi_cap(dev) && in vidioc_s_input()
1461 dev->dv_timings_signal_mode[dev->input] == in vidioc_s_input()
1463 v4l2_ctrl_activate(dev->ctrl_std_signal_mode, vivid_is_sdtv_cap(dev)); in vidioc_s_input()
1464 v4l2_ctrl_activate(dev->ctrl_standard, vivid_is_sdtv_cap(dev) && in vidioc_s_input()
1465 dev->std_signal_mode[dev->input]); in vidioc_s_input()
1467 if (vivid_is_hdmi_cap(dev)) { in vidioc_s_input()
1468 v4l2_ctrl_s_ctrl(dev->ctrl_dv_timings_signal_mode, in vidioc_s_input()
1469 dev->dv_timings_signal_mode[dev->input]); in vidioc_s_input()
1470 v4l2_ctrl_s_ctrl(dev->ctrl_dv_timings, in vidioc_s_input()
1471 dev->query_dv_timings[dev->input]); in vidioc_s_input()
1472 } else if (vivid_is_sdtv_cap(dev)) { in vidioc_s_input()
1473 v4l2_ctrl_s_ctrl(dev->ctrl_std_signal_mode, in vidioc_s_input()
1474 dev->std_signal_mode[dev->input]); in vidioc_s_input()
1475 v4l2_ctrl_s_ctrl(dev->ctrl_standard, in vidioc_s_input()
1476 dev->std_signal_mode[dev->input]); in vidioc_s_input()
1492 struct vivid_dev *dev = video_drvdata(file); in vidioc_g_audio() local
1494 if (!vivid_is_sdtv_cap(dev)) in vidioc_g_audio()
1496 *vin = vivid_audio_inputs[dev->tv_audio_input]; in vidioc_g_audio()
1502 struct vivid_dev *dev = video_drvdata(file); in vidioc_s_audio() local
1504 if (!vivid_is_sdtv_cap(dev)) in vidioc_s_audio()
1508 dev->tv_audio_input = vin->index; in vidioc_s_audio()
1514 struct vivid_dev *dev = video_drvdata(file); in vivid_video_g_frequency() local
1518 vf->frequency = dev->tv_freq; in vivid_video_g_frequency()
1524 struct vivid_dev *dev = video_drvdata(file); in vivid_video_s_frequency() local
1528 dev->tv_freq = clamp_t(unsigned, vf->frequency, MIN_TV_FREQ, MAX_TV_FREQ); in vivid_video_s_frequency()
1529 if (vivid_is_tv_cap(dev)) in vivid_video_s_frequency()
1530 vivid_update_quality(dev); in vivid_video_s_frequency()
1536 struct vivid_dev *dev = video_drvdata(file); in vivid_video_s_tuner() local
1542 dev->tv_audmode = vt->audmode; in vivid_video_s_tuner()
1548 struct vivid_dev *dev = video_drvdata(file); in vivid_video_g_tuner() local
1556 vt->audmode = dev->tv_audmode; in vivid_video_g_tuner()
1559 qual = vivid_get_quality(dev, &vt->afc); in vivid_video_g_tuner()
1571 unsigned int channel_nr = dev->tv_freq / (6 * 16); in vivid_video_g_tuner()
1573 (dev->std_cap[dev->input] & V4L2_STD_NTSC_M) ? 4 : 3; in vivid_video_g_tuner()
1583 if (dev->std_cap[dev->input] & V4L2_STD_NTSC_M) in vivid_video_g_tuner()
1639 struct vivid_dev *dev = video_drvdata(file); in vidioc_querystd() local
1640 unsigned int last = dev->query_std_last[dev->input]; in vidioc_querystd()
1642 if (!vivid_is_sdtv_cap(dev)) in vidioc_querystd()
1644 if (dev->std_signal_mode[dev->input] == NO_SIGNAL || in vidioc_querystd()
1645 dev->std_signal_mode[dev->input] == NO_LOCK) { in vidioc_querystd()
1649 if (vivid_is_tv_cap(dev) && tpg_g_quality(&dev->tpg) == TPG_QUAL_NOISE) { in vidioc_querystd()
1651 } else if (dev->std_signal_mode[dev->input] == CURRENT_STD) { in vidioc_querystd()
1652 *id = dev->std_cap[dev->input]; in vidioc_querystd()
1653 } else if (dev->std_signal_mode[dev->input] == SELECTED_STD) { in vidioc_querystd()
1654 *id = dev->query_std[dev->input]; in vidioc_querystd()
1657 dev->query_std_last[dev->input] = in vidioc_querystd()
1666 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_s_std() local
1668 if (!vivid_is_sdtv_cap(dev)) in vivid_vid_cap_s_std()
1670 if (dev->std_cap[dev->input] == id) in vivid_vid_cap_s_std()
1672 if (vb2_is_busy(&dev->vb_vid_cap_q) || vb2_is_busy(&dev->vb_vbi_cap_q)) in vivid_vid_cap_s_std()
1674 dev->std_cap[dev->input] = id; in vivid_vid_cap_s_std()
1675 vivid_update_format_cap(dev, false); in vivid_vid_cap_s_std()
1742 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_s_dv_timings() local
1744 if (!vivid_is_hdmi_cap(dev)) in vivid_vid_cap_s_dv_timings()
1751 if (v4l2_match_dv_timings(timings, &dev->dv_timings_cap[dev->input], in vivid_vid_cap_s_dv_timings()
1754 if (vb2_is_busy(&dev->vb_vid_cap_q)) in vivid_vid_cap_s_dv_timings()
1757 dev->dv_timings_cap[dev->input] = *timings; in vivid_vid_cap_s_dv_timings()
1758 vivid_update_format_cap(dev, false); in vivid_vid_cap_s_dv_timings()
1765 struct vivid_dev *dev = video_drvdata(file); in vidioc_query_dv_timings() local
1766 unsigned int input = dev->input; in vidioc_query_dv_timings()
1767 unsigned int last = dev->query_dv_timings_last[input]; in vidioc_query_dv_timings()
1769 if (!vivid_is_hdmi_cap(dev)) in vidioc_query_dv_timings()
1771 if (dev->dv_timings_signal_mode[input] == NO_SIGNAL || in vidioc_query_dv_timings()
1772 dev->edid_blocks == 0) in vidioc_query_dv_timings()
1774 if (dev->dv_timings_signal_mode[input] == NO_LOCK) in vidioc_query_dv_timings()
1776 if (dev->dv_timings_signal_mode[input] == OUT_OF_RANGE) { in vidioc_query_dv_timings()
1780 if (dev->dv_timings_signal_mode[input] == CURRENT_DV_TIMINGS) { in vidioc_query_dv_timings()
1781 *timings = dev->dv_timings_cap[input]; in vidioc_query_dv_timings()
1782 } else if (dev->dv_timings_signal_mode[input] == in vidioc_query_dv_timings()
1785 v4l2_dv_timings_presets[dev->query_dv_timings[input]]; in vidioc_query_dv_timings()
1789 dev->query_dv_timings_last[input] = in vidioc_query_dv_timings()
1790 (last + 1) % dev->query_dv_timings_size; in vidioc_query_dv_timings()
1798 struct vivid_dev *dev = video_drvdata(file); in vidioc_s_edid() local
1805 if (edid->pad >= dev->num_inputs) in vidioc_s_edid()
1807 if (dev->input_type[edid->pad] != HDMI || edid->start_block) in vidioc_s_edid()
1810 dev->edid_blocks = 0; in vidioc_s_edid()
1811 v4l2_ctrl_s_ctrl(dev->ctrl_tx_edid_present, 0); in vidioc_s_edid()
1812 v4l2_ctrl_s_ctrl(dev->ctrl_tx_hotplug, 0); in vidioc_s_edid()
1816 if (edid->blocks > dev->edid_max_blocks) { in vidioc_s_edid()
1817 edid->blocks = dev->edid_max_blocks; in vidioc_s_edid()
1825 if (vb2_is_busy(&dev->vb_vid_cap_q)) in vidioc_s_edid()
1828 dev->edid_blocks = edid->blocks; in vidioc_s_edid()
1829 memcpy(dev->edid, edid->edid, edid->blocks * 128); in vidioc_s_edid()
1831 for (i = 0, j = 0; i < dev->num_outputs; i++) in vidioc_s_edid()
1832 if (dev->output_type[i] == HDMI) in vidioc_s_edid()
1834 dev->display_present[i] << j++; in vidioc_s_edid()
1836 v4l2_ctrl_s_ctrl(dev->ctrl_tx_edid_present, display_present); in vidioc_s_edid()
1837 v4l2_ctrl_s_ctrl(dev->ctrl_tx_hotplug, display_present); in vidioc_s_edid()
1841 cec_s_phys_addr(dev->cec_rx_adap, phys_addr, false); in vidioc_s_edid()
1843 for (i = 0; i < MAX_OUTPUTS && dev->cec_tx_adap[i]; i++) in vidioc_s_edid()
1844 cec_s_phys_addr(dev->cec_tx_adap[i], in vidioc_s_edid()
1845 dev->display_present[i] ? in vidioc_s_edid()
1855 struct vivid_dev *dev = video_drvdata(file); in vidioc_enum_framesizes() local
1857 if (!vivid_is_webcam(dev) && !dev->has_scaler_cap) in vidioc_enum_framesizes()
1859 if (vivid_get_format(dev, fsize->pixel_format) == NULL) in vidioc_enum_framesizes()
1861 if (vivid_is_webcam(dev)) { in vidioc_enum_framesizes()
1884 struct vivid_dev *dev = video_drvdata(file); in vidioc_enum_frameintervals() local
1888 fmt = vivid_get_format(dev, fival->pixel_format); in vidioc_enum_frameintervals()
1892 if (!vivid_is_webcam(dev)) { in vidioc_enum_frameintervals()
1900 fival->discrete = dev->timeperframe_vid_cap; in vidioc_enum_frameintervals()
1920 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_g_parm() local
1922 if (parm->type != (dev->multiplanar ? in vivid_vid_cap_g_parm()
1928 parm->parm.capture.timeperframe = dev->timeperframe_vid_cap; in vivid_vid_cap_g_parm()
1936 struct vivid_dev *dev = video_drvdata(file); in vivid_vid_cap_s_parm() local
1937 unsigned ival_sz = 2 * (VIVID_WEBCAM_SIZES - dev->webcam_size_idx); in vivid_vid_cap_s_parm()
1941 if (parm->type != (dev->multiplanar ? in vivid_vid_cap_s_parm()
1945 if (!vivid_is_webcam(dev)) in vivid_vid_cap_s_parm()
1957 dev->webcam_ival_idx = i; in vivid_vid_cap_s_parm()
1958 tpf = webcam_intervals[dev->webcam_ival_idx]; in vivid_vid_cap_s_parm()
1961 dev->cap_seq_resync = true; in vivid_vid_cap_s_parm()
1962 dev->timeperframe_vid_cap = tpf; in vivid_vid_cap_s_parm()