Lines Matching defs:video

17 #include "stf-video.h"
30 video_g_fi_by_index(struct stfcamss_video *video, int index)
32 if (index >= video->nformats)
35 return &video->formats[index];
39 video_g_fi_by_mcode(struct stfcamss_video *video, u32 mcode)
43 for (i = 0; i < video->nformats; i++) {
44 if (video->formats[i].code == mcode)
45 return &video->formats[i];
52 video_g_fi_by_pfmt(struct stfcamss_video *video, u32 pixelformat)
56 for (i = 0; i < video->nformats; i++) {
57 if (video->formats[i].pixelformat == pixelformat)
58 return &video->formats[i];
64 static int __video_try_fmt(struct stfcamss_video *video, struct v4l2_format *f)
72 fi = video_g_fi_by_pfmt(video, pix->pixelformat);
74 fi = &video->formats[0]; /* default format */
87 bpl = ALIGN(bpl, video->bpl_alignment);
106 static int stf_video_init_format(struct stfcamss_video *video)
110 .type = video->type,
118 ret = __video_try_fmt(video, &format);
123 video->active_fmt = format;
138 struct stfcamss_video *video = vb2_get_drv_priv(q);
139 const struct v4l2_pix_format *format = &video->active_fmt.fmt.pix;
153 dev_dbg(video->stfcamss->dev,
158 dev_dbg(video->stfcamss->dev, "planes = %d, size = %d\n",
167 struct stfcamss_video *video = vb2_get_drv_priv(vb->vb2_queue);
169 const struct v4l2_pix_format *fmt = &video->active_fmt.fmt.pix;
185 struct stfcamss_video *video = vb2_get_drv_priv(vb->vb2_queue);
186 const struct v4l2_pix_format *fmt = &video->active_fmt.fmt.pix;
189 dev_dbg(video->stfcamss->dev,
204 struct stfcamss_video *video = vb2_get_drv_priv(vb->vb2_queue);
207 video->ops->queue_buffer(video, buffer);
210 static int video_get_subdev_format(struct stfcamss_video *video,
218 entity = &video->vdev.entity;
243 static int stf_video_check_format(struct stfcamss_video *video)
245 struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;
252 ret = video_get_subdev_format(video, &sd_fmt);
256 fi = video_g_fi_by_mcode(video, sd_fmt.format.code);
271 struct stfcamss_video *video = vb2_get_drv_priv(q);
272 struct video_device *vdev = &video->vdev;
275 ret = video_device_pipeline_start(vdev, &video->stfcamss->pipe);
277 dev_err(video->stfcamss->dev,
282 ret = pm_runtime_resume_and_get(video->stfcamss->dev);
284 dev_err(video->stfcamss->dev, "power up failed %d\n", ret);
288 video->ops->start_streaming(video);
290 ret = v4l2_subdev_call(video->source_subdev, video, s_stream, true);
292 dev_err(video->stfcamss->dev, "stream on failed\n");
299 pm_runtime_put(video->stfcamss->dev);
303 video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED);
309 struct stfcamss_video *video = vb2_get_drv_priv(q);
310 struct video_device *vdev = &video->vdev;
312 video->ops->stop_streaming(video);
314 v4l2_subdev_call(video->source_subdev, video, s_stream, false);
316 pm_runtime_put(video->stfcamss->dev);
319 video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR);
348 struct stfcamss_video *video = video_drvdata(file);
351 if (f->index >= video->nformats)
359 fi = video_g_fi_by_mcode(video, f->mbus_code);
361 fi = video_g_fi_by_index(video, f->index);
375 struct stfcamss_video *video = video_drvdata(file);
381 for (i = 0; i < video->nformats; i++) {
382 if (video->formats[i].pixelformat == fsize->pixel_format)
386 if (i == video->nformats)
402 struct stfcamss_video *video = video_drvdata(file);
404 *f = video->active_fmt;
411 struct stfcamss_video *video = video_drvdata(file);
414 if (vb2_is_busy(&video->vb2_q))
417 ret = __video_try_fmt(video, f);
421 video->active_fmt = *f;
428 struct stfcamss_video *video = video_drvdata(file);
430 return __video_try_fmt(video, f);
466 * STFCAMSS video core
473 struct stfcamss_video *video = video_get_drvdata(vdev);
476 ret = stf_video_check_format(video);
487 struct stfcamss_video *video = video_get_drvdata(vdev);
491 mutex_destroy(&video->q_lock);
492 mutex_destroy(&video->lock);
495 int stf_video_register(struct stfcamss_video *video,
498 struct video_device *vdev = &video->vdev;
500 struct media_pad *pad = &video->pad;
503 mutex_init(&video->q_lock);
504 mutex_init(&video->lock);
506 q = &video->vb2_q;
507 q->drv_priv = video;
510 q->type = video->type;
514 q->dev = video->stfcamss->dev;
515 q->lock = &video->q_lock;
519 dev_err(video->stfcamss->dev,
527 dev_err(video->stfcamss->dev,
528 "Failed to init video entity: %d\n", ret);
532 ret = stf_video_init_format(video);
534 dev_err(video->stfcamss->dev,
546 vdev->queue = &video->vb2_q;
547 vdev->lock = &video->lock;
550 video_set_drvdata(vdev, video);
554 dev_err(video->stfcamss->dev,
555 "Failed to register video device: %d\n", ret);
564 mutex_destroy(&video->lock);
565 mutex_destroy(&video->q_lock);
569 void stf_video_unregister(struct stfcamss_video *video)
571 vb2_video_unregister_device(&video->vdev);