Lines Matching refs:vcapture

69 	struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device,  in vimc_capture_get_format()  local
72 *fmt = vcapture->format; in vimc_capture_get_format()
78 struct vimc_capture_device *vcapture = video_drvdata(file); in vimc_capture_g_fmt_vid_cap() local
80 f->fmt.pix = vcapture->format; in vimc_capture_g_fmt_vid_cap()
120 struct vimc_capture_device *vcapture = video_drvdata(file); in vimc_capture_s_fmt_vid_cap() local
124 if (vb2_is_busy(&vcapture->queue)) in vimc_capture_s_fmt_vid_cap()
131 dev_dbg(vcapture->ved.dev, "%s: format update: " in vimc_capture_s_fmt_vid_cap()
133 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcapture->vdev.name, in vimc_capture_s_fmt_vid_cap()
135 vcapture->format.width, vcapture->format.height, in vimc_capture_s_fmt_vid_cap()
136 vcapture->format.pixelformat, vcapture->format.colorspace, in vimc_capture_s_fmt_vid_cap()
137 vcapture->format.quantization, vcapture->format.xfer_func, in vimc_capture_s_fmt_vid_cap()
138 vcapture->format.ycbcr_enc, in vimc_capture_s_fmt_vid_cap()
145 vcapture->format = f->fmt.pix; in vimc_capture_s_fmt_vid_cap()
226 static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture, in vimc_capture_return_all_buffers() argument
231 spin_lock(&vcapture->qlock); in vimc_capture_return_all_buffers()
233 list_for_each_entry_safe(vbuf, node, &vcapture->buf_list, list) { in vimc_capture_return_all_buffers()
238 spin_unlock(&vcapture->qlock); in vimc_capture_return_all_buffers()
243 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_start_streaming() local
246 vcapture->sequence = 0; in vimc_capture_start_streaming()
249 ret = video_device_pipeline_start(&vcapture->vdev, &vcapture->stream.pipe); in vimc_capture_start_streaming()
251 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); in vimc_capture_start_streaming()
255 ret = vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 1); in vimc_capture_start_streaming()
257 video_device_pipeline_stop(&vcapture->vdev); in vimc_capture_start_streaming()
258 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); in vimc_capture_start_streaming()
271 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_stop_streaming() local
273 vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 0); in vimc_capture_stop_streaming()
276 video_device_pipeline_stop(&vcapture->vdev); in vimc_capture_stop_streaming()
279 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_ERROR); in vimc_capture_stop_streaming()
284 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb2_buf->vb2_queue); in vimc_capture_buf_queue() local
289 spin_lock(&vcapture->qlock); in vimc_capture_buf_queue()
290 list_add_tail(&buf->list, &vcapture->buf_list); in vimc_capture_buf_queue()
291 spin_unlock(&vcapture->qlock); in vimc_capture_buf_queue()
298 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_queue_setup() local
301 return sizes[0] < vcapture->format.sizeimage ? -EINVAL : 0; in vimc_capture_queue_setup()
304 sizes[0] = vcapture->format.sizeimage; in vimc_capture_queue_setup()
311 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb->vb2_queue); in vimc_capture_buffer_prepare() local
312 unsigned long size = vcapture->format.sizeimage; in vimc_capture_buffer_prepare()
315 dev_err(vcapture->ved.dev, "%s: buffer too small (%lu < %lu)\n", in vimc_capture_buffer_prepare()
316 vcapture->vdev.name, vb2_plane_size(vb, 0), size); in vimc_capture_buffer_prepare()
342 struct vimc_capture_device *vcapture = in vimc_capture_release() local
345 media_entity_cleanup(vcapture->ved.ent); in vimc_capture_release()
346 kfree(vcapture); in vimc_capture_release()
351 struct vimc_capture_device *vcapture = in vimc_capture_unregister() local
354 vb2_video_unregister_device(&vcapture->vdev); in vimc_capture_unregister()
360 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, in vimc_capture_process_frame() local
365 spin_lock(&vcapture->qlock); in vimc_capture_process_frame()
368 vimc_buf = list_first_entry_or_null(&vcapture->buf_list, in vimc_capture_process_frame()
371 spin_unlock(&vcapture->qlock); in vimc_capture_process_frame()
378 spin_unlock(&vcapture->qlock); in vimc_capture_process_frame()
382 vimc_buf->vb2.sequence = vcapture->sequence++; in vimc_capture_process_frame()
383 vimc_buf->vb2.field = vcapture->format.field; in vimc_capture_process_frame()
387 memcpy(vbuf, frame, vcapture->format.sizeimage); in vimc_capture_process_frame()
391 vcapture->format.sizeimage); in vimc_capture_process_frame()
401 struct vimc_capture_device *vcapture; in vimc_capture_add() local
407 vcapture = kzalloc(sizeof(*vcapture), GFP_KERNEL); in vimc_capture_add()
408 if (!vcapture) in vimc_capture_add()
412 vcapture->vdev.entity.name = vcfg_name; in vimc_capture_add()
413 vcapture->vdev.entity.function = MEDIA_ENT_F_IO_V4L; in vimc_capture_add()
414 vcapture->pad.flags = MEDIA_PAD_FL_SINK; in vimc_capture_add()
415 ret = media_entity_pads_init(&vcapture->vdev.entity, in vimc_capture_add()
416 1, &vcapture->pad); in vimc_capture_add()
421 mutex_init(&vcapture->lock); in vimc_capture_add()
424 q = &vcapture->queue; in vimc_capture_add()
429 q->drv_priv = vcapture; in vimc_capture_add()
436 q->lock = &vcapture->lock; in vimc_capture_add()
447 INIT_LIST_HEAD(&vcapture->buf_list); in vimc_capture_add()
448 spin_lock_init(&vcapture->qlock); in vimc_capture_add()
451 vcapture->format = fmt_default; in vimc_capture_add()
452 vpix = vimc_pix_map_by_pixelformat(vcapture->format.pixelformat); in vimc_capture_add()
453 vcapture->format.bytesperline = vcapture->format.width * vpix->bpp; in vimc_capture_add()
454 vcapture->format.sizeimage = vcapture->format.bytesperline * in vimc_capture_add()
455 vcapture->format.height; in vimc_capture_add()
458 vcapture->ved.ent = &vcapture->vdev.entity; in vimc_capture_add()
459 vcapture->ved.process_frame = vimc_capture_process_frame; in vimc_capture_add()
460 vcapture->ved.vdev_get_format = vimc_capture_get_format; in vimc_capture_add()
461 vcapture->ved.dev = vimc->mdev.dev; in vimc_capture_add()
464 vdev = &vcapture->vdev; in vimc_capture_add()
471 vdev->lock = &vcapture->lock; in vimc_capture_add()
476 video_set_drvdata(vdev, &vcapture->ved); in vimc_capture_add()
482 vcapture->vdev.name, ret); in vimc_capture_add()
486 return &vcapture->ved; in vimc_capture_add()
489 media_entity_cleanup(&vcapture->vdev.entity); in vimc_capture_add()
491 kfree(vcapture); in vimc_capture_add()