1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef __VSP1_HISTO_H__
15#define __VSP1_HISTO_H__
16
17#include <linux/list.h>
18#include <linux/mutex.h>
19#include <linux/spinlock.h>
20
21#include <media/media-entity.h>
22#include <media/v4l2-dev.h>
23#include <media/videobuf2-v4l2.h>
24
25#include "vsp1_entity.h"
26
27struct vsp1_device;
28struct vsp1_pipeline;
29
30#define HISTO_PAD_SINK 0
31#define HISTO_PAD_SOURCE 1
32
33struct vsp1_histogram_buffer {
34 struct vb2_v4l2_buffer buf;
35 struct list_head queue;
36 void *addr;
37};
38
39struct vsp1_histogram {
40 struct vsp1_pipeline *pipe;
41
42 struct vsp1_entity entity;
43 struct video_device video;
44 struct media_pad pad;
45
46 const u32 *formats;
47 unsigned int num_formats;
48 size_t data_size;
49 u32 meta_format;
50
51 struct mutex lock;
52 struct vb2_queue queue;
53
54 spinlock_t irqlock;
55 struct list_head irqqueue;
56
57 wait_queue_head_t wait_queue;
58 bool readout;
59};
60
61static inline struct vsp1_histogram *vdev_to_histo(struct video_device *vdev)
62{
63 return container_of(vdev, struct vsp1_histogram, video);
64}
65
66static inline struct vsp1_histogram *subdev_to_histo(struct v4l2_subdev *subdev)
67{
68 return container_of(subdev, struct vsp1_histogram, entity.subdev);
69}
70
71int 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);
76void vsp1_histogram_destroy(struct vsp1_entity *entity);
77
78struct vsp1_histogram_buffer *
79vsp1_histogram_buffer_get(struct vsp1_histogram *histo);
80void vsp1_histogram_buffer_complete(struct vsp1_histogram *histo,
81 struct vsp1_histogram_buffer *buf,
82 size_t size);
83
84#endif
85