Linux-2.6.12-rc2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / videodev.h
1 #ifndef __LINUX_VIDEODEV_H
2 #define __LINUX_VIDEODEV_H
3
4 #include <linux/compiler.h>
5 #include <linux/types.h>
6 #include <linux/version.h>
7
8 #define HAVE_V4L2 1
9 #include <linux/videodev2.h>
10
11 #ifdef __KERNEL__
12
13 #include <linux/poll.h>
14 #include <linux/mm.h>
15 #include <linux/device.h>
16
17 struct video_device
18 {
19 /* device info */
20 struct device *dev;
21 char name[32];
22 int type; /* v4l1 */
23 int type2; /* v4l2 */
24 int hardware;
25 int minor;
26
27 /* device ops + callbacks */
28 struct file_operations *fops;
29 void (*release)(struct video_device *vfd);
30
31
32 #if 1 /* to be removed in 2.7.x */
33 /* obsolete -- fops->owner is used instead */
34 struct module *owner;
35 /* dev->driver_data will be used instead some day.
36 * Use the video_{get|set}_drvdata() helper functions,
37 * so the switch over will be transparent for you.
38 * Or use {pci|usb}_{get|set}_drvdata() directly. */
39 void *priv;
40 #endif
41
42 /* for videodev.c intenal usage -- please don't touch */
43 int users; /* video_exclusive_{open|close} ... */
44 struct semaphore lock; /* ... helper function uses these */
45 char devfs_name[64]; /* devfs */
46 struct class_device class_dev; /* sysfs */
47 };
48
49 #define VIDEO_MAJOR 81
50
51 #define VFL_TYPE_GRABBER 0
52 #define VFL_TYPE_VBI 1
53 #define VFL_TYPE_RADIO 2
54 #define VFL_TYPE_VTX 3
55
56 extern int video_register_device(struct video_device *, int type, int nr);
57 extern void video_unregister_device(struct video_device *);
58 extern struct video_device* video_devdata(struct file*);
59
60 #define to_video_device(cd) container_of(cd, struct video_device, class_dev)
61 static inline void
62 video_device_create_file(struct video_device *vfd,
63 struct class_device_attribute *attr)
64 {
65 class_device_create_file(&vfd->class_dev, attr);
66 }
67 static inline void
68 video_device_remove_file(struct video_device *vfd,
69 struct class_device_attribute *attr)
70 {
71 class_device_remove_file(&vfd->class_dev, attr);
72 }
73
74 /* helper functions to alloc / release struct video_device, the
75 later can be used for video_device->release() */
76 struct video_device *video_device_alloc(void);
77 void video_device_release(struct video_device *vfd);
78
79 /* helper functions to access driver private data. */
80 static inline void *video_get_drvdata(struct video_device *dev)
81 {
82 return dev->priv;
83 }
84
85 static inline void video_set_drvdata(struct video_device *dev, void *data)
86 {
87 dev->priv = data;
88 }
89
90 extern int video_exclusive_open(struct inode *inode, struct file *file);
91 extern int video_exclusive_release(struct inode *inode, struct file *file);
92 extern int video_usercopy(struct inode *inode, struct file *file,
93 unsigned int cmd, unsigned long arg,
94 int (*func)(struct inode *inode, struct file *file,
95 unsigned int cmd, void *arg));
96 #endif /* __KERNEL__ */
97
98 #define VID_TYPE_CAPTURE 1 /* Can capture */
99 #define VID_TYPE_TUNER 2 /* Can tune */
100 #define VID_TYPE_TELETEXT 4 /* Does teletext */
101 #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
102 #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
103 #define VID_TYPE_CLIPPING 32 /* Can clip */
104 #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
105 #define VID_TYPE_SCALES 128 /* Scalable */
106 #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
107 #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
108 #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
109 #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
110 #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
111 #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
112
113 struct video_capability
114 {
115 char name[32];
116 int type;
117 int channels; /* Num channels */
118 int audios; /* Num audio devices */
119 int maxwidth; /* Supported width */
120 int maxheight; /* And height */
121 int minwidth; /* Supported width */
122 int minheight; /* And height */
123 };
124
125
126 struct video_channel
127 {
128 int channel;
129 char name[32];
130 int tuners;
131 __u32 flags;
132 #define VIDEO_VC_TUNER 1 /* Channel has a tuner */
133 #define VIDEO_VC_AUDIO 2 /* Channel has audio */
134 __u16 type;
135 #define VIDEO_TYPE_TV 1
136 #define VIDEO_TYPE_CAMERA 2
137 __u16 norm; /* Norm set by channel */
138 };
139
140 struct video_tuner
141 {
142 int tuner;
143 char name[32];
144 unsigned long rangelow, rangehigh; /* Tuner range */
145 __u32 flags;
146 #define VIDEO_TUNER_PAL 1
147 #define VIDEO_TUNER_NTSC 2
148 #define VIDEO_TUNER_SECAM 4
149 #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
150 #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
151 #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
152 #define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
153 #define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
154 __u16 mode; /* PAL/NTSC/SECAM/OTHER */
155 #define VIDEO_MODE_PAL 0
156 #define VIDEO_MODE_NTSC 1
157 #define VIDEO_MODE_SECAM 2
158 #define VIDEO_MODE_AUTO 3
159 __u16 signal; /* Signal strength 16bit scale */
160 };
161
162 struct video_picture
163 {
164 __u16 brightness;
165 __u16 hue;
166 __u16 colour;
167 __u16 contrast;
168 __u16 whiteness; /* Black and white only */
169 __u16 depth; /* Capture depth */
170 __u16 palette; /* Palette in use */
171 #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
172 #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
173 #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
174 #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
175 #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
176 #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
177 #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
178 #define VIDEO_PALETTE_YUYV 8
179 #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
180 #define VIDEO_PALETTE_YUV420 10
181 #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
182 #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
183 #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
184 #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
185 #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
186 #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
187 #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
188 #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
189 };
190
191 struct video_audio
192 {
193 int audio; /* Audio channel */
194 __u16 volume; /* If settable */
195 __u16 bass, treble;
196 __u32 flags;
197 #define VIDEO_AUDIO_MUTE 1
198 #define VIDEO_AUDIO_MUTABLE 2
199 #define VIDEO_AUDIO_VOLUME 4
200 #define VIDEO_AUDIO_BASS 8
201 #define VIDEO_AUDIO_TREBLE 16
202 #define VIDEO_AUDIO_BALANCE 32
203 char name[16];
204 #define VIDEO_SOUND_MONO 1
205 #define VIDEO_SOUND_STEREO 2
206 #define VIDEO_SOUND_LANG1 4
207 #define VIDEO_SOUND_LANG2 8
208 __u16 mode;
209 __u16 balance; /* Stereo balance */
210 __u16 step; /* Step actual volume uses */
211 };
212
213 struct video_clip
214 {
215 __s32 x,y;
216 __s32 width, height;
217 struct video_clip *next; /* For user use/driver use only */
218 };
219
220 struct video_window
221 {
222 __u32 x,y; /* Position of window */
223 __u32 width,height; /* Its size */
224 __u32 chromakey;
225 __u32 flags;
226 struct video_clip __user *clips; /* Set only */
227 int clipcount;
228 #define VIDEO_WINDOW_INTERLACE 1
229 #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
230 #define VIDEO_CLIP_BITMAP -1
231 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
232 #define VIDEO_CLIPMAP_SIZE (128 * 625)
233 };
234
235 struct video_capture
236 {
237 __u32 x,y; /* Offsets into image */
238 __u32 width, height; /* Area to capture */
239 __u16 decimation; /* Decimation divider */
240 __u16 flags; /* Flags for capture */
241 #define VIDEO_CAPTURE_ODD 0 /* Temporal */
242 #define VIDEO_CAPTURE_EVEN 1
243 };
244
245 struct video_buffer
246 {
247 void *base;
248 int height,width;
249 int depth;
250 int bytesperline;
251 };
252
253 struct video_mmap
254 {
255 unsigned int frame; /* Frame (0 - n) for double buffer */
256 int height,width;
257 unsigned int format; /* should be VIDEO_PALETTE_* */
258 };
259
260 struct video_key
261 {
262 __u8 key[8];
263 __u32 flags;
264 };
265
266
267 #define VIDEO_MAX_FRAME 32
268
269 struct video_mbuf
270 {
271 int size; /* Total memory to map */
272 int frames; /* Frames */
273 int offsets[VIDEO_MAX_FRAME];
274 };
275
276
277 #define VIDEO_NO_UNIT (-1)
278
279
280 struct video_unit
281 {
282 int video; /* Video minor */
283 int vbi; /* VBI minor */
284 int radio; /* Radio minor */
285 int audio; /* Audio minor */
286 int teletext; /* Teletext minor */
287 };
288
289 struct vbi_format {
290 __u32 sampling_rate; /* in Hz */
291 __u32 samples_per_line;
292 __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
293 __s32 start[2]; /* starting line for each frame */
294 __u32 count[2]; /* count of lines for each frame */
295 __u32 flags;
296 #define VBI_UNSYNC 1 /* can distingues between top/bottom field */
297 #define VBI_INTERLACED 2 /* lines are interlaced */
298 };
299
300 /* video_info is biased towards hardware mpeg encode/decode */
301 /* but it could apply generically to any hardware compressor/decompressor */
302 struct video_info
303 {
304 __u32 frame_count; /* frames output since decode/encode began */
305 __u32 h_size; /* current unscaled horizontal size */
306 __u32 v_size; /* current unscaled veritcal size */
307 __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */
308 __u32 picture_type; /* current picture type */
309 __u32 temporal_reference; /* current temporal reference */
310 __u8 user_data[256]; /* user data last found in compressed stream */
311 /* user_data[0] contains user data flags, user_data[1] has count */
312 };
313
314 /* generic structure for setting playback modes */
315 struct video_play_mode
316 {
317 int mode;
318 int p1;
319 int p2;
320 };
321
322 /* for loading microcode / fpga programming */
323 struct video_code
324 {
325 char loadwhat[16]; /* name or tag of file being passed */
326 int datasize;
327 __u8 *data;
328 };
329
330 #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
331 #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
332 #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
333 #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
334 #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
335 #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
336 #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
337 #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
338 #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
339 #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
340 #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
341 #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
342 #define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
343 #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
344 #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
345 #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
346 #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
347 #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
348 #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
349 #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
350 #define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */
351 #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */
352 #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */
353 #define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */
354 #define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */
355 #define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */
356 #define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */
357 #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
358 #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
359
360
361 #define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
362
363 /* VIDIOCSWRITEMODE */
364 #define VID_WRITE_MPEG_AUD 0
365 #define VID_WRITE_MPEG_VID 1
366 #define VID_WRITE_OSD 2
367 #define VID_WRITE_TTX 3
368 #define VID_WRITE_CC 4
369 #define VID_WRITE_MJPEG 5
370
371 /* VIDIOCSPLAYMODE */
372 #define VID_PLAY_VID_OUT_MODE 0
373 /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
374 #define VID_PLAY_GENLOCK 1
375 /* p1: 0 = OFF, 1 = ON */
376 /* p2: GENLOCK FINE DELAY value */
377 #define VID_PLAY_NORMAL 2
378 #define VID_PLAY_PAUSE 3
379 #define VID_PLAY_SINGLE_FRAME 4
380 #define VID_PLAY_FAST_FORWARD 5
381 #define VID_PLAY_SLOW_MOTION 6
382 #define VID_PLAY_IMMEDIATE_NORMAL 7
383 #define VID_PLAY_SWITCH_CHANNELS 8
384 #define VID_PLAY_FREEZE_FRAME 9
385 #define VID_PLAY_STILL_MODE 10
386 #define VID_PLAY_MASTER_MODE 11
387 /* p1: see below */
388 #define VID_PLAY_MASTER_NONE 1
389 #define VID_PLAY_MASTER_VIDEO 2
390 #define VID_PLAY_MASTER_AUDIO 3
391 #define VID_PLAY_ACTIVE_SCANLINES 12
392 /* p1 = first active; p2 = last active */
393 #define VID_PLAY_RESET 13
394 #define VID_PLAY_END_MARK 14
395
396
397
398 #define VID_HARDWARE_BT848 1
399 #define VID_HARDWARE_QCAM_BW 2
400 #define VID_HARDWARE_PMS 3
401 #define VID_HARDWARE_QCAM_C 4
402 #define VID_HARDWARE_PSEUDO 5
403 #define VID_HARDWARE_SAA5249 6
404 #define VID_HARDWARE_AZTECH 7
405 #define VID_HARDWARE_SF16MI 8
406 #define VID_HARDWARE_RTRACK 9
407 #define VID_HARDWARE_ZOLTRIX 10
408 #define VID_HARDWARE_SAA7146 11
409 #define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
410 #define VID_HARDWARE_RTRACK2 13
411 #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
412 #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
413 #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
414 #define VID_HARDWARE_BROADWAY 17 /* Broadway project */
415 #define VID_HARDWARE_GEMTEK 18
416 #define VID_HARDWARE_TYPHOON 19
417 #define VID_HARDWARE_VINO 20 /* SGI Indy Vino */
418 #define VID_HARDWARE_CADET 21 /* Cadet radio */
419 #define VID_HARDWARE_TRUST 22 /* Trust FM Radio */
420 #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */
421 #define VID_HARDWARE_CPIA 24
422 #define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */
423 #define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */
424 #define VID_HARDWARE_OV511 27
425 #define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */
426 #define VID_HARDWARE_W9966 29
427 #define VID_HARDWARE_SE401 30 /* SE401 USB webcams */
428 #define VID_HARDWARE_PWC 31 /* Philips webcams */
429 #define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */
430 #define VID_HARDWARE_CPIA2 33
431 #define VID_HARDWARE_VICAM 34
432 #define VID_HARDWARE_SF16FMR2 35
433 #define VID_HARDWARE_W9968CF 36
434 #define VID_HARDWARE_SAA7114H 37
435 #define VID_HARDWARE_SN9C102 38
436 #define VID_HARDWARE_ARV 39
437 #endif /* __LINUX_VIDEODEV_H */
438
439 /*
440 * Local variables:
441 * c-basic-offset: 8
442 * End:
443 */