Lines Matching defs:histo
36 vsp1_histogram_buffer_get(struct vsp1_histogram *histo)
40 spin_lock(&histo->irqlock);
42 if (list_empty(&histo->irqqueue))
45 buf = list_first_entry(&histo->irqqueue, struct vsp1_histogram_buffer,
48 histo->readout = true;
51 spin_unlock(&histo->irqlock);
55 void vsp1_histogram_buffer_complete(struct vsp1_histogram *histo,
59 struct vsp1_pipeline *pipe = histo->entity.pipe;
71 spin_lock(&histo->irqlock);
72 histo->readout = false;
73 wake_up(&histo->wait_queue);
74 spin_unlock(&histo->irqlock);
85 struct vsp1_histogram *histo = vb2_get_drv_priv(vq);
91 if (sizes[0] < histo->data_size)
98 sizes[0] = histo->data_size;
106 struct vsp1_histogram *histo = vb2_get_drv_priv(vb->vb2_queue);
112 if (vb2_plane_size(vb, 0) < histo->data_size)
123 struct vsp1_histogram *histo = vb2_get_drv_priv(vb->vb2_queue);
126 spin_lock_irq(&histo->irqlock);
127 list_add_tail(&buf->queue, &histo->irqqueue);
128 spin_unlock_irq(&histo->irqlock);
138 struct vsp1_histogram *histo = vb2_get_drv_priv(vq);
141 spin_lock_irq(&histo->irqlock);
144 list_for_each_entry(buffer, &histo->irqqueue, queue)
146 INIT_LIST_HEAD(&histo->irqqueue);
149 wait_event_lock_irq(histo->wait_queue, !histo->readout, histo->irqlock);
151 spin_unlock_irq(&histo->irqlock);
170 struct vsp1_histogram *histo = subdev_to_histo(subdev);
178 histo->formats,
179 histo->num_formats);
199 struct vsp1_histogram *histo = subdev_to_histo(subdev);
208 mutex_lock(&histo->entity.lock);
210 state = vsp1_entity_get_state(&histo->entity, sd_state, sel->which);
249 mutex_unlock(&histo->entity.lock);
326 struct vsp1_histogram *histo = subdev_to_histo(subdev);
333 mutex_lock(&histo->entity.lock);
335 state = vsp1_entity_get_state(&histo->entity, sd_state, sel->which);
349 mutex_unlock(&histo->entity.lock);
357 struct vsp1_histogram *histo = subdev_to_histo(subdev);
370 histo->formats, histo->num_formats,
396 struct vsp1_histogram *histo = vdev_to_histo(vfh->vdev);
404 strscpy(cap->card, histo->video.name, sizeof(cap->card));
413 struct vsp1_histogram *histo = vdev_to_histo(vfh->vdev);
415 if (f->index > 0 || f->type != histo->queue.type)
418 f->pixelformat = histo->meta_format;
427 struct vsp1_histogram *histo = vdev_to_histo(vfh->vdev);
430 if (format->type != histo->queue.type)
435 meta->dataformat = histo->meta_format;
436 meta->buffersize = histo->data_size;
470 static void vsp1_histogram_cleanup(struct vsp1_histogram *histo)
472 if (video_is_registered(&histo->video))
473 video_unregister_device(&histo->video);
475 media_entity_cleanup(&histo->video.entity);
480 struct vsp1_histogram *histo = subdev_to_histo(&entity->subdev);
482 vsp1_histogram_cleanup(histo);
485 int vsp1_histogram_init(struct vsp1_device *vsp1, struct vsp1_histogram *histo,
493 histo->formats = formats;
494 histo->num_formats = num_formats;
495 histo->data_size = data_size;
496 histo->meta_format = meta_format;
498 histo->pad.flags = MEDIA_PAD_FL_SINK;
499 histo->video.vfl_dir = VFL_DIR_RX;
501 mutex_init(&histo->lock);
502 spin_lock_init(&histo->irqlock);
503 INIT_LIST_HEAD(&histo->irqqueue);
504 init_waitqueue_head(&histo->wait_queue);
507 histo->entity.ops = ops;
508 histo->entity.type = type;
510 ret = vsp1_entity_init(vsp1, &histo->entity, name, 2, &histo_ops,
516 ret = media_entity_pads_init(&histo->video.entity, 1, &histo->pad);
521 histo->video.v4l2_dev = &vsp1->v4l2_dev;
522 histo->video.fops = &histo_v4l2_fops;
523 snprintf(histo->video.name, sizeof(histo->video.name),
524 "%s histo", histo->entity.subdev.name);
525 histo->video.vfl_type = VFL_TYPE_VIDEO;
526 histo->video.release = video_device_release_empty;
527 histo->video.ioctl_ops = &histo_v4l2_ioctl_ops;
528 histo->video.device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
530 video_set_drvdata(&histo->video, histo);
533 histo->queue.type = V4L2_BUF_TYPE_META_CAPTURE;
534 histo->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
535 histo->queue.lock = &histo->lock;
536 histo->queue.drv_priv = histo;
537 histo->queue.buf_struct_size = sizeof(struct vsp1_histogram_buffer);
538 histo->queue.ops = &histo_video_queue_qops;
539 histo->queue.mem_ops = &vb2_vmalloc_memops;
540 histo->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
541 histo->queue.dev = vsp1->dev;
542 ret = vb2_queue_init(&histo->queue);
549 histo->video.queue = &histo->queue;
550 ret = video_register_device(&histo->video, VFL_TYPE_VIDEO, -1);
559 vsp1_histogram_cleanup(histo);