1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef __VSP1_ENTITY_H__
14#define __VSP1_ENTITY_H__
15
16#include <linux/list.h>
17#include <linux/mutex.h>
18
19#include <media/v4l2-subdev.h>
20
21struct vsp1_device;
22struct vsp1_video;
23
24enum vsp1_entity_type {
25 VSP1_ENTITY_BRU,
26 VSP1_ENTITY_HSI,
27 VSP1_ENTITY_HST,
28 VSP1_ENTITY_LIF,
29 VSP1_ENTITY_LUT,
30 VSP1_ENTITY_RPF,
31 VSP1_ENTITY_SRU,
32 VSP1_ENTITY_UDS,
33 VSP1_ENTITY_WPF,
34};
35
36
37
38
39
40
41
42
43
44
45
46
47
48struct vsp1_route {
49 enum vsp1_entity_type type;
50 unsigned int index;
51 unsigned int reg;
52 unsigned int inputs[4];
53};
54
55struct vsp1_entity {
56 struct vsp1_device *vsp1;
57
58 enum vsp1_entity_type type;
59 unsigned int index;
60 const struct vsp1_route *route;
61
62 struct list_head list_dev;
63 struct list_head list_pipe;
64
65 struct media_pad *pads;
66 unsigned int source_pad;
67
68 struct media_entity *sink;
69 unsigned int sink_pad;
70
71 struct v4l2_subdev subdev;
72 struct v4l2_mbus_framefmt *formats;
73
74 struct vsp1_video *video;
75
76 struct mutex lock;
77 bool streaming;
78};
79
80static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
81{
82 return container_of(subdev, struct vsp1_entity, subdev);
83}
84
85int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
86 unsigned int num_pads);
87void vsp1_entity_destroy(struct vsp1_entity *entity);
88
89extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
90extern const struct media_entity_operations vsp1_media_ops;
91
92struct v4l2_mbus_framefmt *
93vsp1_entity_get_pad_format(struct vsp1_entity *entity,
94 struct v4l2_subdev_fh *fh,
95 unsigned int pad, u32 which);
96void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
97 struct v4l2_subdev_fh *fh);
98
99bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
100int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
101
102#endif
103