1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * vsp1_histo.h -- R-Car VSP1 Histogram API
5 * Copyright (C) 2016 Renesas Electronics Corporation
6 * Copyright (C) 2016 Laurent Pinchart
8 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
10 #ifndef __VSP1_HISTO_H__
11 #define __VSP1_HISTO_H__
13 #include <linux/list.h>
14 #include <linux/mutex.h>
15 #include <linux/spinlock.h>
17 #include <media/media-entity.h>
18 #include <media/v4l2-dev.h>
19 #include <media/videobuf2-v4l2.h>
21 #include "vsp1_entity.h"
25 #define HISTO_PAD_SINK 0
26 #define HISTO_PAD_SOURCE 1
28 struct vsp1_histogram_buffer
{
29 struct vb2_v4l2_buffer buf
;
30 struct list_head queue
;
34 struct vsp1_histogram
{
35 struct vsp1_entity entity
;
36 struct video_device video
;
40 unsigned int num_formats
;
45 struct vb2_queue queue
;
48 struct list_head irqqueue
;
50 wait_queue_head_t wait_queue
;
54 static inline struct vsp1_histogram
*vdev_to_histo(struct video_device
*vdev
)
56 return container_of(vdev
, struct vsp1_histogram
, video
);
59 static inline struct vsp1_histogram
*subdev_to_histo(struct v4l2_subdev
*subdev
)
61 return container_of(subdev
, struct vsp1_histogram
, entity
.subdev
);
64 int vsp1_histogram_init(struct vsp1_device
*vsp1
, struct vsp1_histogram
*histo
,
65 enum vsp1_entity_type type
, const char *name
,
66 const struct vsp1_entity_operations
*ops
,
67 const unsigned int *formats
, unsigned int num_formats
,
68 size_t data_size
, u32 meta_format
);
69 void vsp1_histogram_destroy(struct vsp1_entity
*entity
);
71 struct vsp1_histogram_buffer
*
72 vsp1_histogram_buffer_get(struct vsp1_histogram
*histo
);
73 void vsp1_histogram_buffer_complete(struct vsp1_histogram
*histo
,
74 struct vsp1_histogram_buffer
*buf
,
77 #endif /* __VSP1_HISTO_H__ */