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