Lines Matching refs:video
139 static unsigned int isp_video_mbus_to_pix(const struct isp_video *video, in isp_video_mbus_to_pix() argument
165 if (video->bpl_max) in isp_video_mbus_to_pix()
166 bpl = clamp(bpl, min_bpl, video->bpl_max); in isp_video_mbus_to_pix()
170 if (!video->bpl_zero_padding || bpl != min_bpl) in isp_video_mbus_to_pix()
171 bpl = ALIGN(bpl, video->bpl_alignment); in isp_video_mbus_to_pix()
205 isp_video_remote_subdev(struct isp_video *video, u32 *pad) in isp_video_remote_subdev() argument
209 remote = media_pad_remote_pad_first(&video->pad); in isp_video_remote_subdev()
221 static int isp_video_get_graph_data(struct isp_video *video, in isp_video_get_graph_data() argument
225 struct media_entity *entity = &video->video.entity; in isp_video_get_graph_data()
247 if (entity == &video->video.entity) in isp_video_get_graph_data()
254 if (__video->type != video->type) in isp_video_get_graph_data()
262 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in isp_video_get_graph_data()
264 pipe->output = video; in isp_video_get_graph_data()
269 pipe->input = video; in isp_video_get_graph_data()
277 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) in __isp_video_get_format() argument
284 subdev = isp_video_remote_subdev(video, &pad); in __isp_video_get_format()
291 mutex_lock(&video->mutex); in __isp_video_get_format()
293 mutex_unlock(&video->mutex); in __isp_video_get_format()
298 format->type = video->type; in __isp_video_get_format()
299 return isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in __isp_video_get_format()
303 isp_video_check_format(struct isp_video *video, struct isp_video_fh *vfh) in isp_video_check_format() argument
309 ret = __isp_video_get_format(video, &format); in isp_video_check_format()
333 struct isp_video *video = vfh->video; in isp_video_queue_setup() local
341 *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); in isp_video_queue_setup()
351 struct isp_video *video = vfh->video; in isp_video_buffer_prepare() local
360 if (unlikely(video->error)) in isp_video_buffer_prepare()
365 dev_dbg(video->isp->dev, in isp_video_buffer_prepare()
391 struct isp_video *video = vfh->video; in isp_video_buffer_queue() local
392 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_buffer_queue()
398 spin_lock_irqsave(&video->irqlock, flags); in isp_video_buffer_queue()
400 if (unlikely(video->error)) { in isp_video_buffer_queue()
402 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
406 empty = list_empty(&video->dmaqueue); in isp_video_buffer_queue()
407 list_add_tail(&buffer->irqlist, &video->dmaqueue); in isp_video_buffer_queue()
409 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
412 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_buffer_queue()
419 video->ops->queue(video, buffer); in isp_video_buffer_queue()
420 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in isp_video_buffer_queue()
444 static void omap3isp_video_return_buffers(struct isp_video *video, in omap3isp_video_return_buffers() argument
447 while (!list_empty(&video->dmaqueue)) { in omap3isp_video_return_buffers()
450 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_return_buffers()
461 struct isp_video *video = vfh->video; in isp_video_start_streaming() local
462 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_start_streaming()
476 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
477 omap3isp_video_return_buffers(video, VB2_BUF_STATE_QUEUED); in isp_video_start_streaming()
478 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
482 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
483 if (list_empty(&video->dmaqueue)) in isp_video_start_streaming()
484 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in isp_video_start_streaming()
485 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
513 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) in omap3isp_video_buffer_next() argument
515 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in omap3isp_video_buffer_next()
520 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
521 if (WARN_ON(list_empty(&video->dmaqueue))) { in omap3isp_video_buffer_next()
522 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
526 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
529 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
539 if (video == pipe->output && !pipe->do_propagation) in omap3isp_video_buffer_next()
551 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { in omap3isp_video_buffer_next()
560 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
562 if (list_empty(&video->dmaqueue)) { in omap3isp_video_buffer_next()
565 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
567 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_buffer_next()
576 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS) in omap3isp_video_buffer_next()
577 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_buffer_next()
582 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) { in omap3isp_video_buffer_next()
588 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
591 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
603 void omap3isp_video_cancel_stream(struct isp_video *video) in omap3isp_video_cancel_stream() argument
607 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_cancel_stream()
608 omap3isp_video_return_buffers(video, VB2_BUF_STATE_ERROR); in omap3isp_video_cancel_stream()
609 video->error = true; in omap3isp_video_cancel_stream()
610 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_cancel_stream()
623 void omap3isp_video_resume(struct isp_video *video, int continuous) in omap3isp_video_resume() argument
627 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in omap3isp_video_resume()
628 mutex_lock(&video->queue_lock); in omap3isp_video_resume()
629 vb2_discard_done(video->queue); in omap3isp_video_resume()
630 mutex_unlock(&video->queue_lock); in omap3isp_video_resume()
633 if (!list_empty(&video->dmaqueue)) { in omap3isp_video_resume()
634 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_resume()
636 video->ops->queue(video, buf); in omap3isp_video_resume()
637 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in omap3isp_video_resume()
640 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_resume()
651 struct isp_video *video = video_drvdata(file); in isp_video_querycap() local
654 strscpy(cap->card, video->video.name, sizeof(cap->card)); in isp_video_querycap()
668 struct isp_video *video = video_drvdata(file); in isp_video_get_format() local
670 if (format->type != video->type) in isp_video_get_format()
673 mutex_lock(&video->mutex); in isp_video_get_format()
675 mutex_unlock(&video->mutex); in isp_video_get_format()
684 struct isp_video *video = video_drvdata(file); in isp_video_set_format() local
687 if (format->type != video->type) in isp_video_set_format()
697 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_format()
710 if (video != &video->isp->isp_ccdc.video_out) in isp_video_set_format()
729 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix); in isp_video_set_format()
731 mutex_lock(&video->mutex); in isp_video_set_format()
733 mutex_unlock(&video->mutex); in isp_video_set_format()
741 struct isp_video *video = video_drvdata(file); in isp_video_try_format() local
747 if (format->type != video->type) in isp_video_try_format()
750 subdev = isp_video_remote_subdev(video, &pad); in isp_video_try_format()
762 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in isp_video_try_format()
769 struct isp_video *video = video_drvdata(file); in isp_video_get_selection() local
783 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_get_selection()
789 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_get_selection()
795 subdev = isp_video_remote_subdev(video, &pad); in isp_video_get_selection()
826 struct isp_video *video = video_drvdata(file); in isp_video_set_selection() local
839 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_selection()
843 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_set_selection()
849 subdev = isp_video_remote_subdev(video, &pad); in isp_video_set_selection()
854 mutex_lock(&video->mutex); in isp_video_set_selection()
856 mutex_unlock(&video->mutex); in isp_video_set_selection()
867 struct isp_video *video = video_drvdata(file); in isp_video_get_param() local
869 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_get_param()
870 video->type != a->type) in isp_video_get_param()
885 struct isp_video *video = video_drvdata(file); in isp_video_set_param() local
887 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_set_param()
888 video->type != a->type) in isp_video_set_param()
903 struct isp_video *video = video_drvdata(file); in isp_video_reqbufs() local
906 mutex_lock(&video->queue_lock); in isp_video_reqbufs()
908 mutex_unlock(&video->queue_lock); in isp_video_reqbufs()
917 struct isp_video *video = video_drvdata(file); in isp_video_querybuf() local
920 mutex_lock(&video->queue_lock); in isp_video_querybuf()
922 mutex_unlock(&video->queue_lock); in isp_video_querybuf()
931 struct isp_video *video = video_drvdata(file); in isp_video_qbuf() local
934 mutex_lock(&video->queue_lock); in isp_video_qbuf()
935 ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b); in isp_video_qbuf()
936 mutex_unlock(&video->queue_lock); in isp_video_qbuf()
945 struct isp_video *video = video_drvdata(file); in isp_video_dqbuf() local
948 mutex_lock(&video->queue_lock); in isp_video_dqbuf()
950 mutex_unlock(&video->queue_lock); in isp_video_dqbuf()
955 static int isp_video_check_external_subdevs(struct isp_video *video, in isp_video_check_external_subdevs() argument
958 struct isp_device *isp = video->isp; in isp_video_check_external_subdevs()
1022 ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video, in isp_video_check_external_subdevs()
1082 struct isp_video *video = video_drvdata(file); in isp_video_streamon() local
1088 if (type != video->type) in isp_video_streamon()
1091 mutex_lock(&video->stream_lock); in isp_video_streamon()
1096 pipe = to_isp_pipeline(&video->video.entity) ? : &video->pipe; in isp_video_streamon()
1098 ret = media_entity_enum_init(&pipe->ent_enum, &video->isp->media_dev); in isp_video_streamon()
1103 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); in isp_video_streamon()
1106 ret = video_device_pipeline_start(&video->video, &pipe->pipe); in isp_video_streamon()
1113 ret = isp_video_check_format(video, vfh); in isp_video_streamon()
1117 video->bpl_padding = ret; in isp_video_streamon()
1118 video->bpl_value = vfh->format.fmt.pix.bytesperline; in isp_video_streamon()
1120 ret = isp_video_get_graph_data(video, pipe); in isp_video_streamon()
1124 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamon()
1129 ret = isp_video_check_external_subdevs(video, pipe); in isp_video_streamon()
1144 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_streamon()
1147 video->queue = &vfh->queue; in isp_video_streamon()
1148 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1152 mutex_lock(&video->queue_lock); in isp_video_streamon()
1154 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1158 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1163 video_device_pipeline_stop(&video->video); in isp_video_streamon()
1173 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1174 video->queue = NULL; in isp_video_streamon()
1179 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1188 struct isp_video *video = video_drvdata(file); in isp_video_streamoff() local
1189 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_streamoff()
1194 if (type != video->type) in isp_video_streamoff()
1197 mutex_lock(&video->stream_lock); in isp_video_streamoff()
1200 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1202 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1208 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamoff()
1221 omap3isp_video_cancel_stream(video); in isp_video_streamoff()
1223 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1225 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1226 video->queue = NULL; in isp_video_streamoff()
1227 video->error = false; in isp_video_streamoff()
1230 video_device_pipeline_stop(&video->video); in isp_video_streamoff()
1235 mutex_unlock(&video->stream_lock); in isp_video_streamoff()
1294 struct isp_video *video = video_drvdata(file); in isp_video_open() local
1303 v4l2_fh_init(&handle->vfh, &video->video); in isp_video_open()
1307 if (omap3isp_get(video->isp) == NULL) { in isp_video_open()
1312 ret = v4l2_pipeline_pm_get(&video->video.entity); in isp_video_open()
1314 omap3isp_put(video->isp); in isp_video_open()
1319 queue->type = video->type; in isp_video_open()
1326 queue->dev = video->isp->dev; in isp_video_open()
1330 omap3isp_put(video->isp); in isp_video_open()
1335 handle->format.type = video->type; in isp_video_open()
1338 handle->video = video; in isp_video_open()
1353 struct isp_video *video = video_drvdata(file); in isp_video_release() local
1358 isp_video_streamoff(file, vfh, video->type); in isp_video_release()
1360 mutex_lock(&video->queue_lock); in isp_video_release()
1362 mutex_unlock(&video->queue_lock); in isp_video_release()
1364 v4l2_pipeline_pm_put(&video->video.entity); in isp_video_release()
1372 omap3isp_put(video->isp); in isp_video_release()
1380 struct isp_video *video = video_drvdata(file); in isp_video_poll() local
1383 mutex_lock(&video->queue_lock); in isp_video_poll()
1385 mutex_unlock(&video->queue_lock); in isp_video_poll()
1413 int omap3isp_video_init(struct isp_video *video, const char *name) in omap3isp_video_init() argument
1418 switch (video->type) { in omap3isp_video_init()
1421 video->pad.flags = MEDIA_PAD_FL_SINK in omap3isp_video_init()
1426 video->pad.flags = MEDIA_PAD_FL_SOURCE in omap3isp_video_init()
1428 video->video.vfl_dir = VFL_DIR_TX; in omap3isp_video_init()
1435 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in omap3isp_video_init()
1439 mutex_init(&video->mutex); in omap3isp_video_init()
1440 atomic_set(&video->active, 0); in omap3isp_video_init()
1442 spin_lock_init(&video->pipe.lock); in omap3isp_video_init()
1443 mutex_init(&video->stream_lock); in omap3isp_video_init()
1444 mutex_init(&video->queue_lock); in omap3isp_video_init()
1445 spin_lock_init(&video->irqlock); in omap3isp_video_init()
1448 if (video->ops == NULL) in omap3isp_video_init()
1449 video->ops = &isp_video_dummy_ops; in omap3isp_video_init()
1451 video->video.fops = &isp_video_fops; in omap3isp_video_init()
1452 snprintf(video->video.name, sizeof(video->video.name), in omap3isp_video_init()
1454 video->video.vfl_type = VFL_TYPE_VIDEO; in omap3isp_video_init()
1455 video->video.release = video_device_release_empty; in omap3isp_video_init()
1456 video->video.ioctl_ops = &isp_video_ioctl_ops; in omap3isp_video_init()
1457 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_init()
1458 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE in omap3isp_video_init()
1461 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT in omap3isp_video_init()
1464 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; in omap3isp_video_init()
1466 video_set_drvdata(&video->video, video); in omap3isp_video_init()
1471 void omap3isp_video_cleanup(struct isp_video *video) in omap3isp_video_cleanup() argument
1473 media_entity_cleanup(&video->video.entity); in omap3isp_video_cleanup()
1474 mutex_destroy(&video->queue_lock); in omap3isp_video_cleanup()
1475 mutex_destroy(&video->stream_lock); in omap3isp_video_cleanup()
1476 mutex_destroy(&video->mutex); in omap3isp_video_cleanup()
1479 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) in omap3isp_video_register() argument
1483 video->video.v4l2_dev = vdev; in omap3isp_video_register()
1485 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); in omap3isp_video_register()
1487 dev_err(video->isp->dev, in omap3isp_video_register()
1494 void omap3isp_video_unregister(struct isp_video *video) in omap3isp_video_unregister() argument
1496 video_unregister_device(&video->video); in omap3isp_video_unregister()