Lines Matching refs:vcap
69 struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, in vimc_cap_get_format() local
72 *fmt = vcap->format; in vimc_cap_get_format()
78 struct vimc_cap_device *vcap = video_drvdata(file); in vimc_cap_g_fmt_vid_cap() local
80 f->fmt.pix = vcap->format; in vimc_cap_g_fmt_vid_cap()
120 struct vimc_cap_device *vcap = video_drvdata(file); in vimc_cap_s_fmt_vid_cap() local
124 if (vb2_is_busy(&vcap->queue)) in vimc_cap_s_fmt_vid_cap()
131 dev_dbg(vcap->ved.dev, "%s: format update: " in vimc_cap_s_fmt_vid_cap()
133 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcap->vdev.name, in vimc_cap_s_fmt_vid_cap()
135 vcap->format.width, vcap->format.height, in vimc_cap_s_fmt_vid_cap()
136 vcap->format.pixelformat, vcap->format.colorspace, in vimc_cap_s_fmt_vid_cap()
137 vcap->format.quantization, vcap->format.xfer_func, in vimc_cap_s_fmt_vid_cap()
138 vcap->format.ycbcr_enc, in vimc_cap_s_fmt_vid_cap()
145 vcap->format = f->fmt.pix; in vimc_cap_s_fmt_vid_cap()
226 static void vimc_cap_return_all_buffers(struct vimc_cap_device *vcap, in vimc_cap_return_all_buffers() argument
231 spin_lock(&vcap->qlock); in vimc_cap_return_all_buffers()
233 list_for_each_entry_safe(vbuf, node, &vcap->buf_list, list) { in vimc_cap_return_all_buffers()
238 spin_unlock(&vcap->qlock); in vimc_cap_return_all_buffers()
243 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); in vimc_cap_start_streaming() local
244 struct media_entity *entity = &vcap->vdev.entity; in vimc_cap_start_streaming()
247 vcap->sequence = 0; in vimc_cap_start_streaming()
250 ret = media_pipeline_start(entity, &vcap->stream.pipe); in vimc_cap_start_streaming()
252 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); in vimc_cap_start_streaming()
256 ret = vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 1); in vimc_cap_start_streaming()
259 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); in vimc_cap_start_streaming()
272 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); in vimc_cap_stop_streaming() local
274 vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 0); in vimc_cap_stop_streaming()
277 media_pipeline_stop(&vcap->vdev.entity); in vimc_cap_stop_streaming()
280 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_ERROR); in vimc_cap_stop_streaming()
285 struct vimc_cap_device *vcap = vb2_get_drv_priv(vb2_buf->vb2_queue); in vimc_cap_buf_queue() local
290 spin_lock(&vcap->qlock); in vimc_cap_buf_queue()
291 list_add_tail(&buf->list, &vcap->buf_list); in vimc_cap_buf_queue()
292 spin_unlock(&vcap->qlock); in vimc_cap_buf_queue()
299 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); in vimc_cap_queue_setup() local
302 return sizes[0] < vcap->format.sizeimage ? -EINVAL : 0; in vimc_cap_queue_setup()
305 sizes[0] = vcap->format.sizeimage; in vimc_cap_queue_setup()
312 struct vimc_cap_device *vcap = vb2_get_drv_priv(vb->vb2_queue); in vimc_cap_buffer_prepare() local
313 unsigned long size = vcap->format.sizeimage; in vimc_cap_buffer_prepare()
316 dev_err(vcap->ved.dev, "%s: buffer too small (%lu < %lu)\n", in vimc_cap_buffer_prepare()
317 vcap->vdev.name, vb2_plane_size(vb, 0), size); in vimc_cap_buffer_prepare()
343 struct vimc_cap_device *vcap = in vimc_cap_release() local
346 media_entity_cleanup(vcap->ved.ent); in vimc_cap_release()
347 kfree(vcap); in vimc_cap_release()
352 struct vimc_cap_device *vcap = in vimc_cap_unregister() local
355 vb2_video_unregister_device(&vcap->vdev); in vimc_cap_unregister()
361 struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, in vimc_cap_process_frame() local
366 spin_lock(&vcap->qlock); in vimc_cap_process_frame()
369 vimc_buf = list_first_entry_or_null(&vcap->buf_list, in vimc_cap_process_frame()
372 spin_unlock(&vcap->qlock); in vimc_cap_process_frame()
379 spin_unlock(&vcap->qlock); in vimc_cap_process_frame()
383 vimc_buf->vb2.sequence = vcap->sequence++; in vimc_cap_process_frame()
384 vimc_buf->vb2.field = vcap->format.field; in vimc_cap_process_frame()
388 memcpy(vbuf, frame, vcap->format.sizeimage); in vimc_cap_process_frame()
392 vcap->format.sizeimage); in vimc_cap_process_frame()
402 struct vimc_cap_device *vcap; in vimc_cap_add() local
408 vcap = kzalloc(sizeof(*vcap), GFP_KERNEL); in vimc_cap_add()
409 if (!vcap) in vimc_cap_add()
413 vcap->vdev.entity.name = vcfg_name; in vimc_cap_add()
414 vcap->vdev.entity.function = MEDIA_ENT_F_IO_V4L; in vimc_cap_add()
415 vcap->pad.flags = MEDIA_PAD_FL_SINK; in vimc_cap_add()
416 ret = media_entity_pads_init(&vcap->vdev.entity, in vimc_cap_add()
417 1, &vcap->pad); in vimc_cap_add()
422 mutex_init(&vcap->lock); in vimc_cap_add()
425 q = &vcap->queue; in vimc_cap_add()
430 q->drv_priv = vcap; in vimc_cap_add()
437 q->lock = &vcap->lock; in vimc_cap_add()
448 INIT_LIST_HEAD(&vcap->buf_list); in vimc_cap_add()
449 spin_lock_init(&vcap->qlock); in vimc_cap_add()
452 vcap->format = fmt_default; in vimc_cap_add()
453 vpix = vimc_pix_map_by_pixelformat(vcap->format.pixelformat); in vimc_cap_add()
454 vcap->format.bytesperline = vcap->format.width * vpix->bpp; in vimc_cap_add()
455 vcap->format.sizeimage = vcap->format.bytesperline * in vimc_cap_add()
456 vcap->format.height; in vimc_cap_add()
459 vcap->ved.ent = &vcap->vdev.entity; in vimc_cap_add()
460 vcap->ved.process_frame = vimc_cap_process_frame; in vimc_cap_add()
461 vcap->ved.vdev_get_format = vimc_cap_get_format; in vimc_cap_add()
462 vcap->ved.dev = vimc->mdev.dev; in vimc_cap_add()
465 vdev = &vcap->vdev; in vimc_cap_add()
472 vdev->lock = &vcap->lock; in vimc_cap_add()
477 video_set_drvdata(vdev, &vcap->ved); in vimc_cap_add()
483 vcap->vdev.name, ret); in vimc_cap_add()
487 return &vcap->ved; in vimc_cap_add()
490 media_entity_cleanup(&vcap->vdev.entity); in vimc_cap_add()
492 kfree(vcap); in vimc_cap_add()