Lines Matching full:video

3  * camss-video.c
18 #include "camss-video.h"
275 static struct v4l2_subdev *video_remote_subdev(struct camss_video *video, in video_remote_subdev() argument
280 remote = media_entity_remote_pad(&video->pad); in video_remote_subdev()
291 static int video_get_subdev_format(struct camss_video *video, in video_get_subdev_format() argument
299 subdev = video_remote_subdev(video, &pad); in video_get_subdev_format()
312 video->formats, video->nformats); in video_get_subdev_format()
316 format->type = video->type; in video_get_subdev_format()
319 &video->formats[ret], video->bpl_alignment); in video_get_subdev_format()
323 * Video queue operations
330 struct camss_video *video = vb2_get_drv_priv(q); in video_queue_setup() local
332 &video->active_fmt.fmt.pix_mp; in video_queue_setup()
357 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_init() local
361 &video->active_fmt.fmt.pix_mp; in video_buf_init()
387 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_prepare() local
389 &video->active_fmt.fmt.pix_mp; in video_buf_prepare()
407 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_queue() local
411 video->ops->queue_buffer(video, buffer); in video_buf_queue()
414 static int video_check_format(struct camss_video *video) in video_check_format() argument
416 struct v4l2_pix_format_mplane *pix = &video->active_fmt.fmt.pix_mp; in video_check_format()
422 ret = video_get_subdev_format(video, &format); in video_check_format()
438 struct camss_video *video = vb2_get_drv_priv(q); in video_start_streaming() local
439 struct video_device *vdev = &video->vdev; in video_start_streaming()
445 ret = media_pipeline_start(&vdev->entity, &video->pipe); in video_start_streaming()
449 ret = video_check_format(video); in video_start_streaming()
466 ret = v4l2_subdev_call(subdev, video, s_stream, 1); in video_start_streaming()
476 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED); in video_start_streaming()
483 struct camss_video *video = vb2_get_drv_priv(q); in video_stop_streaming() local
484 struct video_device *vdev = &video->vdev; in video_stop_streaming()
502 v4l2_subdev_call(subdev, video, s_stream, 0); in video_stop_streaming()
507 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR); in video_stop_streaming()
528 struct camss_video *video = video_drvdata(file); in video_querycap() local
533 dev_name(video->camss->dev)); in video_querycap()
539 * Returns the index in the video->formats[] array of the element which
543 static int video_get_unique_pixelformat_by_index(struct camss_video *video, in video_get_unique_pixelformat_by_index() argument
550 for (i = 0; i < video->nformats; i++) { in video_get_unique_pixelformat_by_index()
552 if (video->formats[i].pixelformat == in video_get_unique_pixelformat_by_index()
553 video->formats[j].pixelformat) in video_get_unique_pixelformat_by_index()
568 * Returns the index in the video->formats[] array of the element which
572 static int video_get_pixelformat_by_mbus_code(struct camss_video *video, in video_get_pixelformat_by_mbus_code() argument
577 for (i = 0; i < video->nformats; i++) { in video_get_pixelformat_by_mbus_code()
578 if (video->formats[i].code == mcode) in video_get_pixelformat_by_mbus_code()
587 struct camss_video *video = video_drvdata(file); in video_enum_fmt() local
590 if (f->type != video->type) in video_enum_fmt()
593 if (f->index >= video->nformats) in video_enum_fmt()
601 i = video_get_pixelformat_by_mbus_code(video, f->mbus_code); in video_enum_fmt()
603 i = video_get_unique_pixelformat_by_index(video, f->index); in video_enum_fmt()
609 f->pixelformat = video->formats[i].pixelformat; in video_enum_fmt()
617 struct camss_video *video = video_drvdata(file); in video_enum_framesizes() local
624 for (i = 0; i < video->nformats; i++) { in video_enum_framesizes()
625 if (video->formats[i].pixelformat == fsize->pixel_format) in video_enum_framesizes()
629 if (i == video->nformats) in video_enum_framesizes()
636 fsize->stepwise.max_height = (video->line_based) ? in video_enum_framesizes()
646 struct camss_video *video = video_drvdata(file); in video_g_fmt() local
648 *f = video->active_fmt; in video_g_fmt()
653 static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) in __video_try_fmt() argument
666 if (video->line_based) in __video_try_fmt()
676 for (j = 0; j < video->nformats; j++) in __video_try_fmt()
677 if (pix_mp->pixelformat == video->formats[j].pixelformat) in __video_try_fmt()
680 if (j == video->nformats) in __video_try_fmt()
683 fi = &video->formats[j]; in __video_try_fmt()
696 bpl = ALIGN(bpl, video->bpl_alignment); in __video_try_fmt()
710 if (video->line_based) in __video_try_fmt()
735 struct camss_video *video = video_drvdata(file); in video_try_fmt() local
737 return __video_try_fmt(video, f); in video_try_fmt()
742 struct camss_video *video = video_drvdata(file); in video_s_fmt() local
745 if (vb2_is_busy(&video->vb2_q)) in video_s_fmt()
748 ret = __video_try_fmt(video, f); in video_s_fmt()
752 video->active_fmt = *f; in video_s_fmt()
809 struct camss_video *video = video_drvdata(file); in video_open() local
813 mutex_lock(&video->lock); in video_open()
828 dev_err(video->camss->dev, "Failed to power up pipeline: %d\n", in video_open()
833 mutex_unlock(&video->lock); in video_open()
841 mutex_unlock(&video->lock); in video_open()
870 * CAMSS video core
875 struct camss_video *video = video_get_drvdata(vdev); in msm_video_release() local
879 mutex_destroy(&video->q_lock); in msm_video_release()
880 mutex_destroy(&video->lock); in msm_video_release()
882 if (atomic_dec_and_test(&video->camss->ref_count)) in msm_video_release()
883 camss_delete(video->camss); in msm_video_release()
888 * @video: struct camss_video
894 static int msm_video_init_format(struct camss_video *video) in msm_video_init_format() argument
902 .pixelformat = video->formats[0].pixelformat, in msm_video_init_format()
906 ret = __video_try_fmt(video, &format); in msm_video_init_format()
910 video->active_fmt = format; in msm_video_init_format()
916 * msm_video_register - Register a video device node
917 * @video: struct camss_video
919 * @name: name to be used for the video device node
921 * Initialize and register a video device node to a V4L2 device. Also
927 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, in msm_video_register() argument
930 struct media_pad *pad = &video->pad; in msm_video_register()
935 vdev = &video->vdev; in msm_video_register()
937 mutex_init(&video->q_lock); in msm_video_register()
939 q = &video->vb2_q; in msm_video_register()
940 q->drv_priv = video; in msm_video_register()
947 q->dev = video->camss->dev; in msm_video_register()
948 q->lock = &video->q_lock; in msm_video_register()
958 dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n", in msm_video_register()
963 mutex_init(&video->lock); in msm_video_register()
965 if (video->camss->version == CAMSS_8x16) { in msm_video_register()
967 video->formats = formats_pix_8x16; in msm_video_register()
968 video->nformats = ARRAY_SIZE(formats_pix_8x16); in msm_video_register()
970 video->formats = formats_rdi_8x16; in msm_video_register()
971 video->nformats = ARRAY_SIZE(formats_rdi_8x16); in msm_video_register()
973 } else if (video->camss->version == CAMSS_8x96) { in msm_video_register()
975 video->formats = formats_pix_8x96; in msm_video_register()
976 video->nformats = ARRAY_SIZE(formats_pix_8x96); in msm_video_register()
978 video->formats = formats_rdi_8x96; in msm_video_register()
979 video->nformats = ARRAY_SIZE(formats_rdi_8x96); in msm_video_register()
985 ret = msm_video_init_format(video); in msm_video_register()
998 vdev->queue = &video->vb2_q; in msm_video_register()
999 vdev->lock = &video->lock; in msm_video_register()
1004 dev_err(v4l2_dev->dev, "Failed to register video device: %d\n", in msm_video_register()
1009 video_set_drvdata(vdev, video); in msm_video_register()
1010 atomic_inc(&video->camss->ref_count); in msm_video_register()
1016 mutex_destroy(&video->lock); in msm_video_register()
1018 mutex_destroy(&video->q_lock); in msm_video_register()
1023 void msm_video_unregister(struct camss_video *video) in msm_video_unregister() argument
1025 atomic_inc(&video->camss->ref_count); in msm_video_unregister()
1026 vb2_video_unregister_device(&video->vdev); in msm_video_unregister()
1027 atomic_dec(&video->camss->ref_count); in msm_video_unregister()