2 * vsp1_histo.h -- R-Car VSP1 Histogram API
4 * Copyright (C) 2016 Renesas Electronics Corporation
5 * Copyright (C) 2016 Laurent Pinchart
7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 #ifndef __VSP1_HISTO_H__
15 #define __VSP1_HISTO_H__
17 #include <linux/list.h>
18 #include <linux/mutex.h>
19 #include <linux/spinlock.h>
21 #include <media/media-entity.h>
22 #include <media/v4l2-dev.h>
23 #include <media/videobuf2-v4l2.h>
25 #include "vsp1_entity.h"
30 #define HISTO_PAD_SINK 0
31 #define HISTO_PAD_SOURCE 1
33 struct vsp1_histogram_buffer {
34 struct vb2_v4l2_buffer buf;
35 struct list_head queue;
39 struct vsp1_histogram {
40 struct vsp1_pipeline *pipe;
42 struct vsp1_entity entity;
43 struct video_device video;
47 unsigned int num_formats;
52 struct vb2_queue queue;
55 struct list_head irqqueue;
57 wait_queue_head_t wait_queue;
61 static inline struct vsp1_histogram *vdev_to_histo(struct video_device *vdev)
63 return container_of(vdev, struct vsp1_histogram, video);
66 static inline struct vsp1_histogram *subdev_to_histo(struct v4l2_subdev *subdev)
68 return container_of(subdev, struct vsp1_histogram, entity.subdev);
71 int vsp1_histogram_init(struct vsp1_device *vsp1, struct vsp1_histogram *histo,
72 enum vsp1_entity_type type, const char *name,
73 const struct vsp1_entity_operations *ops,
74 const unsigned int *formats, unsigned int num_formats,
75 size_t data_size, u32 meta_format);
76 void vsp1_histogram_destroy(struct vsp1_entity *entity);
78 struct vsp1_histogram_buffer *
79 vsp1_histogram_buffer_get(struct vsp1_histogram *histo);
80 void vsp1_histogram_buffer_complete(struct vsp1_histogram *histo,
81 struct vsp1_histogram_buffer *buf,
84 #endif /* __VSP1_HISTO_H__ */