aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/videodev.h58
-rw-r--r--include/linux/videodev2.h135
-rw-r--r--include/media/v4l2-common.h6
-rw-r--r--include/media/v4l2-dev.h371
-rw-r--r--include/media/video-buf.h1
5 files changed, 408 insertions, 163 deletions
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 91140091ced2..5b6205544a7a 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -1,49 +1,28 @@
1/*
2 * Video for Linux version 1 - OBSOLETE
3 *
4 * Header file for v4l1 drivers and applications, for
5 * Linux kernels 2.2.x or 2.4.x.
6 *
7 * Provides header for legacy drivers and applications
8 *
9 * See http://linuxtv.org for more info
10 *
11 */
1#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
2#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
3 14
4#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/poll.h>
17#include <linux/fs.h>
18#include <linux/device.h>
19#include <linux/mutex.h>
20#include <linux/compiler.h> /* need __user */
5 21
6#define HAVE_V4L1 1 22#define HAVE_V4L1 1
7 23
8#include <linux/videodev2.h> 24#include <linux/videodev2.h>
9 25
10#ifdef __KERNEL__
11
12#include <linux/mm.h>
13
14extern struct video_device* video_devdata(struct file*);
15
16#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
17static inline void
18video_device_create_file(struct video_device *vfd,
19 struct class_device_attribute *attr)
20{
21 class_device_create_file(&vfd->class_dev, attr);
22}
23static inline void
24video_device_remove_file(struct video_device *vfd,
25 struct class_device_attribute *attr)
26{
27 class_device_remove_file(&vfd->class_dev, attr);
28}
29
30#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
31/* helper functions to access driver private data. */
32static inline void *video_get_drvdata(struct video_device *dev)
33{
34 return dev->priv;
35}
36
37static inline void video_set_drvdata(struct video_device *dev, void *data)
38{
39 dev->priv = data;
40}
41#endif
42
43extern int video_exclusive_open(struct inode *inode, struct file *file);
44extern int video_exclusive_release(struct inode *inode, struct file *file);
45#endif /* __KERNEL__ */
46
47struct video_capability 26struct video_capability
48{ 27{
49 char name[32]; 28 char name[32];
@@ -363,6 +342,11 @@ struct video_code
363#define VID_HARDWARE_SAA7114H 37 342#define VID_HARDWARE_SAA7114H 37
364#define VID_HARDWARE_SN9C102 38 343#define VID_HARDWARE_SN9C102 38
365#define VID_HARDWARE_ARV 39 344#define VID_HARDWARE_ARV 39
345
346#ifdef __KERNEL__
347#include <media/v4l2-dev.h>
348#endif /* __KERNEL__ */
349
366#endif /* __LINUX_VIDEODEV_H */ 350#endif /* __LINUX_VIDEODEV_H */
367 351
368/* 352/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b3a848b6fb1c..bb58197ab6b9 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,29 +1,23 @@
1#ifndef __LINUX_VIDEODEV2_H
2#define __LINUX_VIDEODEV2_H
3/* 1/*
4 * Video for Linux Two 2 * Video for Linux Two
5 * 3 *
6 * Header file for v4l or V4L2 drivers and applications, for 4 * Header file for v4l or V4L2 drivers and applications
7 * Linux kernels 2.2.x or 2.4.x. 5 * with public API.
6 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
7 * no #if __KERNEL tests are allowed here
8 * 8 *
9 * See http://bytesex.org/v4l/ for API specs and other 9 * See http://linuxtv.org for more info
10 * v4l2 documentation.
11 * 10 *
12 * Author: Bill Dirks <bdirks@pacbell.net> 11 * Author: Bill Dirks <bdirks@pacbell.net>
13 * Justin Schoeman 12 * Justin Schoeman
14 * et al. 13 * et al.
15 */ 14 */
16#ifdef __KERNEL__ 15#ifndef __LINUX_VIDEODEV2_H
16#define __LINUX_VIDEODEV2_H
17#include <linux/time.h> /* need struct timeval */ 17#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h>
19#include <linux/device.h>
20#include <linux/mutex.h>
21#endif
22#include <linux/types.h> 18#include <linux/types.h>
23#include <linux/compiler.h> /* need __user */ 19#include <linux/compiler.h> /* need __user */
24 20
25
26#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */
27#define HAVE_V4L2 1 21#define HAVE_V4L2 1
28 22
29/* 23/*
@@ -48,71 +42,6 @@
48#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 42#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
49#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 43#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
50 44
51#ifdef __KERNEL__
52
53/* Minor device allocation */
54#define MINOR_VFL_TYPE_GRABBER_MIN 0
55#define MINOR_VFL_TYPE_GRABBER_MAX 63
56#define MINOR_VFL_TYPE_RADIO_MIN 64
57#define MINOR_VFL_TYPE_RADIO_MAX 127
58#define MINOR_VFL_TYPE_VTX_MIN 192
59#define MINOR_VFL_TYPE_VTX_MAX 223
60#define MINOR_VFL_TYPE_VBI_MIN 224
61#define MINOR_VFL_TYPE_VBI_MAX 255
62
63#define VFL_TYPE_GRABBER 0
64#define VFL_TYPE_VBI 1
65#define VFL_TYPE_RADIO 2
66#define VFL_TYPE_VTX 3
67
68struct video_device
69{
70 /* device info */
71 struct device *dev;
72 char name[32];
73 int type; /* v4l1 */
74 int type2; /* v4l2 */
75 int hardware;
76 int minor;
77
78 /* device ops + callbacks */
79 const struct file_operations *fops;
80 void (*release)(struct video_device *vfd);
81
82
83#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
84 /* obsolete -- fops->owner is used instead */
85 struct module *owner;
86 /* dev->driver_data will be used instead some day.
87 * Use the video_{get|set}_drvdata() helper functions,
88 * so the switch over will be transparent for you.
89 * Or use {pci|usb}_{get|set}_drvdata() directly. */
90 void *priv;
91#endif
92
93 /* for videodev.c intenal usage -- please don't touch */
94 int users; /* video_exclusive_{open|close} ... */
95 struct mutex lock; /* ... helper function uses these */
96 char devfs_name[64]; /* devfs */
97 struct class_device class_dev; /* sysfs */
98};
99
100#define VIDEO_MAJOR 81
101
102extern int video_register_device(struct video_device *, int type, int nr);
103extern void video_unregister_device(struct video_device *);
104extern int video_usercopy(struct inode *inode, struct file *file,
105 unsigned int cmd, unsigned long arg,
106 int (*func)(struct inode *inode, struct file *file,
107 unsigned int cmd, void *arg));
108
109/* helper functions to alloc / release struct video_device, the
110 later can be used for video_device->release() */
111struct video_device *video_device_alloc(void);
112void video_device_release(struct video_device *vfd);
113
114#endif
115
116/* 45/*
117 * M I S C E L L A N E O U S 46 * M I S C E L L A N E O U S
118 */ 47 */
@@ -1098,6 +1027,7 @@ struct v4l2_streamparm
1098#endif 1027#endif
1099#define VIDIOC_LOG_STATUS _IO ('V', 70) 1028#define VIDIOC_LOG_STATUS _IO ('V', 70)
1100 1029
1030#ifdef __OLD_VIDIOC_
1101/* for compatibility, will go away some day */ 1031/* for compatibility, will go away some day */
1102#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1032#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
1103#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1033#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
@@ -1105,57 +1035,10 @@ struct v4l2_streamparm
1105#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1035#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
1106#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1036#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
1107#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1037#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
1108
1109#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1110
1111
1112#ifdef __KERNEL__
1113/*
1114 *
1115 * V 4 L 2 D R I V E R H E L P E R A P I
1116 *
1117 * Some commonly needed functions for drivers (v4l2-common.o module)
1118 */
1119#include <linux/fs.h>
1120
1121/* Video standard functions */
1122extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
1123extern int v4l2_video_std_construct(struct v4l2_standard *vs,
1124 int id, char *name);
1125
1126/* prority handling */
1127struct v4l2_prio_state {
1128 atomic_t prios[4];
1129};
1130int v4l2_prio_init(struct v4l2_prio_state *global);
1131int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
1132 enum v4l2_priority new);
1133int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
1134int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
1135enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
1136int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1137
1138/* names for fancy debug output */
1139extern char *v4l2_field_names[];
1140extern char *v4l2_type_names[];
1141
1142/* Compatibility layer interface -- v4l1-compat module */
1143typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1144 unsigned int cmd, void *arg);
1145
1146#ifdef CONFIG_VIDEO_V4L1_COMPAT
1147int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1148 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1149#else
1150#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
1151#endif 1038#endif
1152 1039
1153/* 32 Bits compatibility layer for 64 bits processors */ 1040#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1154extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1155 unsigned long arg);
1156
1157 1041
1158#endif /* __KERNEL__ */
1159#endif /* __LINUX_VIDEODEV2_H */ 1042#endif /* __LINUX_VIDEODEV2_H */
1160 1043
1161/* 1044/*
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index e94aff029cc5..1440d4ab6af9 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -26,8 +26,14 @@
26#ifndef V4L2_COMMON_H_ 26#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_ 27#define V4L2_COMMON_H_
28 28
29#include <media/v4l2-dev.h>
30
29/* v4l debugging and diagnostics */ 31/* v4l debugging and diagnostics */
30 32
33/* Debug bitmask flags to be used on V4L2 */
34#define V4L2_DEBUG_IOCTL 0x01
35#define V4L2_DEBUG_IOCTL_ARG 0x02
36
31/* Common printk constucts for v4l-i2c drivers. These macros create a unique 37/* Common printk constucts for v4l-i2c drivers. These macros create a unique
32 prefix consisting of the driver name, the adapter number and the i2c 38 prefix consisting of the driver name, the adapter number and the i2c
33 address. */ 39 address. */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
new file mode 100644
index 000000000000..c2f54d2c9a4c
--- /dev/null
+++ b/include/media/v4l2-dev.h
@@ -0,0 +1,371 @@
1/*
2 *
3 * V 4 L 2 D R I V E R H E L P E R A P I
4 *
5 * Moved from videodev2.h
6 *
7 * Some commonly needed functions for drivers (v4l2-common.o module)
8 */
9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H
11
12#define OBSOLETE_OWNER 1 /* to be removed soon */
13
14#include <linux/poll.h>
15#include <linux/fs.h>
16#include <linux/device.h>
17#include <linux/mutex.h>
18#include <linux/compiler.h> /* need __user */
19#ifdef CONFIG_VIDEO_V4L1
20#include <linux/videodev.h>
21#else
22#include <linux/videodev2.h>
23#endif
24
25#include <linux/fs.h>
26
27#define VIDEO_MAJOR 81
28/* Minor device allocation */
29#define MINOR_VFL_TYPE_GRABBER_MIN 0
30#define MINOR_VFL_TYPE_GRABBER_MAX 63
31#define MINOR_VFL_TYPE_RADIO_MIN 64
32#define MINOR_VFL_TYPE_RADIO_MAX 127
33#define MINOR_VFL_TYPE_VTX_MIN 192
34#define MINOR_VFL_TYPE_VTX_MAX 223
35#define MINOR_VFL_TYPE_VBI_MIN 224
36#define MINOR_VFL_TYPE_VBI_MAX 255
37
38#define VFL_TYPE_GRABBER 0
39#define VFL_TYPE_VBI 1
40#define VFL_TYPE_RADIO 2
41#define VFL_TYPE_VTX 3
42
43 const struct file_operations *fops;
44
45/* Video standard functions */
46extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
47extern int v4l2_video_std_construct(struct v4l2_standard *vs,
48 int id, char *name);
49
50/* prority handling */
51struct v4l2_prio_state {
52 atomic_t prios[4];
53};
54int v4l2_prio_init(struct v4l2_prio_state *global);
55int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
56 enum v4l2_priority new);
57int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
58int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
59enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
60int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
61
62/* names for fancy debug output */
63extern char *v4l2_field_names[];
64extern char *v4l2_type_names[];
65
66/* Compatibility layer interface -- v4l1-compat module */
67typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
68 unsigned int cmd, void *arg);
69#ifdef CONFIG_VIDEO_V4L1_COMPAT
70int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
71 int cmd, void *arg, v4l2_kioctl driver_ioctl);
72#else
73#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
74#endif
75
76/* 32 Bits compatibility layer for 64 bits processors */
77extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
78 unsigned long arg);
79
80/*
81 * Newer version of video_device, handled by videodev2.c
82 * This version moves redundant code from video device code to
83 * the common handler
84 */
85struct v4l2_tvnorm {
86 char *name;
87 v4l2_std_id id;
88
89 void *priv_data;
90};
91
92struct video_device
93{
94 /* device ops */
95 struct file_operations *fops;
96
97 /* device info */
98 struct device *dev;
99 char name[32];
100 int type; /* v4l1 */
101 int type2; /* v4l2 */
102 int hardware;
103 int minor;
104
105 int debug; /* Activates debug level*/
106
107 /* Video standard vars */
108 int tvnormsize; /* Size of tvnorm array */
109 v4l2_std_id current_norm; /* Current tvnorm */
110 struct v4l2_tvnorm *tvnorms;
111
112 /* callbacks */
113 void (*release)(struct video_device *vfd);
114
115 /* ioctl callbacks */
116
117 /* VIDIOC_QUERYCAP handler */
118 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
119
120 /* Priority handling */
121 int (*vidioc_g_priority) (struct file *file, void *fh,
122 enum v4l2_priority *p);
123 int (*vidioc_s_priority) (struct file *file, void *fh,
124 enum v4l2_priority p);
125
126 /* VIDIOC_ENUM_FMT handlers */
127 int (*vidioc_enum_fmt_cap) (struct file *file, void *fh,
128 struct v4l2_fmtdesc *f);
129 int (*vidioc_enum_fmt_overlay) (struct file *file, void *fh,
130 struct v4l2_fmtdesc *f);
131 int (*vidioc_enum_fmt_vbi) (struct file *file, void *fh,
132 struct v4l2_fmtdesc *f);
133 int (*vidioc_enum_fmt_vbi_capture) (struct file *file, void *fh,
134 struct v4l2_fmtdesc *f);
135 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
136 struct v4l2_fmtdesc *f);
137 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
138 struct v4l2_fmtdesc *f);
139 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
140 struct v4l2_fmtdesc *f);
141
142 /* VIDIOC_G_FMT handlers */
143 int (*vidioc_g_fmt_cap) (struct file *file, void *fh,
144 struct v4l2_format *f);
145 int (*vidioc_g_fmt_overlay) (struct file *file, void *fh,
146 struct v4l2_format *f);
147 int (*vidioc_g_fmt_vbi) (struct file *file, void *fh,
148 struct v4l2_format *f);
149 int (*vidioc_g_fmt_vbi_output) (struct file *file, void *fh,
150 struct v4l2_format *f);
151 int (*vidioc_g_fmt_vbi_capture)(struct file *file, void *fh,
152 struct v4l2_format *f);
153 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
154 struct v4l2_format *f);
155 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
156 struct v4l2_format *f);
157
158 /* VIDIOC_S_FMT handlers */
159 int (*vidioc_s_fmt_cap) (struct file *file, void *fh,
160 struct v4l2_format *f);
161
162 int (*vidioc_s_fmt_overlay) (struct file *file, void *fh,
163 struct v4l2_format *f);
164 int (*vidioc_s_fmt_vbi) (struct file *file, void *fh,
165 struct v4l2_format *f);
166 int (*vidioc_s_fmt_vbi_output) (struct file *file, void *fh,
167 struct v4l2_format *f);
168 int (*vidioc_s_fmt_vbi_capture)(struct file *file, void *fh,
169 struct v4l2_format *f);
170 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
171 struct v4l2_format *f);
172 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
173 struct v4l2_format *f);
174
175 /* VIDIOC_TRY_FMT handlers */
176 int (*vidioc_try_fmt_cap) (struct file *file, void *fh,
177 struct v4l2_format *f);
178 int (*vidioc_try_fmt_overlay) (struct file *file, void *fh,
179 struct v4l2_format *f);
180 int (*vidioc_try_fmt_vbi) (struct file *file, void *fh,
181 struct v4l2_format *f);
182 int (*vidioc_try_fmt_vbi_output) (struct file *file, void *fh,
183 struct v4l2_format *f);
184 int (*vidioc_try_fmt_vbi_capture)(struct file *file, void *fh,
185 struct v4l2_format *f);
186 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
187 struct v4l2_format *f);
188 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
189 struct v4l2_format *f);
190
191 /* Buffer handlers */
192 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
193 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
194 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
195 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
196
197
198 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
199#ifdef HAVE_V4L1
200 /* buffer type is struct vidio_mbuf * */
201 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p);
202#endif
203 int (*vidioc_g_fbuf) (struct file *file, void *fh,
204 struct v4l2_framebuffer *a);
205 int (*vidioc_s_fbuf) (struct file *file, void *fh,
206 struct v4l2_framebuffer *a);
207
208 /* Stream on/off */
209 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
210 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
211
212 /* Standard handling
213 G_STD and ENUMSTD are handled by videodev.c
214 */
215 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id a);
216 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
217
218 /* Input handling */
219 int (*vidioc_enum_input)(struct file *file, void *fh,
220 struct v4l2_input *inp);
221 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
222 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
223
224 /* Output handling */
225 int (*vidioc_enumoutput) (struct file *file, void *fh,
226 struct v4l2_output *a);
227 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
228 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
229
230 /* Control handling */
231 int (*vidioc_queryctrl) (struct file *file, void *fh,
232 struct v4l2_queryctrl *a);
233 int (*vidioc_g_ctrl) (struct file *file, void *fh,
234 struct v4l2_control *a);
235 int (*vidioc_s_ctrl) (struct file *file, void *fh,
236 struct v4l2_control *a);
237 int (*vidioc_querymenu) (struct file *file, void *fh,
238 struct v4l2_querymenu *a);
239
240 /* Audio ioctls */
241 int (*vidioc_enumaudio) (struct file *file, void *fh,
242 struct v4l2_audio *a);
243 int (*vidioc_g_audio) (struct file *file, void *fh,
244 struct v4l2_audio *a);
245 int (*vidioc_s_audio) (struct file *file, void *fh,
246 struct v4l2_audio *a);
247
248 /* Audio out ioctls */
249 int (*vidioc_enumaudout) (struct file *file, void *fh,
250 struct v4l2_audioout *a);
251 int (*vidioc_g_audout) (struct file *file, void *fh,
252 struct v4l2_audioout *a);
253 int (*vidioc_s_audout) (struct file *file, void *fh,
254 struct v4l2_audioout *a);
255 int (*vidioc_g_modulator) (struct file *file, void *fh,
256 struct v4l2_modulator *a);
257 int (*vidioc_s_modulator) (struct file *file, void *fh,
258 struct v4l2_modulator *a);
259 /* Crop ioctls */
260 int (*vidioc_cropcap) (struct file *file, void *fh,
261 struct v4l2_cropcap *a);
262 int (*vidioc_g_crop) (struct file *file, void *fh,
263 struct v4l2_crop *a);
264 int (*vidioc_s_crop) (struct file *file, void *fh,
265 struct v4l2_crop *a);
266 /* Compression ioctls */
267 int (*vidioc_g_mpegcomp) (struct file *file, void *fh,
268 struct v4l2_mpeg_compression *a);
269 int (*vidioc_s_mpegcomp) (struct file *file, void *fh,
270 struct v4l2_mpeg_compression *a);
271 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
272 struct v4l2_jpegcompression *a);
273 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
274 struct v4l2_jpegcompression *a);
275
276 /* Stream type-dependent parameter ioctls */
277 int (*vidioc_g_parm) (struct file *file, void *fh,
278 struct v4l2_streamparm *a);
279 int (*vidioc_s_parm) (struct file *file, void *fh,
280 struct v4l2_streamparm *a);
281
282 /* Tuner ioctls */
283 int (*vidioc_g_tuner) (struct file *file, void *fh,
284 struct v4l2_tuner *a);
285 int (*vidioc_s_tuner) (struct file *file, void *fh,
286 struct v4l2_tuner *a);
287 int (*vidioc_g_frequency) (struct file *file, void *fh,
288 struct v4l2_frequency *a);
289 int (*vidioc_s_frequency) (struct file *file, void *fh,
290 struct v4l2_frequency *a);
291
292 /* Sliced VBI cap */
293 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
294 struct v4l2_sliced_vbi_cap *a);
295
296 /* Log status ioctl */
297 int (*vidioc_log_status) (struct file *file, void *fh);
298
299
300#if OBSOLETE_OWNER /* to be removed soon */
301/* obsolete -- fops->owner is used instead */
302struct module *owner;
303/* dev->driver_data will be used instead some day.
304 * Use the video_{get|set}_drvdata() helper functions,
305 * so the switch over will be transparent for you.
306 * Or use {pci|usb}_{get|set}_drvdata() directly. */
307void *priv;
308#endif
309
310 /* for videodev.c intenal usage -- please don't touch */
311 int users; /* video_exclusive_{open|close} ... */
312 struct mutex lock; /* ... helper function uses these */
313 char devfs_name[64]; /* devfs */
314 struct class_device class_dev; /* sysfs */
315};
316
317/* Version 2 functions */
318extern int video_register_device(struct video_device *vfd, int type, int nr);
319void video_unregister_device(struct video_device *);
320extern int video_ioctl2(struct inode *inode, struct file *file,
321 unsigned int cmd, unsigned long arg);
322
323/* helper functions to alloc / release struct video_device, the
324 later can be used for video_device->release() */
325struct video_device *video_device_alloc(void);
326void video_device_release(struct video_device *vfd);
327
328/* Include support for obsoleted stuff */
329extern int video_usercopy(struct inode *inode, struct file *file,
330 unsigned int cmd, unsigned long arg,
331 int (*func)(struct inode *inode, struct file *file,
332 unsigned int cmd, void *arg));
333
334
335#ifdef HAVE_V4L1
336#include <linux/mm.h>
337
338extern struct video_device* video_devdata(struct file*);
339
340#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
341static inline void
342video_device_create_file(struct video_device *vfd,
343 struct class_device_attribute *attr)
344{
345 class_device_create_file(&vfd->class_dev, attr);
346}
347static inline void
348video_device_remove_file(struct video_device *vfd,
349 struct class_device_attribute *attr)
350{
351 class_device_remove_file(&vfd->class_dev, attr);
352}
353
354#if OBSOLETE_OWNER /* to be removed soon */
355/* helper functions to access driver private data. */
356static inline void *video_get_drvdata(struct video_device *dev)
357{
358 return dev->priv;
359}
360
361static inline void video_set_drvdata(struct video_device *dev, void *data)
362{
363 dev->priv = data;
364}
365#endif
366
367extern int video_exclusive_open(struct inode *inode, struct file *file);
368extern int video_exclusive_release(struct inode *inode, struct file *file);
369#endif /* HAVE_V4L1 */
370
371#endif /* _V4L2_DEV_H */
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index fff3fd0fbf94..1115a256969f 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <linux/poll.h>
26 27
27#define UNSET (-1U) 28#define UNSET (-1U)
28 29