Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / media / platform / vsp1 / vsp1_histo.h
blob06f029846244abeb3601b4c828e199bbbceb5da7
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
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)
9 */
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"
23 struct vsp1_device;
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;
31 void *addr;
34 struct vsp1_histogram {
35 struct vsp1_entity entity;
36 struct video_device video;
37 struct media_pad pad;
39 const u32 *formats;
40 unsigned int num_formats;
41 size_t data_size;
42 u32 meta_format;
44 struct mutex lock;
45 struct vb2_queue queue;
47 spinlock_t irqlock;
48 struct list_head irqqueue;
50 wait_queue_head_t wait_queue;
51 bool readout;
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,
75 size_t size);
77 #endif /* __VSP1_HISTO_H__ */