Lines Matching full:video

3  * camss-video.c
18 #include "camss-video.h"
324 static struct v4l2_subdev *video_remote_subdev(struct camss_video *video, in video_remote_subdev() argument
329 remote = media_entity_remote_pad(&video->pad); in video_remote_subdev()
340 static int video_get_subdev_format(struct camss_video *video, in video_get_subdev_format() argument
348 subdev = video_remote_subdev(video, &pad); in video_get_subdev_format()
361 video->formats, video->nformats); in video_get_subdev_format()
365 format->type = video->type; in video_get_subdev_format()
368 &video->formats[ret], video->bpl_alignment); in video_get_subdev_format()
372 * Video queue operations
379 struct camss_video *video = vb2_get_drv_priv(q); in video_queue_setup() local
381 &video->active_fmt.fmt.pix_mp; in video_queue_setup()
406 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_init() local
410 &video->active_fmt.fmt.pix_mp; in video_buf_init()
436 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_prepare() local
438 &video->active_fmt.fmt.pix_mp; in video_buf_prepare()
456 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_queue() local
460 video->ops->queue_buffer(video, buffer); in video_buf_queue()
463 static int video_check_format(struct camss_video *video) in video_check_format() argument
465 struct v4l2_pix_format_mplane *pix = &video->active_fmt.fmt.pix_mp; in video_check_format()
471 ret = video_get_subdev_format(video, &format); in video_check_format()
487 struct camss_video *video = vb2_get_drv_priv(q); in video_start_streaming() local
488 struct video_device *vdev = &video->vdev; in video_start_streaming()
494 ret = media_pipeline_start(&vdev->entity, &video->pipe); in video_start_streaming()
498 ret = video_check_format(video); in video_start_streaming()
515 ret = v4l2_subdev_call(subdev, video, s_stream, 1); in video_start_streaming()
525 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED); in video_start_streaming()
532 struct camss_video *video = vb2_get_drv_priv(q); in video_stop_streaming() local
533 struct video_device *vdev = &video->vdev; in video_stop_streaming()
551 v4l2_subdev_call(subdev, video, s_stream, 0); in video_stop_streaming()
556 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR); in video_stop_streaming()
577 struct camss_video *video = video_drvdata(file); in video_querycap() local
582 dev_name(video->camss->dev)); in video_querycap()
589 struct camss_video *video = video_drvdata(file); in video_enum_fmt() local
593 if (f->type != video->type) in video_enum_fmt()
596 if (f->index >= video->nformats) in video_enum_fmt()
605 * This is implemented by skipping video->formats[] entries with in video_enum_fmt()
612 for (i = 0; i < video->nformats; i++) { in video_enum_fmt()
613 if (mcode != 0 && video->formats[i].code != mcode) in video_enum_fmt()
617 if (mcode != 0 && video->formats[j].code != mcode) in video_enum_fmt()
619 if (video->formats[i].pixelformat == in video_enum_fmt()
620 video->formats[j].pixelformat) in video_enum_fmt()
639 f->pixelformat = video->formats[i].pixelformat; in video_enum_fmt()
647 struct camss_video *video = video_drvdata(file); in video_enum_framesizes() local
654 for (i = 0; i < video->nformats; i++) { in video_enum_framesizes()
655 if (video->formats[i].pixelformat == fsize->pixel_format) in video_enum_framesizes()
659 if (i == video->nformats) in video_enum_framesizes()
666 fsize->stepwise.max_height = (video->line_based) ? in video_enum_framesizes()
676 struct camss_video *video = video_drvdata(file); in video_g_fmt() local
678 *f = video->active_fmt; in video_g_fmt()
683 static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) in __video_try_fmt() argument
696 if (video->line_based) in __video_try_fmt()
706 for (j = 0; j < video->nformats; j++) in __video_try_fmt()
707 if (pix_mp->pixelformat == video->formats[j].pixelformat) in __video_try_fmt()
710 if (j == video->nformats) in __video_try_fmt()
713 fi = &video->formats[j]; in __video_try_fmt()
726 bpl = ALIGN(bpl, video->bpl_alignment); in __video_try_fmt()
740 if (video->line_based) in __video_try_fmt()
765 struct camss_video *video = video_drvdata(file); in video_try_fmt() local
767 return __video_try_fmt(video, f); in video_try_fmt()
772 struct camss_video *video = video_drvdata(file); in video_s_fmt() local
775 if (vb2_is_busy(&video->vb2_q)) in video_s_fmt()
778 ret = __video_try_fmt(video, f); in video_s_fmt()
782 video->active_fmt = *f; in video_s_fmt()
839 struct camss_video *video = video_drvdata(file); in video_open() local
843 mutex_lock(&video->lock); in video_open()
858 dev_err(video->camss->dev, "Failed to power up pipeline: %d\n", in video_open()
863 mutex_unlock(&video->lock); in video_open()
871 mutex_unlock(&video->lock); in video_open()
900 * CAMSS video core
905 struct camss_video *video = video_get_drvdata(vdev); in msm_video_release() local
909 mutex_destroy(&video->q_lock); in msm_video_release()
910 mutex_destroy(&video->lock); in msm_video_release()
912 if (atomic_dec_and_test(&video->camss->ref_count)) in msm_video_release()
913 camss_delete(video->camss); in msm_video_release()
918 * @video: struct camss_video
924 static int msm_video_init_format(struct camss_video *video) in msm_video_init_format() argument
932 .pixelformat = video->formats[0].pixelformat, in msm_video_init_format()
936 ret = __video_try_fmt(video, &format); in msm_video_init_format()
940 video->active_fmt = format; in msm_video_init_format()
946 * msm_video_register - Register a video device node
947 * @video: struct camss_video
949 * @name: name to be used for the video device node
951 * Initialize and register a video device node to a V4L2 device. Also
957 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, in msm_video_register() argument
960 struct media_pad *pad = &video->pad; in msm_video_register()
965 vdev = &video->vdev; in msm_video_register()
967 mutex_init(&video->q_lock); in msm_video_register()
969 q = &video->vb2_q; in msm_video_register()
970 q->drv_priv = video; in msm_video_register()
977 q->dev = video->camss->dev; in msm_video_register()
978 q->lock = &video->q_lock; in msm_video_register()
988 dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n", in msm_video_register()
993 mutex_init(&video->lock); in msm_video_register()
995 if (video->camss->version == CAMSS_8x16) { in msm_video_register()
997 video->formats = formats_pix_8x16; in msm_video_register()
998 video->nformats = ARRAY_SIZE(formats_pix_8x16); in msm_video_register()
1000 video->formats = formats_rdi_8x16; in msm_video_register()
1001 video->nformats = ARRAY_SIZE(formats_rdi_8x16); in msm_video_register()
1003 } else if (video->camss->version == CAMSS_8x96 || in msm_video_register()
1004 video->camss->version == CAMSS_660) { in msm_video_register()
1006 video->formats = formats_pix_8x96; in msm_video_register()
1007 video->nformats = ARRAY_SIZE(formats_pix_8x96); in msm_video_register()
1009 video->formats = formats_rdi_8x96; in msm_video_register()
1010 video->nformats = ARRAY_SIZE(formats_rdi_8x96); in msm_video_register()
1012 } else if (video->camss->version == CAMSS_845) { in msm_video_register()
1013 video->formats = formats_rdi_845; in msm_video_register()
1014 video->nformats = ARRAY_SIZE(formats_rdi_845); in msm_video_register()
1020 ret = msm_video_init_format(video); in msm_video_register()
1033 vdev->queue = &video->vb2_q; in msm_video_register()
1034 vdev->lock = &video->lock; in msm_video_register()
1039 dev_err(v4l2_dev->dev, "Failed to register video device: %d\n", in msm_video_register()
1044 video_set_drvdata(vdev, video); in msm_video_register()
1045 atomic_inc(&video->camss->ref_count); in msm_video_register()
1051 mutex_destroy(&video->lock); in msm_video_register()
1053 mutex_destroy(&video->q_lock); in msm_video_register()
1058 void msm_video_unregister(struct camss_video *video) in msm_video_unregister() argument
1060 atomic_inc(&video->camss->ref_count); in msm_video_unregister()
1061 vb2_video_unregister_device(&video->vdev); in msm_video_unregister()
1062 atomic_dec(&video->camss->ref_count); in msm_video_unregister()