Lines Matching +full:2 +full:- +full:pixel +full:- +full:align

1 // SPDX-License-Identifier: GPL-2.0-only
3 * TI Camera Access Layer (CAL) - Video Device
5 * Copyright (c) 2015-2020 Texas Instruments Inc.
16 #include <media/media-device.h>
17 #include <media/v4l2-common.h>
18 #include <media/v4l2-ctrls.h>
19 #include <media/v4l2-device.h>
20 #include <media/v4l2-event.h>
21 #include <media/v4l2-fh.h>
22 #include <media/v4l2-ioctl.h>
23 #include <media/videobuf2-core.h>
24 #include <media/videobuf2-dma-contig.h>
28 /* Print Four-character-code (FOURCC) */
35 code[2] = (unsigned char)((fmt >> 16) & 0xff); in fourcc_to_str()
42 /* ------------------------------------------------------------------
44 * ------------------------------------------------------------------
50 strscpy(cap->driver, CAL_MODULE_NAME, sizeof(cap->driver)); in cal_querycap()
51 strscpy(cap->card, CAL_MODULE_NAME, sizeof(cap->card)); in cal_querycap()
61 *f = ctx->v_fmt; in cal_g_fmt_vid_cap()
66 /* ------------------------------------------------------------------
68 * ------------------------------------------------------------------
77 for (k = 0; k < ctx->num_active_fmt; k++) { in find_format_by_pix()
78 fmtinfo = ctx->active_fmt[k]; in find_format_by_pix()
79 if (fmtinfo->fourcc == pixelformat) in find_format_by_pix()
92 for (k = 0; k < ctx->num_active_fmt; k++) { in find_format_by_code()
93 fmtinfo = ctx->active_fmt[k]; in find_format_by_code()
94 if (fmtinfo->code == code) in find_format_by_code()
107 if (f->index >= ctx->num_active_fmt) in cal_legacy_enum_fmt_vid_cap()
108 return -EINVAL; in cal_legacy_enum_fmt_vid_cap()
110 fmtinfo = ctx->active_fmt[f->index]; in cal_legacy_enum_fmt_vid_cap()
112 f->pixelformat = fmtinfo->fourcc; in cal_legacy_enum_fmt_vid_cap()
113 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cal_legacy_enum_fmt_vid_cap()
127 ret = v4l2_subdev_call(ctx->phy->source, pad, get_fmt, NULL, &sd_fmt); in __subdev_get_format()
134 fmt->width, fmt->height, fmt->code); in __subdev_get_format()
151 ret = v4l2_subdev_call(ctx->phy->source, pad, set_fmt, NULL, &sd_fmt); in __subdev_set_format()
156 fmt->width, fmt->height, fmt->code); in __subdev_set_format()
172 max_width = CAL_MAX_WIDTH_BYTES / (ALIGN(fmtinfo->bpp, 8) >> 3); in cal_calc_format_size()
173 v4l_bound_align_image(&f->fmt.pix.width, 48, max_width, 2, in cal_calc_format_size()
174 &f->fmt.pix.height, 32, CAL_MAX_HEIGHT_LINES, in cal_calc_format_size()
177 bpl = (f->fmt.pix.width * ALIGN(fmtinfo->bpp, 8)) >> 3; in cal_calc_format_size()
178 f->fmt.pix.bytesperline = ALIGN(bpl, 16); in cal_calc_format_size()
180 f->fmt.pix.sizeimage = f->fmt.pix.height * in cal_calc_format_size()
181 f->fmt.pix.bytesperline; in cal_calc_format_size()
184 __func__, fourcc_to_str(f->fmt.pix.pixelformat), in cal_calc_format_size()
185 f->fmt.pix.width, f->fmt.pix.height, in cal_calc_format_size()
186 f->fmt.pix.bytesperline, f->fmt.pix.sizeimage); in cal_calc_format_size()
199 fmtinfo = find_format_by_pix(ctx, f->fmt.pix.pixelformat); in cal_legacy_try_fmt_vid_cap()
202 f->fmt.pix.pixelformat); in cal_legacy_try_fmt_vid_cap()
205 fmtinfo = ctx->active_fmt[0]; in cal_legacy_try_fmt_vid_cap()
206 f->fmt.pix.pixelformat = fmtinfo->fourcc; in cal_legacy_try_fmt_vid_cap()
209 f->fmt.pix.field = ctx->v_fmt.fmt.pix.field; in cal_legacy_try_fmt_vid_cap()
214 fse.code = fmtinfo->code; in cal_legacy_try_fmt_vid_cap()
218 ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_size, in cal_legacy_try_fmt_vid_cap()
223 if ((f->fmt.pix.width == fse.max_width) && in cal_legacy_try_fmt_vid_cap()
224 (f->fmt.pix.height == fse.max_height)) { in cal_legacy_try_fmt_vid_cap()
227 } else if ((f->fmt.pix.width >= fse.min_width) && in cal_legacy_try_fmt_vid_cap()
228 (f->fmt.pix.width <= fse.max_width) && in cal_legacy_try_fmt_vid_cap()
229 (f->fmt.pix.height >= fse.min_height) && in cal_legacy_try_fmt_vid_cap()
230 (f->fmt.pix.height <= fse.max_height)) { in cal_legacy_try_fmt_vid_cap()
238 f->fmt.pix.width = ctx->v_fmt.fmt.pix.width; in cal_legacy_try_fmt_vid_cap()
239 f->fmt.pix.height = ctx->v_fmt.fmt.pix.height; in cal_legacy_try_fmt_vid_cap()
246 f->fmt.pix.colorspace = ctx->v_fmt.fmt.pix.colorspace; in cal_legacy_try_fmt_vid_cap()
255 struct vb2_queue *q = &ctx->vb_vidq; in cal_legacy_s_fmt_vid_cap()
265 return -EBUSY; in cal_legacy_s_fmt_vid_cap()
272 fmtinfo = find_format_by_pix(ctx, f->fmt.pix.pixelformat); in cal_legacy_s_fmt_vid_cap()
274 v4l2_fill_mbus_format(&sd_fmt.format, &f->fmt.pix, fmtinfo->code); in cal_legacy_s_fmt_vid_cap()
281 if (sd_fmt.format.code != fmtinfo->code) { in cal_legacy_s_fmt_vid_cap()
285 return -EINVAL; in cal_legacy_s_fmt_vid_cap()
288 v4l2_fill_pix_format(&ctx->v_fmt.fmt.pix, &sd_fmt.format); in cal_legacy_s_fmt_vid_cap()
289 ctx->v_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cal_legacy_s_fmt_vid_cap()
290 ctx->v_fmt.fmt.pix.pixelformat = fmtinfo->fourcc; in cal_legacy_s_fmt_vid_cap()
291 ctx->v_fmt.fmt.pix.field = sd_fmt.format.field; in cal_legacy_s_fmt_vid_cap()
292 cal_calc_format_size(ctx, fmtinfo, &ctx->v_fmt); in cal_legacy_s_fmt_vid_cap()
294 v4l2_subdev_call(&ctx->phy->subdev, pad, set_fmt, NULL, &sd_fmt); in cal_legacy_s_fmt_vid_cap()
296 ctx->fmtinfo = fmtinfo; in cal_legacy_s_fmt_vid_cap()
297 *f = ctx->v_fmt; in cal_legacy_s_fmt_vid_cap()
308 .index = fsize->index, in cal_legacy_enum_framesizes()
315 fmtinfo = find_format_by_pix(ctx, fsize->pixel_format); in cal_legacy_enum_framesizes()
317 ctx_dbg(3, ctx, "Invalid pixel code: %x\n", in cal_legacy_enum_framesizes()
318 fsize->pixel_format); in cal_legacy_enum_framesizes()
319 return -EINVAL; in cal_legacy_enum_framesizes()
322 fse.code = fmtinfo->code; in cal_legacy_enum_framesizes()
324 ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_size, NULL, in cal_legacy_enum_framesizes()
333 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; in cal_legacy_enum_framesizes()
334 fsize->discrete.width = fse.max_width; in cal_legacy_enum_framesizes()
335 fsize->discrete.height = fse.max_height; in cal_legacy_enum_framesizes()
343 if (inp->index > 0) in cal_legacy_enum_input()
344 return -EINVAL; in cal_legacy_enum_input()
346 inp->type = V4L2_INPUT_TYPE_CAMERA; in cal_legacy_enum_input()
347 sprintf(inp->name, "Camera %u", inp->index); in cal_legacy_enum_input()
359 return i > 0 ? -EINVAL : 0; in cal_legacy_s_input()
369 .index = fival->index, in cal_legacy_enum_frameintervals()
370 .width = fival->width, in cal_legacy_enum_frameintervals()
371 .height = fival->height, in cal_legacy_enum_frameintervals()
376 fmtinfo = find_format_by_pix(ctx, fival->pixel_format); in cal_legacy_enum_frameintervals()
378 return -EINVAL; in cal_legacy_enum_frameintervals()
380 fie.code = fmtinfo->code; in cal_legacy_enum_frameintervals()
381 ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_interval, in cal_legacy_enum_frameintervals()
385 fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; in cal_legacy_enum_frameintervals()
386 fival->discrete = fie.interval; in cal_legacy_enum_frameintervals()
395 return v4l2_g_parm_cap(video_devdata(file), ctx->phy->source, a); in cal_legacy_g_parm()
402 return v4l2_s_parm_cap(video_devdata(file), ctx->phy->source, a); in cal_legacy_s_parm()
432 /* ------------------------------------------------------------------
434 * ------------------------------------------------------------------
443 if (f->index >= cal_num_formats) in cal_mc_enum_fmt_vid_cap()
444 return -EINVAL; in cal_mc_enum_fmt_vid_cap()
449 if (f->mbus_code && cal_formats[i].code != f->mbus_code) in cal_mc_enum_fmt_vid_cap()
452 if (idx == f->index) { in cal_mc_enum_fmt_vid_cap()
453 f->pixelformat = cal_formats[i].fourcc; in cal_mc_enum_fmt_vid_cap()
454 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cal_mc_enum_fmt_vid_cap()
461 return -EINVAL; in cal_mc_enum_fmt_vid_cap()
467 struct v4l2_pix_format *format = &f->fmt.pix; in cal_mc_try_fmt()
472 * Default to the first format if the requested pixel format code isn't in cal_mc_try_fmt()
475 fmtinfo = cal_format_by_fourcc(f->fmt.pix.pixelformat); in cal_mc_try_fmt()
480 * Clamp the size, update the pixel format. The field and colorspace are in cal_mc_try_fmt()
481 * accepted as-is, except for V4L2_FIELD_ANY that is turned into in cal_mc_try_fmt()
484 bpp = ALIGN(fmtinfo->bpp, 8); in cal_mc_try_fmt()
486 format->width = clamp_t(unsigned int, format->width, in cal_mc_try_fmt()
489 format->height = clamp_t(unsigned int, format->height, in cal_mc_try_fmt()
491 format->pixelformat = fmtinfo->fourcc; in cal_mc_try_fmt()
493 if (format->field == V4L2_FIELD_ANY) in cal_mc_try_fmt()
494 format->field = V4L2_FIELD_NONE; in cal_mc_try_fmt()
499 * signed 15-bit value. Only 14 bits are thus usable. in cal_mc_try_fmt()
501 format->bytesperline = ALIGN(clamp(format->bytesperline, in cal_mc_try_fmt()
502 format->width * bpp / 8, in cal_mc_try_fmt()
503 ((1U << 14) - 1) * 16), 16); in cal_mc_try_fmt()
505 format->sizeimage = format->height * format->bytesperline; in cal_mc_try_fmt()
507 format->colorspace = ctx->v_fmt.fmt.pix.colorspace; in cal_mc_try_fmt()
513 __func__, fourcc_to_str(format->pixelformat), in cal_mc_try_fmt()
514 format->width, format->height, in cal_mc_try_fmt()
515 format->bytesperline, format->sizeimage); in cal_mc_try_fmt()
533 if (vb2_is_busy(&ctx->vb_vidq)) { in cal_mc_s_fmt_vid_cap()
535 return -EBUSY; in cal_mc_s_fmt_vid_cap()
540 ctx->v_fmt = *f; in cal_mc_s_fmt_vid_cap()
541 ctx->fmtinfo = fmtinfo; in cal_mc_s_fmt_vid_cap()
553 if (fsize->index > 0) in cal_mc_enum_framesizes()
554 return -EINVAL; in cal_mc_enum_framesizes()
556 fmtinfo = cal_format_by_fourcc(fsize->pixel_format); in cal_mc_enum_framesizes()
558 ctx_dbg(3, ctx, "Invalid pixel format 0x%08x\n", in cal_mc_enum_framesizes()
559 fsize->pixel_format); in cal_mc_enum_framesizes()
560 return -EINVAL; in cal_mc_enum_framesizes()
563 bpp = ALIGN(fmtinfo->bpp, 8); in cal_mc_enum_framesizes()
565 fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; in cal_mc_enum_framesizes()
566 fsize->stepwise.min_width = CAL_MIN_WIDTH_BYTES * 8 / bpp; in cal_mc_enum_framesizes()
567 fsize->stepwise.max_width = CAL_MAX_WIDTH_BYTES * 8 / bpp; in cal_mc_enum_framesizes()
568 fsize->stepwise.step_width = 64 / bpp; in cal_mc_enum_framesizes()
569 fsize->stepwise.min_height = CAL_MIN_HEIGHT_LINES; in cal_mc_enum_framesizes()
570 fsize->stepwise.max_height = CAL_MAX_HEIGHT_LINES; in cal_mc_enum_framesizes()
571 fsize->stepwise.step_height = 1; in cal_mc_enum_framesizes()
595 /* ------------------------------------------------------------------
597 * ------------------------------------------------------------------
605 unsigned int size = ctx->v_fmt.fmt.pix.sizeimage; in cal_queue_setup()
609 *nbuffers = 3 - q_num_bufs; in cal_queue_setup()
613 return -EINVAL; in cal_queue_setup()
627 struct cal_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in cal_buffer_prepare()
632 size = ctx->v_fmt.fmt.pix.sizeimage; in cal_buffer_prepare()
637 return -EINVAL; in cal_buffer_prepare()
640 vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size); in cal_buffer_prepare()
646 struct cal_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in cal_buffer_queue()
652 spin_lock_irqsave(&ctx->dma.lock, flags); in cal_buffer_queue()
653 list_add_tail(&buf->list, &ctx->dma.queue); in cal_buffer_queue()
654 spin_unlock_irqrestore(&ctx->dma.lock, flags); in cal_buffer_queue()
663 spin_lock_irq(&ctx->dma.lock); in cal_release_buffers()
665 list_for_each_entry_safe(buf, tmp, &ctx->dma.queue, list) { in cal_release_buffers()
666 list_del(&buf->list); in cal_release_buffers()
667 vb2_buffer_done(&buf->vb.vb2_buf, state); in cal_release_buffers()
670 if (ctx->dma.pending) { in cal_release_buffers()
671 vb2_buffer_done(&ctx->dma.pending->vb.vb2_buf, state); in cal_release_buffers()
672 ctx->dma.pending = NULL; in cal_release_buffers()
675 if (ctx->dma.active) { in cal_release_buffers()
676 vb2_buffer_done(&ctx->dma.active->vb.vb2_buf, state); in cal_release_buffers()
677 ctx->dma.active = NULL; in cal_release_buffers()
680 spin_unlock_irq(&ctx->dma.lock); in cal_release_buffers()
683 /* ------------------------------------------------------------------
685 * ------------------------------------------------------------------
695 remote_pad = media_pad_remote_pad_first(&ctx->pad); in cal_video_check_format()
697 return -ENODEV; in cal_video_check_format()
699 state = v4l2_subdev_lock_and_get_active_state(&ctx->phy->subdev); in cal_video_check_format()
701 format = v4l2_subdev_state_get_format(state, remote_pad->index); in cal_video_check_format()
703 ret = -EINVAL; in cal_video_check_format()
707 if (ctx->fmtinfo->code != format->code || in cal_video_check_format()
708 ctx->v_fmt.fmt.pix.height != format->height || in cal_video_check_format()
709 ctx->v_fmt.fmt.pix.width != format->width || in cal_video_check_format()
710 ctx->v_fmt.fmt.pix.field != format->field) { in cal_video_check_format()
711 ret = -EPIPE; in cal_video_check_format()
728 ret = video_device_pipeline_alloc_start(&ctx->vdev); in cal_start_streaming()
751 spin_lock_irq(&ctx->dma.lock); in cal_start_streaming()
752 buf = list_first_entry(&ctx->dma.queue, struct cal_buffer, list); in cal_start_streaming()
753 ctx->dma.active = buf; in cal_start_streaming()
754 list_del(&buf->list); in cal_start_streaming()
755 spin_unlock_irq(&ctx->dma.lock); in cal_start_streaming()
757 addr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); in cal_start_streaming()
759 ret = pm_runtime_resume_and_get(ctx->cal->dev); in cal_start_streaming()
766 ret = v4l2_subdev_call(&ctx->phy->subdev, video, s_stream, 1); in cal_start_streaming()
771 cal_quickdump_regs(ctx->cal); in cal_start_streaming()
777 pm_runtime_put_sync(ctx->cal->dev); in cal_start_streaming()
781 video_device_pipeline_stop(&ctx->vdev); in cal_start_streaming()
794 v4l2_subdev_call(&ctx->phy->subdev, video, s_stream, 0); in cal_stop_streaming()
796 pm_runtime_put_sync(ctx->cal->dev); in cal_stop_streaming()
802 video_device_pipeline_stop(&ctx->vdev); in cal_stop_streaming()
815 /* ------------------------------------------------------------------
817 * ------------------------------------------------------------------
837 ctx->active_fmt = devm_kcalloc(ctx->cal->dev, cal_num_formats, in cal_ctx_v4l2_init_formats()
838 sizeof(*ctx->active_fmt), GFP_KERNEL); in cal_ctx_v4l2_init_formats()
839 if (!ctx->active_fmt) in cal_ctx_v4l2_init_formats()
840 return -ENOMEM; in cal_ctx_v4l2_init_formats()
842 ctx->num_active_fmt = 0; in cal_ctx_v4l2_init_formats()
850 ret = v4l2_subdev_call(ctx->phy->source, pad, enum_mbus_code, in cal_ctx_v4l2_init_formats()
852 if (ret == -EINVAL) in cal_ctx_v4l2_init_formats()
857 ctx->phy->source->name, ret); in cal_ctx_v4l2_init_formats()
861 ctx_dbg(2, ctx, in cal_ctx_v4l2_init_formats()
863 ctx->phy->source->name, mbus_code.code, j); in cal_ctx_v4l2_init_formats()
868 if (mbus_code.code == fmtinfo->code) { in cal_ctx_v4l2_init_formats()
869 ctx->active_fmt[i] = fmtinfo; in cal_ctx_v4l2_init_formats()
870 ctx_dbg(2, ctx, in cal_ctx_v4l2_init_formats()
872 fourcc_to_str(fmtinfo->fourcc), in cal_ctx_v4l2_init_formats()
873 fmtinfo->code, i); in cal_ctx_v4l2_init_formats()
874 ctx->num_active_fmt = ++i; in cal_ctx_v4l2_init_formats()
881 ctx->phy->source->name); in cal_ctx_v4l2_init_formats()
882 return -EINVAL; in cal_ctx_v4l2_init_formats()
893 return -EINVAL; in cal_ctx_v4l2_init_formats()
897 v4l2_fill_pix_format(&ctx->v_fmt.fmt.pix, &mbus_fmt); in cal_ctx_v4l2_init_formats()
898 ctx->v_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cal_ctx_v4l2_init_formats()
899 ctx->v_fmt.fmt.pix.pixelformat = fmtinfo->fourcc; in cal_ctx_v4l2_init_formats()
900 cal_calc_format_size(ctx, fmtinfo, &ctx->v_fmt); in cal_ctx_v4l2_init_formats()
901 ctx->fmtinfo = fmtinfo; in cal_ctx_v4l2_init_formats()
909 struct v4l2_pix_format *pix_fmt = &ctx->v_fmt.fmt.pix; in cal_ctx_v4l2_init_mc_format()
913 return -EINVAL; in cal_ctx_v4l2_init_mc_format()
915 pix_fmt->width = 640; in cal_ctx_v4l2_init_mc_format()
916 pix_fmt->height = 480; in cal_ctx_v4l2_init_mc_format()
917 pix_fmt->field = V4L2_FIELD_NONE; in cal_ctx_v4l2_init_mc_format()
918 pix_fmt->colorspace = V4L2_COLORSPACE_SRGB; in cal_ctx_v4l2_init_mc_format()
919 pix_fmt->ycbcr_enc = V4L2_YCBCR_ENC_601; in cal_ctx_v4l2_init_mc_format()
920 pix_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE; in cal_ctx_v4l2_init_mc_format()
921 pix_fmt->xfer_func = V4L2_XFER_FUNC_SRGB; in cal_ctx_v4l2_init_mc_format()
922 pix_fmt->pixelformat = fmtinfo->fourcc; in cal_ctx_v4l2_init_mc_format()
924 ctx->v_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cal_ctx_v4l2_init_mc_format()
927 cal_calc_format_size(ctx, fmtinfo, &ctx->v_fmt); in cal_ctx_v4l2_init_mc_format()
928 ctx->fmtinfo = fmtinfo; in cal_ctx_v4l2_init_mc_format()
935 struct video_device *vfd = &ctx->vdev; in cal_ctx_v4l2_register()
939 struct v4l2_ctrl_handler *hdl = &ctx->ctrl_handler; in cal_ctx_v4l2_register()
947 ret = v4l2_ctrl_add_handler(hdl, ctx->phy->source->ctrl_handler, in cal_ctx_v4l2_register()
967 ret = media_create_pad_link(&ctx->phy->subdev.entity, in cal_ctx_v4l2_register()
969 &vfd->entity, 0, in cal_ctx_v4l2_register()
974 ctx->dma_ctx); in cal_ctx_v4l2_register()
988 video_device_node_name(&ctx->vdev)); in cal_ctx_v4l2_unregister()
990 video_unregister_device(&ctx->vdev); in cal_ctx_v4l2_unregister()
995 struct video_device *vfd = &ctx->vdev; in cal_ctx_v4l2_init()
996 struct vb2_queue *q = &ctx->vb_vidq; in cal_ctx_v4l2_init()
999 INIT_LIST_HEAD(&ctx->dma.queue); in cal_ctx_v4l2_init()
1000 spin_lock_init(&ctx->dma.lock); in cal_ctx_v4l2_init()
1001 mutex_init(&ctx->mutex); in cal_ctx_v4l2_init()
1002 init_waitqueue_head(&ctx->dma.wait); in cal_ctx_v4l2_init()
1005 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in cal_ctx_v4l2_init()
1006 q->io_modes = VB2_MMAP | VB2_DMABUF; in cal_ctx_v4l2_init()
1007 q->drv_priv = ctx; in cal_ctx_v4l2_init()
1008 q->buf_struct_size = sizeof(struct cal_buffer); in cal_ctx_v4l2_init()
1009 q->ops = &cal_video_qops; in cal_ctx_v4l2_init()
1010 q->mem_ops = &vb2_dma_contig_memops; in cal_ctx_v4l2_init()
1011 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; in cal_ctx_v4l2_init()
1012 q->lock = &ctx->mutex; in cal_ctx_v4l2_init()
1013 q->min_queued_buffers = 3; in cal_ctx_v4l2_init()
1014 q->dev = ctx->cal->dev; in cal_ctx_v4l2_init()
1021 vfd->fops = &cal_fops; in cal_ctx_v4l2_init()
1022 vfd->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING in cal_ctx_v4l2_init()
1024 vfd->v4l2_dev = &ctx->cal->v4l2_dev; in cal_ctx_v4l2_init()
1025 vfd->queue = q; in cal_ctx_v4l2_init()
1026 snprintf(vfd->name, sizeof(vfd->name), "CAL output %u", ctx->dma_ctx); in cal_ctx_v4l2_init()
1027 vfd->release = video_device_release_empty; in cal_ctx_v4l2_init()
1028 vfd->ioctl_ops = cal_mc_api ? &cal_ioctl_mc_ops : &cal_ioctl_legacy_ops; in cal_ctx_v4l2_init()
1029 vfd->lock = &ctx->mutex; in cal_ctx_v4l2_init()
1032 ctx->pad.flags = MEDIA_PAD_FL_SINK; in cal_ctx_v4l2_init()
1033 ret = media_entity_pads_init(&vfd->entity, 1, &ctx->pad); in cal_ctx_v4l2_init()
1039 struct v4l2_ctrl_handler *hdl = &ctx->ctrl_handler; in cal_ctx_v4l2_init()
1047 vfd->ctrl_handler = hdl; in cal_ctx_v4l2_init()
1053 media_entity_cleanup(&vfd->entity); in cal_ctx_v4l2_init()
1060 v4l2_ctrl_handler_free(&ctx->ctrl_handler); in cal_ctx_v4l2_cleanup()
1062 media_entity_cleanup(&ctx->vdev.entity); in cal_ctx_v4l2_cleanup()