Lines Matching full:video
3 * camss-video.c
18 #include "camss-video.h"
67 static struct v4l2_subdev *video_remote_subdev(struct camss_video *video, in video_remote_subdev() argument
72 remote = media_pad_remote_pad_first(&video->pad); in video_remote_subdev()
83 static int video_get_subdev_format(struct camss_video *video, in video_get_subdev_format() argument
93 subdev = video_remote_subdev(video, &pad); in video_get_subdev_format()
104 video->formats, video->nformats); in video_get_subdev_format()
108 format->type = video->type; in video_get_subdev_format()
111 &video->formats[ret], video->bpl_alignment); in video_get_subdev_format()
115 * Video queue operations
122 struct camss_video *video = vb2_get_drv_priv(q); in video_queue_setup() local
124 &video->active_fmt.fmt.pix_mp; in video_queue_setup()
149 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_init() local
153 &video->active_fmt.fmt.pix_mp; in video_buf_init()
179 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_prepare() local
181 &video->active_fmt.fmt.pix_mp; in video_buf_prepare()
199 struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); in video_buf_queue() local
203 video->ops->queue_buffer(video, buffer); in video_buf_queue()
206 static int video_check_format(struct camss_video *video) in video_check_format() argument
208 struct v4l2_pix_format_mplane *pix = &video->active_fmt.fmt.pix_mp; in video_check_format()
214 ret = video_get_subdev_format(video, &format); in video_check_format()
230 struct camss_video *video = vb2_get_drv_priv(q); in video_start_streaming() local
231 struct video_device *vdev = &video->vdev; in video_start_streaming()
239 dev_err(video->camss->dev, "Failed to start media pipeline: %d\n", ret); in video_start_streaming()
243 ret = video_check_format(video); in video_start_streaming()
260 ret = v4l2_subdev_call(subdev, video, s_stream, 1); in video_start_streaming()
271 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED); in video_start_streaming()
278 struct camss_video *video = vb2_get_drv_priv(q); in video_stop_streaming() local
279 struct video_device *vdev = &video->vdev; in video_stop_streaming()
298 ret = v4l2_subdev_call(subdev, video, s_stream, 0); in video_stop_streaming()
301 dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret); in video_stop_streaming()
308 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR); in video_stop_streaming()
335 struct camss_video *video = video_drvdata(file); in video_enum_fmt() local
339 if (f->type != video->type) in video_enum_fmt()
342 if (f->index >= video->nformats) in video_enum_fmt()
351 * This is implemented by skipping video->formats[] entries with in video_enum_fmt()
358 for (i = 0; i < video->nformats; i++) { in video_enum_fmt()
359 if (mcode != 0 && video->formats[i].code != mcode) in video_enum_fmt()
363 if (mcode != 0 && video->formats[j].code != mcode) in video_enum_fmt()
365 if (video->formats[i].pixelformat == in video_enum_fmt()
366 video->formats[j].pixelformat) in video_enum_fmt()
385 f->pixelformat = video->formats[i].pixelformat; in video_enum_fmt()
393 struct camss_video *video = video_drvdata(file); in video_enum_framesizes() local
400 for (i = 0; i < video->nformats; i++) { in video_enum_framesizes()
401 if (video->formats[i].pixelformat == fsize->pixel_format) in video_enum_framesizes()
405 if (i == video->nformats) in video_enum_framesizes()
412 fsize->stepwise.max_height = (video->line_based) ? in video_enum_framesizes()
422 struct camss_video *video = video_drvdata(file); in video_g_fmt() local
424 *f = video->active_fmt; in video_g_fmt()
429 static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) in __video_try_fmt() argument
442 if (video->line_based) in __video_try_fmt()
452 for (j = 0; j < video->nformats; j++) in __video_try_fmt()
453 if (pix_mp->pixelformat == video->formats[j].pixelformat) in __video_try_fmt()
456 if (j == video->nformats) in __video_try_fmt()
459 fi = &video->formats[j]; in __video_try_fmt()
472 bpl = ALIGN(bpl, video->bpl_alignment); in __video_try_fmt()
486 if (video->line_based) in __video_try_fmt()
511 struct camss_video *video = video_drvdata(file); in video_try_fmt() local
513 return __video_try_fmt(video, f); in video_try_fmt()
518 struct camss_video *video = video_drvdata(file); in video_s_fmt() local
521 if (vb2_is_busy(&video->vb2_q)) in video_s_fmt()
524 ret = __video_try_fmt(video, f); in video_s_fmt()
528 video->active_fmt = *f; in video_s_fmt()
585 struct camss_video *video = video_drvdata(file); in video_open() local
589 mutex_lock(&video->lock); in video_open()
604 dev_err(video->camss->dev, "Failed to power up pipeline: %d\n", in video_open()
609 mutex_unlock(&video->lock); in video_open()
617 mutex_unlock(&video->lock); in video_open()
646 * CAMSS video core
651 struct camss_video *video = video_get_drvdata(vdev); in msm_video_release() local
655 mutex_destroy(&video->q_lock); in msm_video_release()
656 mutex_destroy(&video->lock); in msm_video_release()
658 if (atomic_dec_and_test(&video->camss->ref_count)) in msm_video_release()
659 camss_delete(video->camss); in msm_video_release()
664 * @video: struct camss_video
670 static int msm_video_init_format(struct camss_video *video) in msm_video_init_format() argument
678 .pixelformat = video->formats[0].pixelformat, in msm_video_init_format()
682 ret = __video_try_fmt(video, &format); in msm_video_init_format()
686 video->active_fmt = format; in msm_video_init_format()
692 * msm_video_register - Register a video device node
693 * @video: struct camss_video
695 * @name: name to be used for the video device node
697 * Initialize and register a video device node to a V4L2 device. Also
703 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, in msm_video_register() argument
706 struct media_pad *pad = &video->pad; in msm_video_register()
711 vdev = &video->vdev; in msm_video_register()
713 mutex_init(&video->q_lock); in msm_video_register()
715 q = &video->vb2_q; in msm_video_register()
716 q->drv_priv = video; in msm_video_register()
723 q->dev = video->camss->dev; in msm_video_register()
724 q->lock = &video->q_lock; in msm_video_register()
734 dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n", in msm_video_register()
739 mutex_init(&video->lock); in msm_video_register()
741 ret = msm_video_init_format(video); in msm_video_register()
754 vdev->queue = &video->vb2_q; in msm_video_register()
755 vdev->lock = &video->lock; in msm_video_register()
760 dev_err(v4l2_dev->dev, "Failed to register video device: %d\n", in msm_video_register()
765 video_set_drvdata(vdev, video); in msm_video_register()
766 atomic_inc(&video->camss->ref_count); in msm_video_register()
772 mutex_destroy(&video->lock); in msm_video_register()
774 mutex_destroy(&video->q_lock); in msm_video_register()
779 void msm_video_unregister(struct camss_video *video) in msm_video_unregister() argument
781 atomic_inc(&video->camss->ref_count); in msm_video_unregister()
782 vb2_video_unregister_device(&video->vdev); in msm_video_unregister()
783 atomic_dec(&video->camss->ref_count); in msm_video_unregister()