Lines Matching refs:histo
36 vsp1_histogram_buffer_get(struct vsp1_histogram *histo) in vsp1_histogram_buffer_get() argument
40 spin_lock(&histo->irqlock); in vsp1_histogram_buffer_get()
42 if (list_empty(&histo->irqqueue)) in vsp1_histogram_buffer_get()
45 buf = list_first_entry(&histo->irqqueue, struct vsp1_histogram_buffer, in vsp1_histogram_buffer_get()
48 histo->readout = true; in vsp1_histogram_buffer_get()
51 spin_unlock(&histo->irqlock); in vsp1_histogram_buffer_get()
55 void vsp1_histogram_buffer_complete(struct vsp1_histogram *histo, in vsp1_histogram_buffer_complete() argument
59 struct vsp1_pipeline *pipe = histo->entity.pipe; in vsp1_histogram_buffer_complete()
71 spin_lock(&histo->irqlock); in vsp1_histogram_buffer_complete()
72 histo->readout = false; in vsp1_histogram_buffer_complete()
73 wake_up(&histo->wait_queue); in vsp1_histogram_buffer_complete()
74 spin_unlock(&histo->irqlock); in vsp1_histogram_buffer_complete()
85 struct vsp1_histogram *histo = vb2_get_drv_priv(vq); in histo_queue_setup() local
91 if (sizes[0] < histo->data_size) in histo_queue_setup()
98 sizes[0] = histo->data_size; in histo_queue_setup()
106 struct vsp1_histogram *histo = vb2_get_drv_priv(vb->vb2_queue); in histo_buffer_prepare() local
112 if (vb2_plane_size(vb, 0) < histo->data_size) in histo_buffer_prepare()
123 struct vsp1_histogram *histo = vb2_get_drv_priv(vb->vb2_queue); in histo_buffer_queue() local
126 spin_lock_irq(&histo->irqlock); in histo_buffer_queue()
127 list_add_tail(&buf->queue, &histo->irqqueue); in histo_buffer_queue()
128 spin_unlock_irq(&histo->irqlock); in histo_buffer_queue()
138 struct vsp1_histogram *histo = vb2_get_drv_priv(vq); in histo_stop_streaming() local
141 spin_lock_irq(&histo->irqlock); in histo_stop_streaming()
144 list_for_each_entry(buffer, &histo->irqqueue, queue) in histo_stop_streaming()
146 INIT_LIST_HEAD(&histo->irqqueue); in histo_stop_streaming()
149 wait_event_lock_irq(histo->wait_queue, !histo->readout, histo->irqlock); in histo_stop_streaming()
151 spin_unlock_irq(&histo->irqlock); in histo_stop_streaming()
172 struct vsp1_histogram *histo = subdev_to_histo(subdev); in histo_enum_mbus_code() local
180 histo->formats, in histo_enum_mbus_code()
181 histo->num_formats); in histo_enum_mbus_code()
201 struct vsp1_histogram *histo = subdev_to_histo(subdev); in histo_get_selection() local
210 mutex_lock(&histo->entity.lock); in histo_get_selection()
212 state = vsp1_entity_get_state(&histo->entity, sd_state, sel->which); in histo_get_selection()
251 mutex_unlock(&histo->entity.lock); in histo_get_selection()
328 struct vsp1_histogram *histo = subdev_to_histo(subdev); in histo_set_selection() local
335 mutex_lock(&histo->entity.lock); in histo_set_selection()
337 state = vsp1_entity_get_state(&histo->entity, sd_state, sel->which); in histo_set_selection()
351 mutex_unlock(&histo->entity.lock); in histo_set_selection()
359 struct vsp1_histogram *histo = subdev_to_histo(subdev); in histo_set_format() local
372 histo->formats, histo->num_formats, in histo_set_format()
398 struct vsp1_histogram *histo = vdev_to_histo(vfh->vdev); in histo_v4l2_querycap() local
406 strscpy(cap->card, histo->video.name, sizeof(cap->card)); in histo_v4l2_querycap()
415 struct vsp1_histogram *histo = vdev_to_histo(vfh->vdev); in histo_v4l2_enum_format() local
417 if (f->index > 0 || f->type != histo->queue.type) in histo_v4l2_enum_format()
420 f->pixelformat = histo->meta_format; in histo_v4l2_enum_format()
429 struct vsp1_histogram *histo = vdev_to_histo(vfh->vdev); in histo_v4l2_get_format() local
432 if (format->type != histo->queue.type) in histo_v4l2_get_format()
437 meta->dataformat = histo->meta_format; in histo_v4l2_get_format()
438 meta->buffersize = histo->data_size; in histo_v4l2_get_format()
472 static void vsp1_histogram_cleanup(struct vsp1_histogram *histo) in vsp1_histogram_cleanup() argument
474 if (video_is_registered(&histo->video)) in vsp1_histogram_cleanup()
475 video_unregister_device(&histo->video); in vsp1_histogram_cleanup()
477 media_entity_cleanup(&histo->video.entity); in vsp1_histogram_cleanup()
482 struct vsp1_histogram *histo = subdev_to_histo(&entity->subdev); in vsp1_histogram_destroy() local
484 vsp1_histogram_cleanup(histo); in vsp1_histogram_destroy()
487 int vsp1_histogram_init(struct vsp1_device *vsp1, struct vsp1_histogram *histo, in vsp1_histogram_init() argument
495 histo->formats = formats; in vsp1_histogram_init()
496 histo->num_formats = num_formats; in vsp1_histogram_init()
497 histo->data_size = data_size; in vsp1_histogram_init()
498 histo->meta_format = meta_format; in vsp1_histogram_init()
500 histo->pad.flags = MEDIA_PAD_FL_SINK; in vsp1_histogram_init()
501 histo->video.vfl_dir = VFL_DIR_RX; in vsp1_histogram_init()
503 mutex_init(&histo->lock); in vsp1_histogram_init()
504 spin_lock_init(&histo->irqlock); in vsp1_histogram_init()
505 INIT_LIST_HEAD(&histo->irqqueue); in vsp1_histogram_init()
506 init_waitqueue_head(&histo->wait_queue); in vsp1_histogram_init()
509 histo->entity.ops = ops; in vsp1_histogram_init()
510 histo->entity.type = type; in vsp1_histogram_init()
512 ret = vsp1_entity_init(vsp1, &histo->entity, name, 2, &histo_ops, in vsp1_histogram_init()
518 ret = media_entity_pads_init(&histo->video.entity, 1, &histo->pad); in vsp1_histogram_init()
523 histo->video.v4l2_dev = &vsp1->v4l2_dev; in vsp1_histogram_init()
524 histo->video.fops = &histo_v4l2_fops; in vsp1_histogram_init()
525 snprintf(histo->video.name, sizeof(histo->video.name), in vsp1_histogram_init()
526 "%s histo", histo->entity.subdev.name); in vsp1_histogram_init()
527 histo->video.vfl_type = VFL_TYPE_VIDEO; in vsp1_histogram_init()
528 histo->video.release = video_device_release_empty; in vsp1_histogram_init()
529 histo->video.ioctl_ops = &histo_v4l2_ioctl_ops; in vsp1_histogram_init()
530 histo->video.device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; in vsp1_histogram_init()
532 video_set_drvdata(&histo->video, histo); in vsp1_histogram_init()
535 histo->queue.type = V4L2_BUF_TYPE_META_CAPTURE; in vsp1_histogram_init()
536 histo->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; in vsp1_histogram_init()
537 histo->queue.lock = &histo->lock; in vsp1_histogram_init()
538 histo->queue.drv_priv = histo; in vsp1_histogram_init()
539 histo->queue.buf_struct_size = sizeof(struct vsp1_histogram_buffer); in vsp1_histogram_init()
540 histo->queue.ops = &histo_video_queue_qops; in vsp1_histogram_init()
541 histo->queue.mem_ops = &vb2_vmalloc_memops; in vsp1_histogram_init()
542 histo->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; in vsp1_histogram_init()
543 histo->queue.dev = vsp1->dev; in vsp1_histogram_init()
544 ret = vb2_queue_init(&histo->queue); in vsp1_histogram_init()
551 histo->video.queue = &histo->queue; in vsp1_histogram_init()
552 ret = video_register_device(&histo->video, VFL_TYPE_VIDEO, -1); in vsp1_histogram_init()
561 vsp1_histogram_cleanup(histo); in vsp1_histogram_init()