Lines Matching refs:vcap
68 struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, in vimc_cap_get_format() local
71 *fmt = vcap->format; in vimc_cap_get_format()
77 struct vimc_cap_device *vcap = video_drvdata(file); in vimc_cap_g_fmt_vid_cap() local
79 f->fmt.pix = vcap->format; in vimc_cap_g_fmt_vid_cap()
119 struct vimc_cap_device *vcap = video_drvdata(file); in vimc_cap_s_fmt_vid_cap() local
123 if (vb2_is_busy(&vcap->queue)) in vimc_cap_s_fmt_vid_cap()
130 dev_dbg(vcap->ved.dev, "%s: format update: " in vimc_cap_s_fmt_vid_cap()
132 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcap->vdev.name, in vimc_cap_s_fmt_vid_cap()
134 vcap->format.width, vcap->format.height, in vimc_cap_s_fmt_vid_cap()
135 vcap->format.pixelformat, vcap->format.colorspace, in vimc_cap_s_fmt_vid_cap()
136 vcap->format.quantization, vcap->format.xfer_func, in vimc_cap_s_fmt_vid_cap()
137 vcap->format.ycbcr_enc, in vimc_cap_s_fmt_vid_cap()
144 vcap->format = f->fmt.pix; in vimc_cap_s_fmt_vid_cap()
225 static void vimc_cap_return_all_buffers(struct vimc_cap_device *vcap, in vimc_cap_return_all_buffers() argument
230 spin_lock(&vcap->qlock); in vimc_cap_return_all_buffers()
232 list_for_each_entry_safe(vbuf, node, &vcap->buf_list, list) { in vimc_cap_return_all_buffers()
237 spin_unlock(&vcap->qlock); in vimc_cap_return_all_buffers()
242 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); in vimc_cap_start_streaming() local
243 struct media_entity *entity = &vcap->vdev.entity; in vimc_cap_start_streaming()
246 vcap->sequence = 0; in vimc_cap_start_streaming()
249 ret = media_pipeline_start(entity, &vcap->stream.pipe); in vimc_cap_start_streaming()
251 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); in vimc_cap_start_streaming()
255 ret = vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 1); in vimc_cap_start_streaming()
258 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); in vimc_cap_start_streaming()
271 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); in vimc_cap_stop_streaming() local
273 vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 0); in vimc_cap_stop_streaming()
276 media_pipeline_stop(&vcap->vdev.entity); in vimc_cap_stop_streaming()
279 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_ERROR); in vimc_cap_stop_streaming()
284 struct vimc_cap_device *vcap = vb2_get_drv_priv(vb2_buf->vb2_queue); in vimc_cap_buf_queue() local
289 spin_lock(&vcap->qlock); in vimc_cap_buf_queue()
290 list_add_tail(&buf->list, &vcap->buf_list); in vimc_cap_buf_queue()
291 spin_unlock(&vcap->qlock); in vimc_cap_buf_queue()
298 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); in vimc_cap_queue_setup() local
301 return sizes[0] < vcap->format.sizeimage ? -EINVAL : 0; in vimc_cap_queue_setup()
304 sizes[0] = vcap->format.sizeimage; in vimc_cap_queue_setup()
311 struct vimc_cap_device *vcap = vb2_get_drv_priv(vb->vb2_queue); in vimc_cap_buffer_prepare() local
312 unsigned long size = vcap->format.sizeimage; in vimc_cap_buffer_prepare()
315 dev_err(vcap->ved.dev, "%s: buffer too small (%lu < %lu)\n", in vimc_cap_buffer_prepare()
316 vcap->vdev.name, vb2_plane_size(vb, 0), size); in vimc_cap_buffer_prepare()
342 struct vimc_cap_device *vcap = in vimc_cap_release() local
345 media_entity_cleanup(vcap->ved.ent); in vimc_cap_release()
346 kfree(vcap); in vimc_cap_release()
351 struct vimc_cap_device *vcap = in vimc_cap_unregister() local
354 vb2_video_unregister_device(&vcap->vdev); in vimc_cap_unregister()
360 struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, in vimc_cap_process_frame() local
365 spin_lock(&vcap->qlock); in vimc_cap_process_frame()
368 vimc_buf = list_first_entry_or_null(&vcap->buf_list, in vimc_cap_process_frame()
371 spin_unlock(&vcap->qlock); in vimc_cap_process_frame()
378 spin_unlock(&vcap->qlock); in vimc_cap_process_frame()
382 vimc_buf->vb2.sequence = vcap->sequence++; in vimc_cap_process_frame()
383 vimc_buf->vb2.field = vcap->format.field; in vimc_cap_process_frame()
387 memcpy(vbuf, frame, vcap->format.sizeimage); in vimc_cap_process_frame()
391 vcap->format.sizeimage); in vimc_cap_process_frame()
401 struct vimc_cap_device *vcap; in vimc_cap_add() local
407 vcap = kzalloc(sizeof(*vcap), GFP_KERNEL); in vimc_cap_add()
408 if (!vcap) in vimc_cap_add()
412 vcap->vdev.entity.name = vcfg_name; in vimc_cap_add()
413 vcap->vdev.entity.function = MEDIA_ENT_F_IO_V4L; in vimc_cap_add()
414 vcap->pad.flags = MEDIA_PAD_FL_SINK; in vimc_cap_add()
415 ret = media_entity_pads_init(&vcap->vdev.entity, in vimc_cap_add()
416 1, &vcap->pad); in vimc_cap_add()
421 mutex_init(&vcap->lock); in vimc_cap_add()
424 q = &vcap->queue; in vimc_cap_add()
427 q->drv_priv = vcap; in vimc_cap_add()
433 q->lock = &vcap->lock; in vimc_cap_add()
443 INIT_LIST_HEAD(&vcap->buf_list); in vimc_cap_add()
444 spin_lock_init(&vcap->qlock); in vimc_cap_add()
447 vcap->format = fmt_default; in vimc_cap_add()
448 vpix = vimc_pix_map_by_pixelformat(vcap->format.pixelformat); in vimc_cap_add()
449 vcap->format.bytesperline = vcap->format.width * vpix->bpp; in vimc_cap_add()
450 vcap->format.sizeimage = vcap->format.bytesperline * in vimc_cap_add()
451 vcap->format.height; in vimc_cap_add()
454 vcap->ved.ent = &vcap->vdev.entity; in vimc_cap_add()
455 vcap->ved.process_frame = vimc_cap_process_frame; in vimc_cap_add()
456 vcap->ved.vdev_get_format = vimc_cap_get_format; in vimc_cap_add()
457 vcap->ved.dev = vimc->mdev.dev; in vimc_cap_add()
460 vdev = &vcap->vdev; in vimc_cap_add()
467 vdev->lock = &vcap->lock; in vimc_cap_add()
472 video_set_drvdata(vdev, &vcap->ved); in vimc_cap_add()
478 vcap->vdev.name, ret); in vimc_cap_add()
482 return &vcap->ved; in vimc_cap_add()
485 media_entity_cleanup(&vcap->vdev.entity); in vimc_cap_add()
487 kfree(vcap); in vimc_cap_add()