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
350 subdev = video_remote_subdev(video, &pad); in video_get_subdev_format()
363 video->formats, video->nformats); in video_get_subdev_format()
367 format->type = video->type; in video_get_subdev_format()
370 &video->formats[ret], video->bpl_alignment); in video_get_subdev_format()
374 * Video queue operations
381 struct camss_video *video = vb2_get_drv_priv(q); in video_queue_setup() local
383 &video->active_fmt.fmt.pix_mp; in video_queue_setup()
408 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_init() local
412 &video->active_fmt.fmt.pix_mp; in video_buf_init()
438 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_prepare() local
440 &video->active_fmt.fmt.pix_mp; in video_buf_prepare()
458 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_queue() local
462 video->ops->queue_buffer(video, buffer); in video_buf_queue()
465 static int video_check_format(struct camss_video *video) in video_check_format() argument
467 struct v4l2_pix_format_mplane *pix = &video->active_fmt.fmt.pix_mp; in video_check_format()
473 ret = video_get_subdev_format(video, &format); in video_check_format()
489 struct camss_video *video = vb2_get_drv_priv(q); in video_start_streaming() local
490 struct video_device *vdev = &video->vdev; in video_start_streaming()
496 ret = video_device_pipeline_start(vdev, &video->pipe); in video_start_streaming()
500 ret = video_check_format(video); in video_start_streaming()
517 ret = v4l2_subdev_call(subdev, video, s_stream, 1); in video_start_streaming()
527 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED); in video_start_streaming()
534 struct camss_video *video = vb2_get_drv_priv(q); in video_stop_streaming() local
535 struct video_device *vdev = &video->vdev; in video_stop_streaming()
553 v4l2_subdev_call(subdev, video, s_stream, 0); in video_stop_streaming()
558 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR); in video_stop_streaming()
587 struct camss_video *video = video_drvdata(file); in video_enum_fmt() local
591 if (f->type != video->type) in video_enum_fmt()
594 if (f->index >= video->nformats) in video_enum_fmt()
603 * This is implemented by skipping video->formats[] entries with in video_enum_fmt()
610 for (i = 0; i < video->nformats; i++) { in video_enum_fmt()
611 if (mcode != 0 && video->formats[i].code != mcode) in video_enum_fmt()
615 if (mcode != 0 && video->formats[j].code != mcode) in video_enum_fmt()
617 if (video->formats[i].pixelformat == in video_enum_fmt()
618 video->formats[j].pixelformat) in video_enum_fmt()
637 f->pixelformat = video->formats[i].pixelformat; in video_enum_fmt()
645 struct camss_video *video = video_drvdata(file); in video_enum_framesizes() local
652 for (i = 0; i < video->nformats; i++) { in video_enum_framesizes()
653 if (video->formats[i].pixelformat == fsize->pixel_format) in video_enum_framesizes()
657 if (i == video->nformats) in video_enum_framesizes()
664 fsize->stepwise.max_height = (video->line_based) ? in video_enum_framesizes()
674 struct camss_video *video = video_drvdata(file); in video_g_fmt() local
676 *f = video->active_fmt; in video_g_fmt()
681 static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) in __video_try_fmt() argument
694 if (video->line_based) in __video_try_fmt()
704 for (j = 0; j < video->nformats; j++) in __video_try_fmt()
705 if (pix_mp->pixelformat == video->formats[j].pixelformat) in __video_try_fmt()
708 if (j == video->nformats) in __video_try_fmt()
711 fi = &video->formats[j]; in __video_try_fmt()
724 bpl = ALIGN(bpl, video->bpl_alignment); in __video_try_fmt()
738 if (video->line_based) in __video_try_fmt()
763 struct camss_video *video = video_drvdata(file); in video_try_fmt() local
765 return __video_try_fmt(video, f); in video_try_fmt()
770 struct camss_video *video = video_drvdata(file); in video_s_fmt() local
773 if (vb2_is_busy(&video->vb2_q)) in video_s_fmt()
776 ret = __video_try_fmt(video, f); in video_s_fmt()
780 video->active_fmt = *f; in video_s_fmt()
837 struct camss_video *video = video_drvdata(file); in video_open() local
841 mutex_lock(&video->lock); in video_open()
856 dev_err(video->camss->dev, "Failed to power up pipeline: %d\n", in video_open()
861 mutex_unlock(&video->lock); in video_open()
869 mutex_unlock(&video->lock); in video_open()
898 * CAMSS video core
903 struct camss_video *video = video_get_drvdata(vdev); in msm_video_release() local
907 mutex_destroy(&video->q_lock); in msm_video_release()
908 mutex_destroy(&video->lock); in msm_video_release()
910 if (atomic_dec_and_test(&video->camss->ref_count)) in msm_video_release()
911 camss_delete(video->camss); in msm_video_release()
916 * @video: struct camss_video
922 static int msm_video_init_format(struct camss_video *video) in msm_video_init_format() argument
930 .pixelformat = video->formats[0].pixelformat, in msm_video_init_format()
934 ret = __video_try_fmt(video, &format); in msm_video_init_format()
938 video->active_fmt = format; in msm_video_init_format()
944 * msm_video_register - Register a video device node
945 * @video: struct camss_video
947 * @name: name to be used for the video device node
949 * Initialize and register a video device node to a V4L2 device. Also
955 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, in msm_video_register() argument
958 struct media_pad *pad = &video->pad; in msm_video_register()
963 vdev = &video->vdev; in msm_video_register()
965 mutex_init(&video->q_lock); in msm_video_register()
967 q = &video->vb2_q; in msm_video_register()
968 q->drv_priv = video; in msm_video_register()
975 q->dev = video->camss->dev; in msm_video_register()
976 q->lock = &video->q_lock; in msm_video_register()
986 dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n", in msm_video_register()
991 mutex_init(&video->lock); in msm_video_register()
993 if (video->camss->version == CAMSS_8x16) { in msm_video_register()
995 video->formats = formats_pix_8x16; in msm_video_register()
996 video->nformats = ARRAY_SIZE(formats_pix_8x16); in msm_video_register()
998 video->formats = formats_rdi_8x16; in msm_video_register()
999 video->nformats = ARRAY_SIZE(formats_rdi_8x16); in msm_video_register()
1001 } else if (video->camss->version == CAMSS_8x96 || in msm_video_register()
1002 video->camss->version == CAMSS_660) { in msm_video_register()
1004 video->formats = formats_pix_8x96; in msm_video_register()
1005 video->nformats = ARRAY_SIZE(formats_pix_8x96); in msm_video_register()
1007 video->formats = formats_rdi_8x96; in msm_video_register()
1008 video->nformats = ARRAY_SIZE(formats_rdi_8x96); in msm_video_register()
1010 } else if (video->camss->version == CAMSS_845 || in msm_video_register()
1011 video->camss->version == CAMSS_8250) { in msm_video_register()
1012 video->formats = formats_rdi_845; in msm_video_register()
1013 video->nformats = ARRAY_SIZE(formats_rdi_845); in msm_video_register()
1019 ret = msm_video_init_format(video); in msm_video_register()
1032 vdev->queue = &video->vb2_q; in msm_video_register()
1033 vdev->lock = &video->lock; in msm_video_register()
1038 dev_err(v4l2_dev->dev, "Failed to register video device: %d\n", in msm_video_register()
1043 video_set_drvdata(vdev, video); in msm_video_register()
1044 atomic_inc(&video->camss->ref_count); in msm_video_register()
1050 mutex_destroy(&video->lock); in msm_video_register()
1052 mutex_destroy(&video->q_lock); in msm_video_register()
1057 void msm_video_unregister(struct camss_video *video) in msm_video_unregister() argument
1059 atomic_inc(&video->camss->ref_count); in msm_video_unregister()
1060 vb2_video_unregister_device(&video->vdev); in msm_video_unregister()
1061 atomic_dec(&video->camss->ref_count); in msm_video_unregister()