vserver 2.0 rc7
[linux-2.6.git] / drivers / usb / media / pwc / pwc-kiara.c
1 /* Linux driver for Philips webcam
2    (C) 2004      Luc Saillard (luc@saillard.org)
3
4    NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
5    driver and thus may have bugs that are not present in the original version.
6    Please send bug reports and support requests to <luc@saillard.org>.
7    The decompression routines have been implemented by reverse-engineering the
8    Nemosoft binary pwcx module. Caveat emptor.
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 */
24
25
26 /* This tables contains entries for the 730/740/750 (Kiara) camera, with
27    4 different qualities (no compression, low, medium, high).
28    It lists the bandwidth requirements for said mode by its alternate interface
29    number. An alternate of 0 means that the mode is unavailable.
30
31    There are 6 * 4 * 4 entries:
32      6 different resolutions subqcif, qsif, qcif, sif, cif, vga
33      6 framerates: 5, 10, 15, 20, 25, 30
34      4 compression modi: none, low, medium, high
35
36    When an uncompressed mode is not available, the next available compressed mode
37    will be chosen (unless the decompressor is absent). Sometimes there are only
38    1 or 2 compressed modes available; in that case entries are duplicated.
39 */
40
41
42 #include "pwc-kiara.h"
43 #include "pwc-uncompress.h"
44
45 const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] =
46 {
47    /* SQCIF */
48    {
49       /* 5 fps */
50       {
51          {0, },
52          {0, },
53          {0, },
54          {0, },
55       },
56       /* 10 fps */
57       {
58          {0, },
59          {0, },
60          {0, },
61          {0, },
62       },
63       /* 15 fps */
64       {
65          {0, },
66          {0, },
67          {0, },
68          {0, },
69       },
70       /* 20 fps */
71       {
72          {0, },
73          {0, },
74          {0, },
75          {0, },
76       },
77       /* 25 fps */
78       {
79          {0, },
80          {0, },
81          {0, },
82          {0, },
83       },
84       /* 30 fps */
85       {
86          {0, },
87          {0, },
88          {0, },
89          {0, },
90       },
91    },
92    /* QSIF */
93    {
94       /* 5 fps */
95       {
96          {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
97          {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
98          {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
99          {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
100       },
101       /* 10 fps */
102       {
103          {2, 291,    0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}},
104          {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
105          {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
106          {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
107       },
108       /* 15 fps */
109       {
110          {3, 437,    0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}},
111          {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
112          {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
113          {1, 192,  420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
114       },
115       /* 20 fps */
116       {
117          {4, 589,    0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}},
118          {3, 448,  730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}},
119          {2, 292,  476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}},
120          {1, 192,  312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
121       },
122       /* 25 fps */
123       {
124          {5, 703,    0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}},
125          {3, 447,  610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}},
126          {2, 292,  398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}},
127          {1, 193,  262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}},
128       },
129       /* 30 fps */
130       {
131          {8, 874,    0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}},
132          {5, 704,  730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}},
133          {3, 448,  492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}},
134          {2, 292,  320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}},
135       },
136    },
137    /* QCIF */
138    {
139       /* 5 fps */
140       {
141          {0, },
142          {0, },
143          {0, },
144          {0, },
145       },
146       /* 10 fps */
147       {
148          {0, },
149          {0, },
150          {0, },
151          {0, },
152       },
153       /* 15 fps */
154       {
155          {0, },
156          {0, },
157          {0, },
158          {0, },
159       },
160       /* 20 fps */
161       {
162          {0, },
163          {0, },
164          {0, },
165          {0, },
166       },
167       /* 25 fps */
168       {
169          {0, },
170          {0, },
171          {0, },
172          {0, },
173       },
174       /* 30 fps */
175       {
176          {0, },
177          {0, },
178          {0, },
179          {0, },
180       },
181    },
182    /* SIF */
183    {
184       /* 5 fps */
185       {
186          {4, 582,    0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}},
187          {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}},
188          {2, 291,  960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}},
189          {1, 191,  630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}},
190       },
191       /* 10 fps */
192       {
193          {0, },
194          {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}},
195          {3, 447,  736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}},
196          {2, 292,  480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}},
197       },
198       /* 15 fps */
199       {
200          {0, },
201          {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}},
202          {4, 592,  650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}},
203          {3, 448,  492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}},
204       },
205       /* 20 fps */
206       {
207          {0, },
208          {9, 958,  782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}},
209          {5, 703,  574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}},
210          {3, 446,  364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}},
211       },
212       /* 25 fps */
213       {
214          {0, },
215          {9, 958,  654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}},
216          {6, 776,  530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}},
217          {4, 592,  404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}},
218       },
219       /* 30 fps */
220       {
221          {0, },
222          {9, 957,  526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}},
223          {6, 775,  426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}},
224          {4, 590,  324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}},
225       },
226    },
227    /* CIF */
228    {
229       /* 5 fps */
230       {
231          {0, },
232          {0, },
233          {0, },
234          {0, },
235       },
236       /* 10 fps */
237       {
238          {0, },
239          {0, },
240          {0, },
241          {0, },
242       },
243       /* 15 fps */
244       {
245          {0, },
246          {0, },
247          {0, },
248          {0, },
249       },
250       /* 20 fps */
251       {
252          {0, },
253          {0, },
254          {0, },
255          {0, },
256       },
257       /* 25 fps */
258       {
259          {0, },
260          {0, },
261          {0, },
262          {0, },
263       },
264       /* 30 fps */
265       {
266          {0, },
267          {0, },
268          {0, },
269          {0, },
270       },
271    },
272    /* VGA */
273    {
274       /* 5 fps */
275       {
276          {0, },
277          {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}},
278          {4, 592,  976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}},
279          {3, 448,  738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}},
280       },
281       /* 10 fps */
282       {
283          {0, },
284          {9, 956,  788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}},
285          {6, 776,  640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}},
286          {4, 592,  488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}},
287       },
288       /* 15 fps */
289       {
290          {0, },
291          {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
292          {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
293          {8, 895,  492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}},
294       },
295       /* 20 fps */
296       {
297          {0, },
298          {0, },
299          {0, },
300          {0, },
301       },
302       /* 25 fps */
303       {
304          {0, },
305          {0, },
306          {0, },
307          {0, },
308       },
309       /* 30 fps */
310       {
311          {0, },
312          {0, },
313          {0, },
314          {0, },
315       },
316    },
317 };
318