Lines Matching refs:video
141 static unsigned int isp_video_mbus_to_pix(const struct isp_video *video, in isp_video_mbus_to_pix() argument
167 if (video->bpl_max) in isp_video_mbus_to_pix()
168 bpl = clamp(bpl, min_bpl, video->bpl_max); in isp_video_mbus_to_pix()
172 if (!video->bpl_zero_padding || bpl != min_bpl) in isp_video_mbus_to_pix()
173 bpl = ALIGN(bpl, video->bpl_alignment); in isp_video_mbus_to_pix()
207 isp_video_remote_subdev(struct isp_video *video, u32 *pad) in isp_video_remote_subdev() argument
211 remote = media_entity_remote_pad(&video->pad); in isp_video_remote_subdev()
224 static int isp_video_get_graph_data(struct isp_video *video, in isp_video_get_graph_data() argument
228 struct media_entity *entity = &video->video.entity; in isp_video_get_graph_data()
243 if (entity == &video->video.entity) in isp_video_get_graph_data()
250 if (__video->type != video->type) in isp_video_get_graph_data()
256 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in isp_video_get_graph_data()
258 pipe->output = video; in isp_video_get_graph_data()
263 pipe->input = video; in isp_video_get_graph_data()
271 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) in __isp_video_get_format() argument
278 subdev = isp_video_remote_subdev(video, &pad); in __isp_video_get_format()
285 mutex_lock(&video->mutex); in __isp_video_get_format()
287 mutex_unlock(&video->mutex); in __isp_video_get_format()
292 format->type = video->type; in __isp_video_get_format()
293 return isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in __isp_video_get_format()
297 isp_video_check_format(struct isp_video *video, struct isp_video_fh *vfh) in isp_video_check_format() argument
303 ret = __isp_video_get_format(video, &format); in isp_video_check_format()
328 struct isp_video *video = vfh->video; in isp_video_queue_setup() local
336 alloc_ctxs[0] = video->alloc_ctx; in isp_video_queue_setup()
338 *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); in isp_video_queue_setup()
347 struct isp_video *video = vfh->video; in isp_video_buffer_prepare() local
356 if (unlikely(video->error)) in isp_video_buffer_prepare()
361 dev_dbg(video->isp->dev, in isp_video_buffer_prepare()
385 struct isp_video *video = vfh->video; in isp_video_buffer_queue() local
386 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_buffer_queue()
392 spin_lock_irqsave(&video->irqlock, flags); in isp_video_buffer_queue()
394 if (unlikely(video->error)) { in isp_video_buffer_queue()
396 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
400 empty = list_empty(&video->dmaqueue); in isp_video_buffer_queue()
401 list_add_tail(&buffer->irqlist, &video->dmaqueue); in isp_video_buffer_queue()
403 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
406 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_buffer_queue()
413 video->ops->queue(video, buffer); in isp_video_buffer_queue()
414 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in isp_video_buffer_queue()
449 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) in omap3isp_video_buffer_next() argument
451 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in omap3isp_video_buffer_next()
456 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
457 if (WARN_ON(list_empty(&video->dmaqueue))) { in omap3isp_video_buffer_next()
458 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
462 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
465 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
475 if (video == pipe->output && !pipe->do_propagation) in omap3isp_video_buffer_next()
487 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { in omap3isp_video_buffer_next()
496 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
498 if (list_empty(&video->dmaqueue)) { in omap3isp_video_buffer_next()
499 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
501 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_buffer_next()
510 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS) in omap3isp_video_buffer_next()
511 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_buffer_next()
516 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) { in omap3isp_video_buffer_next()
522 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
525 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
537 void omap3isp_video_cancel_stream(struct isp_video *video) in omap3isp_video_cancel_stream() argument
541 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_cancel_stream()
543 while (!list_empty(&video->dmaqueue)) { in omap3isp_video_cancel_stream()
546 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_cancel_stream()
552 video->error = true; in omap3isp_video_cancel_stream()
554 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_cancel_stream()
567 void omap3isp_video_resume(struct isp_video *video, int continuous) in omap3isp_video_resume() argument
571 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in omap3isp_video_resume()
572 mutex_lock(&video->queue_lock); in omap3isp_video_resume()
573 vb2_discard_done(video->queue); in omap3isp_video_resume()
574 mutex_unlock(&video->queue_lock); in omap3isp_video_resume()
577 if (!list_empty(&video->dmaqueue)) { in omap3isp_video_resume()
578 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_resume()
580 video->ops->queue(video, buf); in omap3isp_video_resume()
581 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in omap3isp_video_resume()
584 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_resume()
595 struct isp_video *video = video_drvdata(file); in isp_video_querycap() local
598 strlcpy(cap->card, video->video.name, sizeof(cap->card)); in isp_video_querycap()
604 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_querycap()
616 struct isp_video *video = video_drvdata(file); in isp_video_get_format() local
618 if (format->type != video->type) in isp_video_get_format()
621 mutex_lock(&video->mutex); in isp_video_get_format()
623 mutex_unlock(&video->mutex); in isp_video_get_format()
632 struct isp_video *video = video_drvdata(file); in isp_video_set_format() local
635 if (format->type != video->type) in isp_video_set_format()
645 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_format()
658 if (video != &video->isp->isp_ccdc.video_out) in isp_video_set_format()
677 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix); in isp_video_set_format()
679 mutex_lock(&video->mutex); in isp_video_set_format()
681 mutex_unlock(&video->mutex); in isp_video_set_format()
689 struct isp_video *video = video_drvdata(file); in isp_video_try_format() local
695 if (format->type != video->type) in isp_video_try_format()
698 subdev = isp_video_remote_subdev(video, &pad); in isp_video_try_format()
710 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in isp_video_try_format()
717 struct isp_video *video = video_drvdata(file); in isp_video_cropcap() local
721 subdev = isp_video_remote_subdev(video, NULL); in isp_video_cropcap()
725 mutex_lock(&video->mutex); in isp_video_cropcap()
726 ret = v4l2_subdev_call(subdev, video, cropcap, cropcap); in isp_video_cropcap()
727 mutex_unlock(&video->mutex); in isp_video_cropcap()
735 struct isp_video *video = video_drvdata(file); in isp_video_get_crop() local
741 subdev = isp_video_remote_subdev(video, &pad); in isp_video_get_crop()
748 ret = v4l2_subdev_call(subdev, video, g_crop, crop); in isp_video_get_crop()
769 struct isp_video *video = video_drvdata(file); in isp_video_set_crop() local
773 subdev = isp_video_remote_subdev(video, NULL); in isp_video_set_crop()
777 mutex_lock(&video->mutex); in isp_video_set_crop()
778 ret = v4l2_subdev_call(subdev, video, s_crop, crop); in isp_video_set_crop()
779 mutex_unlock(&video->mutex); in isp_video_set_crop()
788 struct isp_video *video = video_drvdata(file); in isp_video_get_param() local
790 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_get_param()
791 video->type != a->type) in isp_video_get_param()
806 struct isp_video *video = video_drvdata(file); in isp_video_set_param() local
808 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_set_param()
809 video->type != a->type) in isp_video_set_param()
824 struct isp_video *video = video_drvdata(file); in isp_video_reqbufs() local
827 mutex_lock(&video->queue_lock); in isp_video_reqbufs()
829 mutex_unlock(&video->queue_lock); in isp_video_reqbufs()
838 struct isp_video *video = video_drvdata(file); in isp_video_querybuf() local
841 mutex_lock(&video->queue_lock); in isp_video_querybuf()
843 mutex_unlock(&video->queue_lock); in isp_video_querybuf()
852 struct isp_video *video = video_drvdata(file); in isp_video_qbuf() local
855 mutex_lock(&video->queue_lock); in isp_video_qbuf()
857 mutex_unlock(&video->queue_lock); in isp_video_qbuf()
866 struct isp_video *video = video_drvdata(file); in isp_video_dqbuf() local
869 mutex_lock(&video->queue_lock); in isp_video_dqbuf()
871 mutex_unlock(&video->queue_lock); in isp_video_dqbuf()
876 static int isp_video_check_external_subdevs(struct isp_video *video, in isp_video_check_external_subdevs() argument
879 struct isp_device *isp = video->isp; in isp_video_check_external_subdevs()
1002 struct isp_video *video = video_drvdata(file); in isp_video_streamon() local
1008 if (type != video->type) in isp_video_streamon()
1011 mutex_lock(&video->stream_lock); in isp_video_streamon()
1016 pipe = video->video.entity.pipe in isp_video_streamon()
1017 ? to_isp_pipeline(&video->video.entity) : &video->pipe; in isp_video_streamon()
1021 if (video->isp->pdata && video->isp->pdata->set_constraints) in isp_video_streamon()
1022 video->isp->pdata->set_constraints(video->isp, true); in isp_video_streamon()
1023 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); in isp_video_streamon()
1026 ret = media_entity_pipeline_start(&video->video.entity, &pipe->pipe); in isp_video_streamon()
1033 ret = isp_video_check_format(video, vfh); in isp_video_streamon()
1037 video->bpl_padding = ret; in isp_video_streamon()
1038 video->bpl_value = vfh->format.fmt.pix.bytesperline; in isp_video_streamon()
1040 ret = isp_video_get_graph_data(video, pipe); in isp_video_streamon()
1044 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamon()
1049 ret = isp_video_check_external_subdevs(video, pipe); in isp_video_streamon()
1064 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_streamon()
1067 video->queue = &vfh->queue; in isp_video_streamon()
1068 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1072 mutex_lock(&video->queue_lock); in isp_video_streamon()
1074 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1087 spin_lock_irqsave(&video->irqlock, flags); in isp_video_streamon()
1088 if (list_empty(&video->dmaqueue)) in isp_video_streamon()
1089 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in isp_video_streamon()
1090 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_streamon()
1093 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1097 mutex_lock(&video->queue_lock); in isp_video_streamon()
1099 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1101 media_entity_pipeline_stop(&video->video.entity); in isp_video_streamon()
1103 if (video->isp->pdata && video->isp->pdata->set_constraints) in isp_video_streamon()
1104 video->isp->pdata->set_constraints(video->isp, false); in isp_video_streamon()
1112 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1113 video->queue = NULL; in isp_video_streamon()
1115 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1123 struct isp_video *video = video_drvdata(file); in isp_video_streamoff() local
1124 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_streamoff()
1129 if (type != video->type) in isp_video_streamoff()
1132 mutex_lock(&video->stream_lock); in isp_video_streamoff()
1135 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1137 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1143 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamoff()
1156 omap3isp_video_cancel_stream(video); in isp_video_streamoff()
1158 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1160 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1161 video->queue = NULL; in isp_video_streamoff()
1162 video->error = false; in isp_video_streamoff()
1164 if (video->isp->pdata && video->isp->pdata->set_constraints) in isp_video_streamoff()
1165 video->isp->pdata->set_constraints(video->isp, false); in isp_video_streamoff()
1166 media_entity_pipeline_stop(&video->video.entity); in isp_video_streamoff()
1169 mutex_unlock(&video->stream_lock); in isp_video_streamoff()
1229 struct isp_video *video = video_drvdata(file); in isp_video_open() local
1238 v4l2_fh_init(&handle->vfh, &video->video); in isp_video_open()
1242 if (omap3isp_get(video->isp) == NULL) { in isp_video_open()
1247 ret = omap3isp_pipeline_pm_use(&video->video.entity, 1); in isp_video_open()
1249 omap3isp_put(video->isp); in isp_video_open()
1254 queue->type = video->type; in isp_video_open()
1264 omap3isp_put(video->isp); in isp_video_open()
1269 handle->format.type = video->type; in isp_video_open()
1272 handle->video = video; in isp_video_open()
1286 struct isp_video *video = video_drvdata(file); in isp_video_release() local
1291 isp_video_streamoff(file, vfh, video->type); in isp_video_release()
1293 mutex_lock(&video->queue_lock); in isp_video_release()
1295 mutex_unlock(&video->queue_lock); in isp_video_release()
1297 omap3isp_pipeline_pm_use(&video->video.entity, 0); in isp_video_release()
1304 omap3isp_put(video->isp); in isp_video_release()
1312 struct isp_video *video = video_drvdata(file); in isp_video_poll() local
1315 mutex_lock(&video->queue_lock); in isp_video_poll()
1317 mutex_unlock(&video->queue_lock); in isp_video_poll()
1345 int omap3isp_video_init(struct isp_video *video, const char *name) in omap3isp_video_init() argument
1350 switch (video->type) { in omap3isp_video_init()
1353 video->pad.flags = MEDIA_PAD_FL_SINK in omap3isp_video_init()
1358 video->pad.flags = MEDIA_PAD_FL_SOURCE in omap3isp_video_init()
1360 video->video.vfl_dir = VFL_DIR_TX; in omap3isp_video_init()
1367 video->alloc_ctx = vb2_dma_contig_init_ctx(video->isp->dev); in omap3isp_video_init()
1368 if (IS_ERR(video->alloc_ctx)) in omap3isp_video_init()
1369 return PTR_ERR(video->alloc_ctx); in omap3isp_video_init()
1371 ret = media_entity_init(&video->video.entity, 1, &video->pad, 0); in omap3isp_video_init()
1373 vb2_dma_contig_cleanup_ctx(video->alloc_ctx); in omap3isp_video_init()
1377 mutex_init(&video->mutex); in omap3isp_video_init()
1378 atomic_set(&video->active, 0); in omap3isp_video_init()
1380 spin_lock_init(&video->pipe.lock); in omap3isp_video_init()
1381 mutex_init(&video->stream_lock); in omap3isp_video_init()
1382 mutex_init(&video->queue_lock); in omap3isp_video_init()
1383 spin_lock_init(&video->irqlock); in omap3isp_video_init()
1386 if (video->ops == NULL) in omap3isp_video_init()
1387 video->ops = &isp_video_dummy_ops; in omap3isp_video_init()
1389 video->video.fops = &isp_video_fops; in omap3isp_video_init()
1390 snprintf(video->video.name, sizeof(video->video.name), in omap3isp_video_init()
1392 video->video.vfl_type = VFL_TYPE_GRABBER; in omap3isp_video_init()
1393 video->video.release = video_device_release_empty; in omap3isp_video_init()
1394 video->video.ioctl_ops = &isp_video_ioctl_ops; in omap3isp_video_init()
1395 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; in omap3isp_video_init()
1397 video_set_drvdata(&video->video, video); in omap3isp_video_init()
1402 void omap3isp_video_cleanup(struct isp_video *video) in omap3isp_video_cleanup() argument
1404 vb2_dma_contig_cleanup_ctx(video->alloc_ctx); in omap3isp_video_cleanup()
1405 media_entity_cleanup(&video->video.entity); in omap3isp_video_cleanup()
1406 mutex_destroy(&video->queue_lock); in omap3isp_video_cleanup()
1407 mutex_destroy(&video->stream_lock); in omap3isp_video_cleanup()
1408 mutex_destroy(&video->mutex); in omap3isp_video_cleanup()
1411 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) in omap3isp_video_register() argument
1415 video->video.v4l2_dev = vdev; in omap3isp_video_register()
1417 ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); in omap3isp_video_register()
1419 dev_err(video->isp->dev, in omap3isp_video_register()
1426 void omap3isp_video_unregister(struct isp_video *video) in omap3isp_video_unregister() argument
1428 if (video_is_registered(&video->video)) in omap3isp_video_unregister()
1429 video_unregister_device(&video->video); in omap3isp_video_unregister()