1
2
3
4
5
6
7
8
9
10
11#ifndef V4L2_ASYNC_H
12#define V4L2_ASYNC_H
13
14#include <linux/list.h>
15#include <linux/mutex.h>
16
17struct device;
18struct device_node;
19struct v4l2_device;
20struct v4l2_subdev;
21struct v4l2_async_notifier;
22
23
24#define V4L2_MAX_SUBDEVS 128U
25
26enum v4l2_async_match_type {
27 V4L2_ASYNC_MATCH_CUSTOM,
28 V4L2_ASYNC_MATCH_DEVNAME,
29 V4L2_ASYNC_MATCH_I2C,
30 V4L2_ASYNC_MATCH_OF,
31};
32
33
34
35
36
37
38
39
40struct v4l2_async_subdev {
41 enum v4l2_async_match_type match_type;
42 union {
43 struct {
44 const struct device_node *node;
45 } of;
46 struct {
47 const char *name;
48 } device_name;
49 struct {
50 int adapter_id;
51 unsigned short address;
52 } i2c;
53 struct {
54 bool (*match)(struct device *,
55 struct v4l2_async_subdev *);
56 void *priv;
57 } custom;
58 } match;
59
60
61 struct list_head list;
62};
63
64
65
66
67
68
69
70
71
72
73
74
75
76struct v4l2_async_notifier {
77 unsigned int num_subdevs;
78 struct v4l2_async_subdev **subdevs;
79 struct v4l2_device *v4l2_dev;
80 struct list_head waiting;
81 struct list_head done;
82 struct list_head list;
83 int (*bound)(struct v4l2_async_notifier *notifier,
84 struct v4l2_subdev *subdev,
85 struct v4l2_async_subdev *asd);
86 int (*complete)(struct v4l2_async_notifier *notifier);
87 void (*unbind)(struct v4l2_async_notifier *notifier,
88 struct v4l2_subdev *subdev,
89 struct v4l2_async_subdev *asd);
90};
91
92int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
93 struct v4l2_async_notifier *notifier);
94void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier);
95int v4l2_async_register_subdev(struct v4l2_subdev *sd);
96void v4l2_async_unregister_subdev(struct v4l2_subdev *sd);
97#endif
98