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
241 if (entity == &video->video.entity) in isp_video_get_graph_data()
248 if (__video->type != video->type) in isp_video_get_graph_data()
254 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in isp_video_get_graph_data()
256 pipe->output = video; in isp_video_get_graph_data()
261 pipe->input = video; in isp_video_get_graph_data()
269 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) in __isp_video_get_format() argument
276 subdev = isp_video_remote_subdev(video, &pad); in __isp_video_get_format()
283 mutex_lock(&video->mutex); in __isp_video_get_format()
285 mutex_unlock(&video->mutex); in __isp_video_get_format()
290 format->type = video->type; in __isp_video_get_format()
291 return isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in __isp_video_get_format()
295 isp_video_check_format(struct isp_video *video, struct isp_video_fh *vfh) in isp_video_check_format() argument
301 ret = __isp_video_get_format(video, &format); in isp_video_check_format()
325 struct isp_video *video = vfh->video; in isp_video_queue_setup() local
333 *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); in isp_video_queue_setup()
343 struct isp_video *video = vfh->video; in isp_video_buffer_prepare() local
352 if (unlikely(video->error)) in isp_video_buffer_prepare()
357 dev_dbg(video->isp->dev, in isp_video_buffer_prepare()
383 struct isp_video *video = vfh->video; in isp_video_buffer_queue() local
384 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_buffer_queue()
390 spin_lock_irqsave(&video->irqlock, flags); in isp_video_buffer_queue()
392 if (unlikely(video->error)) { in isp_video_buffer_queue()
394 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
398 empty = list_empty(&video->dmaqueue); in isp_video_buffer_queue()
399 list_add_tail(&buffer->irqlist, &video->dmaqueue); in isp_video_buffer_queue()
401 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
404 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_buffer_queue()
411 video->ops->queue(video, buffer); in isp_video_buffer_queue()
412 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in isp_video_buffer_queue()
436 static void omap3isp_video_return_buffers(struct isp_video *video, in omap3isp_video_return_buffers() argument
439 while (!list_empty(&video->dmaqueue)) { in omap3isp_video_return_buffers()
442 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_return_buffers()
453 struct isp_video *video = vfh->video; in isp_video_start_streaming() local
454 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_start_streaming()
468 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
469 omap3isp_video_return_buffers(video, VB2_BUF_STATE_QUEUED); in isp_video_start_streaming()
470 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
474 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
475 if (list_empty(&video->dmaqueue)) in isp_video_start_streaming()
476 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in isp_video_start_streaming()
477 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
505 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) in omap3isp_video_buffer_next() argument
507 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in omap3isp_video_buffer_next()
512 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
513 if (WARN_ON(list_empty(&video->dmaqueue))) { in omap3isp_video_buffer_next()
514 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
518 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
521 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
531 if (video == pipe->output && !pipe->do_propagation) in omap3isp_video_buffer_next()
543 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { in omap3isp_video_buffer_next()
552 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
554 if (list_empty(&video->dmaqueue)) { in omap3isp_video_buffer_next()
557 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
559 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_buffer_next()
568 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS) in omap3isp_video_buffer_next()
569 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_buffer_next()
574 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) { in omap3isp_video_buffer_next()
580 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
583 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
595 void omap3isp_video_cancel_stream(struct isp_video *video) in omap3isp_video_cancel_stream() argument
599 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_cancel_stream()
600 omap3isp_video_return_buffers(video, VB2_BUF_STATE_ERROR); in omap3isp_video_cancel_stream()
601 video->error = true; in omap3isp_video_cancel_stream()
602 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_cancel_stream()
615 void omap3isp_video_resume(struct isp_video *video, int continuous) in omap3isp_video_resume() argument
619 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in omap3isp_video_resume()
620 mutex_lock(&video->queue_lock); in omap3isp_video_resume()
621 vb2_discard_done(video->queue); in omap3isp_video_resume()
622 mutex_unlock(&video->queue_lock); in omap3isp_video_resume()
625 if (!list_empty(&video->dmaqueue)) { in omap3isp_video_resume()
626 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_resume()
628 video->ops->queue(video, buf); in omap3isp_video_resume()
629 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in omap3isp_video_resume()
632 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_resume()
643 struct isp_video *video = video_drvdata(file); in isp_video_querycap() local
646 strscpy(cap->card, video->video.name, sizeof(cap->card)); in isp_video_querycap()
660 struct isp_video *video = video_drvdata(file); in isp_video_get_format() local
662 if (format->type != video->type) in isp_video_get_format()
665 mutex_lock(&video->mutex); in isp_video_get_format()
667 mutex_unlock(&video->mutex); in isp_video_get_format()
676 struct isp_video *video = video_drvdata(file); in isp_video_set_format() local
679 if (format->type != video->type) in isp_video_set_format()
689 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_format()
702 if (video != &video->isp->isp_ccdc.video_out) in isp_video_set_format()
721 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix); in isp_video_set_format()
723 mutex_lock(&video->mutex); in isp_video_set_format()
725 mutex_unlock(&video->mutex); in isp_video_set_format()
733 struct isp_video *video = video_drvdata(file); in isp_video_try_format() local
739 if (format->type != video->type) in isp_video_try_format()
742 subdev = isp_video_remote_subdev(video, &pad); in isp_video_try_format()
754 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in isp_video_try_format()
761 struct isp_video *video = video_drvdata(file); in isp_video_get_selection() local
775 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_get_selection()
781 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_get_selection()
787 subdev = isp_video_remote_subdev(video, &pad); in isp_video_get_selection()
818 struct isp_video *video = video_drvdata(file); in isp_video_set_selection() local
831 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_selection()
835 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_set_selection()
841 subdev = isp_video_remote_subdev(video, &pad); in isp_video_set_selection()
846 mutex_lock(&video->mutex); in isp_video_set_selection()
848 mutex_unlock(&video->mutex); in isp_video_set_selection()
859 struct isp_video *video = video_drvdata(file); in isp_video_get_param() local
861 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_get_param()
862 video->type != a->type) in isp_video_get_param()
877 struct isp_video *video = video_drvdata(file); in isp_video_set_param() local
879 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_set_param()
880 video->type != a->type) in isp_video_set_param()
895 struct isp_video *video = video_drvdata(file); in isp_video_reqbufs() local
898 mutex_lock(&video->queue_lock); in isp_video_reqbufs()
900 mutex_unlock(&video->queue_lock); in isp_video_reqbufs()
909 struct isp_video *video = video_drvdata(file); in isp_video_querybuf() local
912 mutex_lock(&video->queue_lock); in isp_video_querybuf()
914 mutex_unlock(&video->queue_lock); in isp_video_querybuf()
923 struct isp_video *video = video_drvdata(file); in isp_video_qbuf() local
926 mutex_lock(&video->queue_lock); in isp_video_qbuf()
927 ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b); in isp_video_qbuf()
928 mutex_unlock(&video->queue_lock); in isp_video_qbuf()
937 struct isp_video *video = video_drvdata(file); in isp_video_dqbuf() local
940 mutex_lock(&video->queue_lock); in isp_video_dqbuf()
942 mutex_unlock(&video->queue_lock); in isp_video_dqbuf()
947 static int isp_video_check_external_subdevs(struct isp_video *video, in isp_video_check_external_subdevs() argument
950 struct isp_device *isp = video->isp; in isp_video_check_external_subdevs()
1014 ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video, in isp_video_check_external_subdevs()
1074 struct isp_video *video = video_drvdata(file); in isp_video_streamon() local
1080 if (type != video->type) in isp_video_streamon()
1083 mutex_lock(&video->stream_lock); in isp_video_streamon()
1088 pipe = to_isp_pipeline(&video->video.entity) ? : &video->pipe; in isp_video_streamon()
1090 ret = media_entity_enum_init(&pipe->ent_enum, &video->isp->media_dev); in isp_video_streamon()
1095 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); in isp_video_streamon()
1098 ret = video_device_pipeline_start(&video->video, &pipe->pipe); in isp_video_streamon()
1105 ret = isp_video_check_format(video, vfh); in isp_video_streamon()
1109 video->bpl_padding = ret; in isp_video_streamon()
1110 video->bpl_value = vfh->format.fmt.pix.bytesperline; in isp_video_streamon()
1112 ret = isp_video_get_graph_data(video, pipe); in isp_video_streamon()
1116 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamon()
1121 ret = isp_video_check_external_subdevs(video, pipe); in isp_video_streamon()
1136 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_streamon()
1139 video->queue = &vfh->queue; in isp_video_streamon()
1140 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1144 mutex_lock(&video->queue_lock); in isp_video_streamon()
1146 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1150 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1155 video_device_pipeline_stop(&video->video); in isp_video_streamon()
1165 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1166 video->queue = NULL; in isp_video_streamon()
1171 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1180 struct isp_video *video = video_drvdata(file); in isp_video_streamoff() local
1181 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_streamoff()
1186 if (type != video->type) in isp_video_streamoff()
1189 mutex_lock(&video->stream_lock); in isp_video_streamoff()
1192 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1194 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1200 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamoff()
1213 omap3isp_video_cancel_stream(video); in isp_video_streamoff()
1215 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1217 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1218 video->queue = NULL; in isp_video_streamoff()
1219 video->error = false; in isp_video_streamoff()
1222 video_device_pipeline_stop(&video->video); in isp_video_streamoff()
1227 mutex_unlock(&video->stream_lock); in isp_video_streamoff()
1286 struct isp_video *video = video_drvdata(file); in isp_video_open() local
1295 v4l2_fh_init(&handle->vfh, &video->video); in isp_video_open()
1299 if (omap3isp_get(video->isp) == NULL) { in isp_video_open()
1304 ret = v4l2_pipeline_pm_get(&video->video.entity); in isp_video_open()
1306 omap3isp_put(video->isp); in isp_video_open()
1311 queue->type = video->type; in isp_video_open()
1318 queue->dev = video->isp->dev; in isp_video_open()
1322 omap3isp_put(video->isp); in isp_video_open()
1327 handle->format.type = video->type; in isp_video_open()
1330 handle->video = video; in isp_video_open()
1345 struct isp_video *video = video_drvdata(file); in isp_video_release() local
1350 isp_video_streamoff(file, vfh, video->type); in isp_video_release()
1352 mutex_lock(&video->queue_lock); in isp_video_release()
1354 mutex_unlock(&video->queue_lock); in isp_video_release()
1356 v4l2_pipeline_pm_put(&video->video.entity); in isp_video_release()
1364 omap3isp_put(video->isp); in isp_video_release()
1372 struct isp_video *video = video_drvdata(file); in isp_video_poll() local
1375 mutex_lock(&video->queue_lock); in isp_video_poll()
1377 mutex_unlock(&video->queue_lock); in isp_video_poll()
1405 int omap3isp_video_init(struct isp_video *video, const char *name) in omap3isp_video_init() argument
1410 switch (video->type) { in omap3isp_video_init()
1413 video->pad.flags = MEDIA_PAD_FL_SINK in omap3isp_video_init()
1418 video->pad.flags = MEDIA_PAD_FL_SOURCE in omap3isp_video_init()
1420 video->video.vfl_dir = VFL_DIR_TX; in omap3isp_video_init()
1427 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in omap3isp_video_init()
1431 mutex_init(&video->mutex); in omap3isp_video_init()
1432 atomic_set(&video->active, 0); in omap3isp_video_init()
1434 spin_lock_init(&video->pipe.lock); in omap3isp_video_init()
1435 mutex_init(&video->stream_lock); in omap3isp_video_init()
1436 mutex_init(&video->queue_lock); in omap3isp_video_init()
1437 spin_lock_init(&video->irqlock); in omap3isp_video_init()
1440 if (video->ops == NULL) in omap3isp_video_init()
1441 video->ops = &isp_video_dummy_ops; in omap3isp_video_init()
1443 video->video.fops = &isp_video_fops; in omap3isp_video_init()
1444 snprintf(video->video.name, sizeof(video->video.name), in omap3isp_video_init()
1446 video->video.vfl_type = VFL_TYPE_VIDEO; in omap3isp_video_init()
1447 video->video.release = video_device_release_empty; in omap3isp_video_init()
1448 video->video.ioctl_ops = &isp_video_ioctl_ops; in omap3isp_video_init()
1449 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_init()
1450 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE in omap3isp_video_init()
1453 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT in omap3isp_video_init()
1456 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; in omap3isp_video_init()
1458 video_set_drvdata(&video->video, video); in omap3isp_video_init()
1463 void omap3isp_video_cleanup(struct isp_video *video) in omap3isp_video_cleanup() argument
1465 media_entity_cleanup(&video->video.entity); in omap3isp_video_cleanup()
1466 mutex_destroy(&video->queue_lock); in omap3isp_video_cleanup()
1467 mutex_destroy(&video->stream_lock); in omap3isp_video_cleanup()
1468 mutex_destroy(&video->mutex); in omap3isp_video_cleanup()
1471 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) in omap3isp_video_register() argument
1475 video->video.v4l2_dev = vdev; in omap3isp_video_register()
1477 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); in omap3isp_video_register()
1479 dev_err(video->isp->dev, in omap3isp_video_register()
1486 void omap3isp_video_unregister(struct isp_video *video) in omap3isp_video_unregister() argument
1488 video_unregister_device(&video->video); in omap3isp_video_unregister()