Lines Matching full:video
3 * camss-video.c
18 #include "camss-video.h"
269 static struct v4l2_subdev *video_remote_subdev(struct camss_video *video, in video_remote_subdev() argument
274 remote = media_entity_remote_pad(&video->pad); in video_remote_subdev()
285 static int video_get_subdev_format(struct camss_video *video, in video_get_subdev_format() argument
293 subdev = video_remote_subdev(video, &pad); in video_get_subdev_format()
306 video->formats, video->nformats); in video_get_subdev_format()
310 format->type = video->type; in video_get_subdev_format()
313 &video->formats[ret], video->bpl_alignment); in video_get_subdev_format()
317 * Video queue operations
324 struct camss_video *video = vb2_get_drv_priv(q); in video_queue_setup() local
326 &video->active_fmt.fmt.pix_mp; in video_queue_setup()
351 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_init() local
355 &video->active_fmt.fmt.pix_mp; in video_buf_init()
381 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_prepare() local
383 &video->active_fmt.fmt.pix_mp; in video_buf_prepare()
401 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_queue() local
405 video->ops->queue_buffer(video, buffer); in video_buf_queue()
408 static int video_check_format(struct camss_video *video) in video_check_format() argument
410 struct v4l2_pix_format_mplane *pix = &video->active_fmt.fmt.pix_mp; in video_check_format()
416 ret = video_get_subdev_format(video, &format); in video_check_format()
432 struct camss_video *video = vb2_get_drv_priv(q); in video_start_streaming() local
433 struct video_device *vdev = &video->vdev; in video_start_streaming()
439 ret = media_pipeline_start(&vdev->entity, &video->pipe); in video_start_streaming()
443 ret = video_check_format(video); in video_start_streaming()
460 ret = v4l2_subdev_call(subdev, video, s_stream, 1); in video_start_streaming()
470 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED); in video_start_streaming()
477 struct camss_video *video = vb2_get_drv_priv(q); in video_stop_streaming() local
478 struct video_device *vdev = &video->vdev; in video_stop_streaming()
496 v4l2_subdev_call(subdev, video, s_stream, 0); in video_stop_streaming()
501 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR); in video_stop_streaming()
522 struct camss_video *video = video_drvdata(file); in video_querycap() local
527 dev_name(video->camss->dev)); in video_querycap()
534 struct camss_video *video = video_drvdata(file); in video_enum_fmt() local
537 if (f->type != video->type) in video_enum_fmt()
540 if (f->index >= video->nformats) in video_enum_fmt()
545 for (i = 0; i < video->nformats; i++) { in video_enum_fmt()
547 if (video->formats[i].pixelformat == in video_enum_fmt()
548 video->formats[j].pixelformat) in video_enum_fmt()
562 f->pixelformat = video->formats[i].pixelformat; in video_enum_fmt()
569 struct camss_video *video = video_drvdata(file); in video_g_fmt() local
571 *f = video->active_fmt; in video_g_fmt()
576 static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) in __video_try_fmt() argument
589 if (video->line_based) in __video_try_fmt()
599 for (j = 0; j < video->nformats; j++) in __video_try_fmt()
600 if (pix_mp->pixelformat == video->formats[j].pixelformat) in __video_try_fmt()
603 if (j == video->nformats) in __video_try_fmt()
606 fi = &video->formats[j]; in __video_try_fmt()
619 bpl = ALIGN(bpl, video->bpl_alignment); in __video_try_fmt()
633 if (video->line_based) in __video_try_fmt()
658 struct camss_video *video = video_drvdata(file); in video_try_fmt() local
660 return __video_try_fmt(video, f); in video_try_fmt()
665 struct camss_video *video = video_drvdata(file); in video_s_fmt() local
668 if (vb2_is_busy(&video->vb2_q)) in video_s_fmt()
671 ret = __video_try_fmt(video, f); in video_s_fmt()
675 video->active_fmt = *f; in video_s_fmt()
731 struct camss_video *video = video_drvdata(file); in video_open() local
735 mutex_lock(&video->lock); in video_open()
750 dev_err(video->camss->dev, "Failed to power up pipeline: %d\n", in video_open()
755 mutex_unlock(&video->lock); in video_open()
763 mutex_unlock(&video->lock); in video_open()
792 * CAMSS video core
797 struct camss_video *video = video_get_drvdata(vdev); in msm_video_release() local
801 mutex_destroy(&video->q_lock); in msm_video_release()
802 mutex_destroy(&video->lock); in msm_video_release()
804 if (atomic_dec_and_test(&video->camss->ref_count)) in msm_video_release()
805 camss_delete(video->camss); in msm_video_release()
810 * @video: struct camss_video
816 static int msm_video_init_format(struct camss_video *video) in msm_video_init_format() argument
824 .pixelformat = video->formats[0].pixelformat, in msm_video_init_format()
828 ret = __video_try_fmt(video, &format); in msm_video_init_format()
832 video->active_fmt = format; in msm_video_init_format()
838 * msm_video_register - Register a video device node
839 * @video: struct camss_video
841 * @name: name to be used for the video device node
843 * Initialize and register a video device node to a V4L2 device. Also
849 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, in msm_video_register() argument
852 struct media_pad *pad = &video->pad; in msm_video_register()
857 vdev = &video->vdev; in msm_video_register()
859 mutex_init(&video->q_lock); in msm_video_register()
861 q = &video->vb2_q; in msm_video_register()
862 q->drv_priv = video; in msm_video_register()
869 q->dev = video->camss->dev; in msm_video_register()
870 q->lock = &video->q_lock; in msm_video_register()
880 dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n", in msm_video_register()
885 mutex_init(&video->lock); in msm_video_register()
887 if (video->camss->version == CAMSS_8x16) { in msm_video_register()
889 video->formats = formats_pix_8x16; in msm_video_register()
890 video->nformats = ARRAY_SIZE(formats_pix_8x16); in msm_video_register()
892 video->formats = formats_rdi_8x16; in msm_video_register()
893 video->nformats = ARRAY_SIZE(formats_rdi_8x16); in msm_video_register()
895 } else if (video->camss->version == CAMSS_8x96) { in msm_video_register()
897 video->formats = formats_pix_8x96; in msm_video_register()
898 video->nformats = ARRAY_SIZE(formats_pix_8x96); in msm_video_register()
900 video->formats = formats_rdi_8x96; in msm_video_register()
901 video->nformats = ARRAY_SIZE(formats_rdi_8x96); in msm_video_register()
907 ret = msm_video_init_format(video); in msm_video_register()
920 vdev->queue = &video->vb2_q; in msm_video_register()
921 vdev->lock = &video->lock; in msm_video_register()
926 dev_err(v4l2_dev->dev, "Failed to register video device: %d\n", in msm_video_register()
931 video_set_drvdata(vdev, video); in msm_video_register()
932 atomic_inc(&video->camss->ref_count); in msm_video_register()
938 mutex_destroy(&video->lock); in msm_video_register()
940 vb2_queue_release(&video->vb2_q); in msm_video_register()
942 mutex_destroy(&video->q_lock); in msm_video_register()
947 void msm_video_stop_streaming(struct camss_video *video) in msm_video_stop_streaming() argument
949 if (vb2_is_streaming(&video->vb2_q)) in msm_video_stop_streaming()
950 vb2_queue_release(&video->vb2_q); in msm_video_stop_streaming()
953 void msm_video_unregister(struct camss_video *video) in msm_video_unregister() argument
955 atomic_inc(&video->camss->ref_count); in msm_video_unregister()
956 video_unregister_device(&video->vdev); in msm_video_unregister()
957 atomic_dec(&video->camss->ref_count); in msm_video_unregister()