ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / usb / media / pwc-ioctl.h
1 #ifndef PWC_IOCTL_H
2 #define PWC_IOCTL_H
3
4 /* (C) 2001-2003 Nemosoft Unv.    webcam@smcc.demon.nl
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 /*         This is pwc-ioctl.h belonging to PWC 8.10                        */
22
23 /* 
24    Changes
25    2001/08/03  Alvarado   Added ioctl constants to access methods for 
26                           changing white balance and red/blue gains
27    2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE
28  */
29
30 /* These are private ioctl() commands, specific for the Philips webcams.
31    They contain functions not found in other webcams, and settings not
32    specified in the Video4Linux API. 
33    
34    The #define names are built up like follows:
35    VIDIOC               VIDeo IOCtl prefix
36          PWC            Philps WebCam
37             G           optional: Get
38             S           optional: Set
39              ...        the function
40  */
41
42
43
44
45 /* The frame rate is encoded in the video_window.flags parameter using
46    the upper 16 bits, since some flags are defined nowadays. The following
47    defines provide a mask and shift to filter out this value.
48    
49    In 'Snapshot' mode the camera freezes its automatic exposure and colour 
50    balance controls.
51  */
52 #define PWC_FPS_SHIFT           16
53 #define PWC_FPS_MASK            0x00FF0000
54 #define PWC_FPS_FRMASK          0x003F0000
55 #define PWC_FPS_SNAPSHOT        0x00400000
56
57
58
59 struct pwc_probe
60 {
61         char name[32];
62         int type;
63 };
64
65
66 /* pwc_whitebalance.mode values */
67 #define PWC_WB_INDOOR           0
68 #define PWC_WB_OUTDOOR          1
69 #define PWC_WB_FL               2
70 #define PWC_WB_MANUAL           3
71 #define PWC_WB_AUTO             4
72
73 /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). 
74    Set mode to one of the PWC_WB_* values above.
75    *red and *blue are the respective gains of these colour components inside 
76    the camera; range 0..65535
77    When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; 
78    otherwise undefined.
79    'read_red' and 'read_blue' are read-only.
80 */   
81    
82 struct pwc_whitebalance
83 {
84         int mode;
85         int manual_red, manual_blue;    /* R/W */
86         int read_red, read_blue;        /* R/O */
87 };
88
89 /* 
90    'control_speed' and 'control_delay' are used in automatic whitebalance mode,
91    and tell the camera how fast it should react to changes in lighting, and 
92    with how much delay. Valid values are 0..65535.
93 */
94 struct pwc_wb_speed
95 {
96         int control_speed;
97         int control_delay;
98
99 };
100
101 /* Used with VIDIOCPWC[SG]LED */
102 struct pwc_leds
103 {
104         int led_on;                     /* Led on-time; range = 0..25000 */
105         int led_off;                    /* Led off-time; range = 0..25000  */
106 };
107
108 /* Image size (used with GREALSIZE) */
109 struct pwc_imagesize
110 {
111         int width;
112         int height;
113 };
114
115 /* Defines and structures for Motorized Pan & Tilt */
116 #define PWC_MPT_PAN             0x01
117 #define PWC_MPT_TILT            0x02
118 #define PWC_MPT_TIMEOUT         0x04 /* for status */
119
120 /* Set angles; when absolute = 1, the angle is absolute and the 
121    driver calculates the relative offset for you. This can only
122    be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
123    absolute angles.
124  */   
125 struct pwc_mpt_angles
126 {
127         int absolute;           /* write-only */
128         int pan;                /* degrees * 100 */
129         int tilt;               /* degress * 100 */
130         int zoom;               /* N/A, set to -1 */
131 };
132
133 /* Range of angles of the camera, both horizontally and vertically.
134    The zoom is not used, maybe in the future...
135
136  */
137 struct pwc_mpt_range
138 {
139         int pan_min, pan_max;           /* degrees * 100 */
140         int tilt_min, tilt_max;
141         int zoom_min, zoom_max;         /* -1, -1 */
142 };
143
144 struct pwc_mpt_status
145 {
146         int status;
147         int time_pan;
148         int time_tilt;
149 };
150
151
152  /* Restore user settings */
153 #define VIDIOCPWCRUSER          _IO('v', 192)
154  /* Save user settings */
155 #define VIDIOCPWCSUSER          _IO('v', 193)
156  /* Restore factory settings */
157 #define VIDIOCPWCFACTORY        _IO('v', 194)
158
159  /* You can manipulate the compression factor. A compression preference of 0
160     means use uncompressed modes when available; 1 is low compression, 2 is
161     medium and 3 is high compression preferred. Of course, the higher the
162     compression, the lower the bandwidth used but more chance of artefacts
163     in the image. The driver automatically chooses a higher compression when
164     the preferred mode is not available.
165   */
166  /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
167 #define VIDIOCPWCSCQUAL         _IOW('v', 195, int)
168  /* Get preferred compression quality */
169 #define VIDIOCPWCGCQUAL         _IOR('v', 195, int)
170
171
172  /* This is a probe function; since so many devices are supported, it
173     becomes difficult to include all the names in programs that want to
174     check for the enhanced Philips stuff. So in stead, try this PROBE;
175     it returns a structure with the original name, and the corresponding 
176     Philips type.
177     To use, fill the structure with zeroes, call PROBE and if that succeeds,
178     compare the name with that returned from VIDIOCGCAP; they should be the
179     same. If so, you can be assured it is a Philips (OEM) cam and the type
180     is valid.
181  */    
182 #define VIDIOCPWCPROBE          _IOR('v', 199, struct pwc_probe)
183
184  /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
185 #define VIDIOCPWCSAGC           _IOW('v', 200, int)
186  /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
187 #define VIDIOCPWCGAGC           _IOR('v', 200, int)
188  /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
189 #define VIDIOCPWCSSHUTTER       _IOW('v', 201, int)
190
191  /* Color compensation (Auto White Balance) */
192 #define VIDIOCPWCSAWB           _IOW('v', 202, struct pwc_whitebalance)
193 #define VIDIOCPWCGAWB           _IOR('v', 202, struct pwc_whitebalance)
194
195  /* Auto WB speed */
196 #define VIDIOCPWCSAWBSPEED      _IOW('v', 203, struct pwc_wb_speed)
197 #define VIDIOCPWCGAWBSPEED      _IOR('v', 203, struct pwc_wb_speed)
198
199  /* LEDs on/off/blink; int range 0..65535 */
200 #define VIDIOCPWCSLED           _IOW('v', 205, struct pwc_leds)
201 #define VIDIOCPWCGLED           _IOR('v', 205, struct pwc_leds)
202
203   /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
204 #define VIDIOCPWCSCONTOUR       _IOW('v', 206, int)
205 #define VIDIOCPWCGCONTOUR       _IOR('v', 206, int)
206
207   /* Backlight compensation; 0 = off, otherwise on */
208 #define VIDIOCPWCSBACKLIGHT     _IOW('v', 207, int)
209 #define VIDIOCPWCGBACKLIGHT     _IOR('v', 207, int)
210
211   /* Flickerless mode; = 0 off, otherwise on */
212 #define VIDIOCPWCSFLICKER       _IOW('v', 208, int)
213 #define VIDIOCPWCGFLICKER       _IOR('v', 208, int)  
214
215   /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
216 #define VIDIOCPWCSDYNNOISE      _IOW('v', 209, int)
217 #define VIDIOCPWCGDYNNOISE      _IOR('v', 209, int)
218
219  /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
220 #define VIDIOCPWCGREALSIZE      _IOR('v', 210, struct pwc_imagesize)
221
222  /* Motorized pan & tilt functions */ 
223 #define VIDIOCPWCMPTRESET       _IOW('v', 211, int)
224 #define VIDIOCPWCMPTGRANGE      _IOR('v', 211, struct pwc_mpt_range)
225 #define VIDIOCPWCMPTSANGLE      _IOW('v', 212, struct pwc_mpt_angles)
226 #define VIDIOCPWCMPTGANGLE      _IOR('v', 212, struct pwc_mpt_angles)
227 #define VIDIOCPWCMPTSTATUS      _IOR('v', 213, struct pwc_mpt_status)
228  
229 #endif