Lines Matching full:video
3 * camss-video.c
18 #include "camss-video.h"
326 static struct v4l2_subdev *video_remote_subdev(struct camss_video *video, in video_remote_subdev() argument
331 remote = media_pad_remote_pad_first(&video->pad); in video_remote_subdev()
342 static int video_get_subdev_format(struct camss_video *video, in video_get_subdev_format() argument
352 subdev = video_remote_subdev(video, &pad); in video_get_subdev_format()
364 video->formats, video->nformats); in video_get_subdev_format()
368 format->type = video->type; in video_get_subdev_format()
371 &video->formats[ret], video->bpl_alignment); in video_get_subdev_format()
375 * Video queue operations
382 struct camss_video *video = vb2_get_drv_priv(q); in video_queue_setup() local
384 &video->active_fmt.fmt.pix_mp; in video_queue_setup()
409 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_init() local
413 &video->active_fmt.fmt.pix_mp; in video_buf_init()
439 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_prepare() local
441 &video->active_fmt.fmt.pix_mp; in video_buf_prepare()
459 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_queue() local
463 video->ops->queue_buffer(video, buffer); in video_buf_queue()
466 static int video_check_format(struct camss_video *video) in video_check_format() argument
468 struct v4l2_pix_format_mplane *pix = &video->active_fmt.fmt.pix_mp; in video_check_format()
474 ret = video_get_subdev_format(video, &format); in video_check_format()
490 struct camss_video *video = vb2_get_drv_priv(q); in video_start_streaming() local
491 struct video_device *vdev = &video->vdev; in video_start_streaming()
499 dev_err(video->camss->dev, "Failed to start media pipeline: %d\n", ret); in video_start_streaming()
503 ret = video_check_format(video); in video_start_streaming()
520 ret = v4l2_subdev_call(subdev, video, s_stream, 1); in video_start_streaming()
531 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED); in video_start_streaming()
538 struct camss_video *video = vb2_get_drv_priv(q); in video_stop_streaming() local
539 struct video_device *vdev = &video->vdev; in video_stop_streaming()
558 ret = v4l2_subdev_call(subdev, video, s_stream, 0); in video_stop_streaming()
562 dev_dbg(video->camss->dev, "Video pipeline still used, don't stop streaming.\n"); in video_stop_streaming()
567 dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret); in video_stop_streaming()
574 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR); in video_stop_streaming()
603 struct camss_video *video = video_drvdata(file); in video_enum_fmt() local
607 if (f->type != video->type) in video_enum_fmt()
610 if (f->index >= video->nformats) in video_enum_fmt()
619 * This is implemented by skipping video->formats[] entries with in video_enum_fmt()
626 for (i = 0; i < video->nformats; i++) { in video_enum_fmt()
627 if (mcode != 0 && video->formats[i].code != mcode) in video_enum_fmt()
631 if (mcode != 0 && video->formats[j].code != mcode) in video_enum_fmt()
633 if (video->formats[i].pixelformat == in video_enum_fmt()
634 video->formats[j].pixelformat) in video_enum_fmt()
653 f->pixelformat = video->formats[i].pixelformat; in video_enum_fmt()
661 struct camss_video *video = video_drvdata(file); in video_enum_framesizes() local
668 for (i = 0; i < video->nformats; i++) { in video_enum_framesizes()
669 if (video->formats[i].pixelformat == fsize->pixel_format) in video_enum_framesizes()
673 if (i == video->nformats) in video_enum_framesizes()
680 fsize->stepwise.max_height = (video->line_based) ? in video_enum_framesizes()
690 struct camss_video *video = video_drvdata(file); in video_g_fmt() local
692 *f = video->active_fmt; in video_g_fmt()
697 static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) in __video_try_fmt() argument
710 if (video->line_based) in __video_try_fmt()
720 for (j = 0; j < video->nformats; j++) in __video_try_fmt()
721 if (pix_mp->pixelformat == video->formats[j].pixelformat) in __video_try_fmt()
724 if (j == video->nformats) in __video_try_fmt()
727 fi = &video->formats[j]; in __video_try_fmt()
740 bpl = ALIGN(bpl, video->bpl_alignment); in __video_try_fmt()
754 if (video->line_based) in __video_try_fmt()
779 struct camss_video *video = video_drvdata(file); in video_try_fmt() local
781 return __video_try_fmt(video, f); in video_try_fmt()
786 struct camss_video *video = video_drvdata(file); in video_s_fmt() local
789 if (vb2_is_busy(&video->vb2_q)) in video_s_fmt()
792 ret = __video_try_fmt(video, f); in video_s_fmt()
796 video->active_fmt = *f; in video_s_fmt()
853 struct camss_video *video = video_drvdata(file); in video_open() local
857 mutex_lock(&video->lock); in video_open()
872 dev_err(video->camss->dev, "Failed to power up pipeline: %d\n", in video_open()
877 mutex_unlock(&video->lock); in video_open()
885 mutex_unlock(&video->lock); in video_open()
914 * CAMSS video core
919 struct camss_video *video = video_get_drvdata(vdev); in msm_video_release() local
923 mutex_destroy(&video->q_lock); in msm_video_release()
924 mutex_destroy(&video->lock); in msm_video_release()
926 if (atomic_dec_and_test(&video->camss->ref_count)) in msm_video_release()
927 camss_delete(video->camss); in msm_video_release()
932 * @video: struct camss_video
938 static int msm_video_init_format(struct camss_video *video) in msm_video_init_format() argument
946 .pixelformat = video->formats[0].pixelformat, in msm_video_init_format()
950 ret = __video_try_fmt(video, &format); in msm_video_init_format()
954 video->active_fmt = format; in msm_video_init_format()
960 * msm_video_register - Register a video device node
961 * @video: struct camss_video
963 * @name: name to be used for the video device node
965 * Initialize and register a video device node to a V4L2 device. Also
971 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, in msm_video_register() argument
974 struct media_pad *pad = &video->pad; in msm_video_register()
979 vdev = &video->vdev; in msm_video_register()
981 mutex_init(&video->q_lock); in msm_video_register()
983 q = &video->vb2_q; in msm_video_register()
984 q->drv_priv = video; in msm_video_register()
991 q->dev = video->camss->dev; in msm_video_register()
992 q->lock = &video->q_lock; in msm_video_register()
1002 dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n", in msm_video_register()
1007 mutex_init(&video->lock); in msm_video_register()
1009 switch (video->camss->res->version) { in msm_video_register()
1012 video->formats = formats_pix_8x16; in msm_video_register()
1013 video->nformats = ARRAY_SIZE(formats_pix_8x16); in msm_video_register()
1015 video->formats = formats_rdi_8x16; in msm_video_register()
1016 video->nformats = ARRAY_SIZE(formats_rdi_8x16); in msm_video_register()
1022 video->formats = formats_pix_8x96; in msm_video_register()
1023 video->nformats = ARRAY_SIZE(formats_pix_8x96); in msm_video_register()
1025 video->formats = formats_rdi_8x96; in msm_video_register()
1026 video->nformats = ARRAY_SIZE(formats_rdi_8x96); in msm_video_register()
1031 video->formats = formats_rdi_845; in msm_video_register()
1032 video->nformats = ARRAY_SIZE(formats_rdi_845); in msm_video_register()
1036 ret = msm_video_init_format(video); in msm_video_register()
1049 vdev->queue = &video->vb2_q; in msm_video_register()
1050 vdev->lock = &video->lock; in msm_video_register()
1055 dev_err(v4l2_dev->dev, "Failed to register video device: %d\n", in msm_video_register()
1060 video_set_drvdata(vdev, video); in msm_video_register()
1061 atomic_inc(&video->camss->ref_count); in msm_video_register()
1067 mutex_destroy(&video->lock); in msm_video_register()
1069 mutex_destroy(&video->q_lock); in msm_video_register()
1074 void msm_video_unregister(struct camss_video *video) in msm_video_unregister() argument
1076 atomic_inc(&video->camss->ref_count); in msm_video_unregister()
1077 vb2_video_unregister_device(&video->vdev); in msm_video_unregister()
1078 atomic_dec(&video->camss->ref_count); in msm_video_unregister()