Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[linux-2.6.git] / drivers / media / video / gspca / nw80x.c
1 /*
2  * DivIO nw80x subdriver
3  *
4  * Copyright (C) 2011 Jean-Fran├žois Moine (http://moinejf.free.fr)
5  * Copyright (C) 2003 Sylvain Munaut <tnt@246tNt.com>
6  *                      Kjell Claesson <keyson@users.sourceforge.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  */
22
23 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
25 #define MODULE_NAME "nw80x"
26
27 #include "gspca.h"
28
29 MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
30 MODULE_DESCRIPTION("NW80x USB Camera Driver");
31 MODULE_LICENSE("GPL");
32
33 static int webcam;
34
35 /* controls */
36 enum e_ctrl {
37         GAIN,
38         EXPOSURE,
39         AUTOGAIN,
40         NCTRLS          /* number of controls */
41 };
42
43 #define AUTOGAIN_DEF 1
44
45 /* specific webcam descriptor */
46 struct sd {
47         struct gspca_dev gspca_dev;     /* !! must be the first item */
48
49         struct gspca_ctrl ctrls[NCTRLS];
50
51         u32 ae_res;
52         s8 ag_cnt;
53 #define AG_CNT_START 13
54         u8 exp_too_low_cnt;
55         u8 exp_too_high_cnt;
56
57         u8 bridge;
58         u8 webcam;
59 };
60
61 enum bridges {
62         BRIDGE_NW800,   /* and et31x110 */
63         BRIDGE_NW801,
64         BRIDGE_NW802,
65 };
66 enum webcams {
67         Generic800,
68         SpaceCam,       /* Trust 120 SpaceCam */
69         SpaceCam2,      /* other Trust 120 SpaceCam */
70         Cvideopro,      /* Conceptronic Video Pro */
71         Dlink350c,
72         DS3303u,
73         Kr651us,
74         Kritter,
75         Mustek300,
76         Proscope,
77         Twinkle,
78         DvcV6,
79         P35u,
80         Generic802,
81         NWEBCAMS        /* number of webcams */
82 };
83
84 static const u8 webcam_chip[NWEBCAMS] = {
85         [Generic800]    = BRIDGE_NW800, /* 06a5:0000
86                                          * Typhoon Webcam 100 USB */
87
88         [SpaceCam]      = BRIDGE_NW800, /* 06a5:d800
89                                 * Trust SpaceCam120 or SpaceCam100 PORTABLE */
90
91         [SpaceCam2]     = BRIDGE_NW800, /* 06a5:d800 - pas106
92                         * other Trust SpaceCam120 or SpaceCam100 PORTABLE */
93
94         [Cvideopro]     = BRIDGE_NW802, /* 06a5:d001
95                         * Conceptronic Video Pro 'CVIDEOPRO USB Webcam CCD' */
96
97         [Dlink350c]     = BRIDGE_NW802, /* 06a5:d001
98                                          * D-Link NetQam Pro 250plus */
99
100         [DS3303u]       = BRIDGE_NW801, /* 06a5:d001
101                                 * Plustek Opticam 500U or ProLink DS3303u */
102
103         [Kr651us]       = BRIDGE_NW802, /* 06a5:d001
104                                          * Panasonic GP-KR651US */
105
106         [Kritter]       = BRIDGE_NW802, /* 06a5:d001
107                                          * iRez Kritter cam */
108
109         [Mustek300]     = BRIDGE_NW802, /* 055f:d001
110                                          * Mustek Wcam 300 mini */
111
112         [Proscope]      = BRIDGE_NW802, /* 06a5:d001
113                                          * Scalar USB Microscope (ProScope) */
114
115         [Twinkle]       = BRIDGE_NW800, /* 06a5:d800 - hv7121b? (seems pas106)
116                                          * Divio Chicony TwinkleCam
117                                          * DSB-C110 */
118
119         [DvcV6]         = BRIDGE_NW802, /* 0502:d001
120                                          * DVC V6 */
121
122         [P35u]          = BRIDGE_NW801, /* 052b:d001, 06a5:d001 and 06be:d001
123                                          * EZCam Pro p35u */
124
125         [Generic802]    = BRIDGE_NW802,
126 };
127 /*
128  * other webcams:
129  *      - nw801 046d:d001
130  *              Logitech QuickCam Pro (dark focus ring)
131  *      - nw801 0728:d001
132  *              AVerMedia Camguard
133  *      - nw??? 06a5:d001
134  *              D-Link NetQam Pro 250plus
135  *      - nw800 065a:d800
136  *              Showcam NGS webcam
137  *      - nw??? ????:????
138  *              Sceptre svc300
139  */
140
141 /*
142  * registers
143  *    nw800/et31x110      nw801           nw802
144  *      0000..009e      0000..00a1      0000..009e
145  *      0200..0211         id              id
146  *      0300..0302         id              id
147  *      0400..0406        (inex)        0400..0406
148  *      0500..0505      0500..0506        (inex)
149  *      0600..061a      0600..0601      0600..0601
150  *      0800..0814         id              id
151  *      1000..109c      1000..10a1      1000..109a
152  */
153
154 /* resolutions
155  *      nw800: 320x240, 352x288
156  *      nw801/802: 320x240, 640x480
157  */
158 static const struct v4l2_pix_format cif_mode[] = {
159         {320, 240, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
160                 .bytesperline = 320,
161                 .sizeimage = 320 * 240 * 4 / 8,
162                 .colorspace = V4L2_COLORSPACE_JPEG},
163         {352, 288, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
164                 .bytesperline = 352,
165                 .sizeimage = 352 * 288 * 4 / 8,
166                 .colorspace = V4L2_COLORSPACE_JPEG}
167 };
168 static const struct v4l2_pix_format vga_mode[] = {
169         {320, 240, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
170                 .bytesperline = 320,
171                 .sizeimage = 320 * 240 * 4 / 8,
172                 .colorspace = V4L2_COLORSPACE_JPEG},
173         {640, 480, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
174                 .bytesperline = 640,
175                 .sizeimage = 640 * 480 * 3 / 8,
176                 .colorspace = V4L2_COLORSPACE_JPEG},
177 };
178
179 /*
180  * The sequences below contain:
181  *      - 1st and 2nd bytes: either
182  *              - register number (BE)
183  *              - I2C0 + i2c address
184  *      - 3rd byte: data length (=0 for end of sequence)
185  *      - n bytes: data
186  */
187 #define I2C0 0xff
188
189 static const u8 nw800_init[] = {
190         0x04, 0x05, 0x01, 0x61,
191         0x04, 0x04, 0x01, 0x01,
192         0x04, 0x06, 0x01, 0x04,
193         0x04, 0x04, 0x03, 0x00, 0x00, 0x00,
194         0x05, 0x05, 0x01, 0x00,
195         0, 0, 0
196 };
197 static const u8 nw800_start[] = {
198         0x04, 0x06, 0x01, 0xc0,
199         0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f,
200                           0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19,
201                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
202                           0x00, 0x01, 0x00, 0x19, 0x00, 0x3e, 0x00, 0x24,
203                           0x03, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
204                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
205                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
206                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
207         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
208                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
209                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
210                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
211                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
212                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
213                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
214                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
215         0x00, 0x80, 0x1f, 0xa0, 0x48, 0xc3, 0x02, 0x88, 0x0c, 0x68, 0x00,
216                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x08,
217                           0x00, 0x32, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
218                           0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
219         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
220                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
221                           0x40, 0x20,
222         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
223         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0xc0,
224         0x05, 0x00, 0x06, 0xe8, 0x00, 0x00, 0x00, 0x20, 0x20,
225         0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
228                           0x00, 0x00, 0x00,
229         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231                           0x00, 0x00, 0x00, 0x00, 0x00,
232         0x10, 0x00, 0x40, 0x83, 0x02, 0x20, 0x00, 0x13, 0x00, 0x00, 0x00,
233                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
234                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235                           0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
236                           0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
237                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
238                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
239                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
240         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
241                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
242                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
243                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
244                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
245                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
246                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
247                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
248         0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
249                           0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x62,
250                           0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
251                           0x01, 0x60, 0x01, 0x00, 0x00,
252
253         0x04, 0x04, 0x01, 0xff,
254         0x04, 0x06, 0x01, 0xc4,
255
256         0x04, 0x06, 0x01, 0xc0,
257         0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f,
258                           0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19,
259                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
260                           0x00, 0x01, 0x00, 0x19, 0x00, 0x3e, 0x00, 0x24,
261                           0x03, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
262                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
263                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
264                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
265         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
266                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
267                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
268                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
269                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
270                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
271                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
272                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
273         0x00, 0x80, 0x1f, 0xa0, 0x48, 0xc3, 0x02, 0x88, 0x0c, 0x68, 0x00,
274                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x08,
275                           0x00, 0x32, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
276                           0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
277         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
278                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
279                           0x40, 0x20,
280         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
281         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0xc0,
282         0x05, 0x00, 0x06, 0xe8, 0x00, 0x00, 0x00, 0x20, 0x20,
283         0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
285                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286                           0x00, 0x00, 0x00,
287         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289                           0x00, 0x00, 0x00, 0x00, 0x00,
290         0x10, 0x00, 0x40, 0x83, 0x02, 0x20, 0x00, 0x13, 0x00, 0x00, 0x00,
291                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
292                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293                           0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
294                           0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
295                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
296                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
297                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
298         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
299                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
300                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
301                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
302                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
303                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
304                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
305                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
306         0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
307                           0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x62,
308                           0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
309                           0x01, 0x60, 0x01, 0x00, 0x00,
310
311         0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
312                           0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
313                           0x40,
314         0x00, 0x80, 0x01, 0xa0,
315         0x10, 0x1a, 0x01, 0x00,
316         0x00, 0x91, 0x02, 0x6c, 0x01,
317         0x00, 0x03, 0x02, 0xc8, 0x01,
318         0x10, 0x1a, 0x01, 0x00,
319         0x10, 0x00, 0x01, 0x83,
320         0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
321                           0x20, 0x01, 0x60, 0x01,
322         0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
323         0x10, 0x1b, 0x02, 0x69, 0x00,
324         0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
325         0x05, 0x02, 0x01, 0x02,
326         0x06, 0x00, 0x02, 0x04, 0xd9,
327         0x05, 0x05, 0x01, 0x20,
328         0x05, 0x05, 0x01, 0x21,
329         0x10, 0x0e, 0x01, 0x08,
330         0x10, 0x41, 0x11, 0x00, 0x08, 0x21, 0x3d, 0x52, 0x63, 0x75, 0x83,
331                           0x91, 0x9e, 0xaa, 0xb6, 0xc1, 0xcc, 0xd6, 0xe0,
332                           0xea,
333         0x10, 0x03, 0x01, 0x00,
334         0x10, 0x0f, 0x02, 0x13, 0x13,
335         0x10, 0x03, 0x01, 0x14,
336         0x10, 0x41, 0x11, 0x00, 0x08, 0x21, 0x3d, 0x52, 0x63, 0x75, 0x83,
337                           0x91, 0x9e, 0xaa, 0xb6, 0xc1, 0xcc, 0xd6, 0xe0,
338                           0xea,
339         0x10, 0x0b, 0x01, 0x14,
340         0x10, 0x0d, 0x01, 0x20,
341         0x10, 0x0c, 0x01, 0x34,
342         0x04, 0x06, 0x01, 0xc3,
343         0x04, 0x04, 0x01, 0x00,
344         0x05, 0x02, 0x01, 0x02,
345         0x06, 0x00, 0x02, 0x00, 0x48,
346         0x05, 0x05, 0x01, 0x20,
347         0x05, 0x05, 0x01, 0x21,
348         0, 0, 0
349 };
350
351 /* 06a5:d001 - nw801 - Panasonic
352  *              P35u */
353 static const u8 nw801_start_1[] = {
354         0x05, 0x06, 0x01, 0x04,
355         0x00, 0x00, 0x40, 0x0e, 0x00, 0x00, 0xf9, 0x02, 0x11, 0x00, 0x0e,
356                           0x01, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
357                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
358                           0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
359                           0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
360                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
361                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
362                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
363         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
364                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
365                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
366                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
367                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
368                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
369                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
370                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
371         0x00, 0x80, 0x22, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x08, 0x00,
372                           0x00, 0x00, 0x00, 0x00, 0x69, 0xa8, 0x1f, 0x00,
373                           0x0d, 0x02, 0x07, 0x00, 0x01, 0x00, 0x19, 0x00,
374                           0xf2, 0x00, 0x18, 0x06, 0x10, 0x06, 0x10, 0x00,
375                           0x36, 0x00,
376         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
377                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
378                           0x40, 0x20,
379         0x03, 0x00, 0x03, 0x00, 0x00, 0x00,
380         0x05, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
381         0x06, 0x00, 0x02, 0x09, 0x99,
382         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384                           0x00, 0x00, 0x00, 0x00, 0x00,
385         0x10, 0x00, 0x40, 0x22, 0x02, 0x80, 0x00, 0x1e, 0x00, 0x00, 0x00,
386                           0x00, 0x00, 0x00, 0x0a, 0x15, 0x08, 0x08, 0x0a,
387                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388                           0x00, 0x01, 0x35, 0xfd, 0x07, 0x3d, 0x00, 0x00,
389                           0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x14, 0x02,
390                           0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
391                           0x40, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x06,
392                           0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06, 0xf7,
393         0x10, 0x40, 0x40, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80, 0x80,
394                           0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99, 0xa4,
395                           0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc, 0xcf,
396                           0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54, 0x64,
397                           0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2, 0xe2,
398                           0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
399                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
400                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
401         0x10, 0x80, 0x22, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
402                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00, 0x00,
403                           0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x82, 0x02,
404                           0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40, 0x01,
405                           0xf0, 0x00,
406         0, 0, 0,
407 };
408 static const u8 nw801_start_qvga[] = {
409         0x02, 0x00, 0x10, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
410                           0x00, 0x78, 0x18, 0x0b, 0x06, 0xa2, 0x86, 0x78,
411         0x02, 0x0f, 0x01, 0x6b,
412         0x10, 0x1a, 0x01, 0x15,
413         0x00, 0x00, 0x01, 0x1e,
414         0x10, 0x00, 0x01, 0x2f,
415         0x10, 0x8c, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
416         0x10, 0x11, 0x08, 0x29, 0x00, 0x18, 0x01, 0x1f, 0x00, 0xd2, 0x00,
417                                                         /* AE window */
418         0, 0, 0,
419 };
420 static const u8 nw801_start_vga[] = {
421         0x02, 0x00, 0x10, 0x78, 0xa0, 0x97, 0x78, 0xa0, 0x00, 0x00, 0x00,
422                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xf0,
423         0x02, 0x0f, 0x01, 0xd5,
424         0x10, 0x1a, 0x01, 0x15,
425         0x00, 0x00, 0x01, 0x0e,
426         0x10, 0x00, 0x01, 0x22,
427         0x10, 0x8c, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
428         0x10, 0x11, 0x08, 0x51, 0x00, 0x30, 0x02, 0x3d, 0x00, 0xa4, 0x01,
429         0, 0, 0,
430 };
431 static const u8 nw801_start_2[] = {
432         0x10, 0x04, 0x01, 0x1a,
433         0x10, 0x19, 0x01, 0x09,                         /* clock */
434         0x10, 0x24, 0x06, 0xc0, 0x00, 0x3f, 0x02, 0x00, 0x01,
435                                                          /* .. gain .. */
436         0x00, 0x03, 0x02, 0x92, 0x03,
437         0x00, 0x1d, 0x04, 0xf2, 0x00, 0x24, 0x07,
438         0x00, 0x7b, 0x01, 0xcf,
439         0x10, 0x94, 0x01, 0x07,
440         0x05, 0x05, 0x01, 0x01,
441         0x05, 0x04, 0x01, 0x01,
442         0x10, 0x0e, 0x01, 0x08,
443         0x10, 0x48, 0x11, 0x00, 0x37, 0x55, 0x6b, 0x7d, 0x8d, 0x9b, 0xa8,
444                           0xb4, 0xbf, 0xca, 0xd4, 0xdd, 0xe6, 0xef, 0xf0,
445                           0xf0,
446         0x10, 0x03, 0x01, 0x00,
447         0x10, 0x0f, 0x02, 0x0c, 0x0c,
448         0x10, 0x03, 0x01, 0x08,
449         0x10, 0x48, 0x11, 0x00, 0x37, 0x55, 0x6b, 0x7d, 0x8d, 0x9b, 0xa8,
450                           0xb4, 0xbf, 0xca, 0xd4, 0xdd, 0xe6, 0xef, 0xf0,
451                           0xf0,
452         0x10, 0x0b, 0x01, 0x0b,
453         0x10, 0x0d, 0x01, 0x0b,
454         0x10, 0x0c, 0x01, 0x1f,
455         0x05, 0x06, 0x01, 0x03,
456         0, 0, 0
457 };
458
459 /* nw802 (sharp IR3Y38M?) */
460 static const u8 nw802_start[] = {
461         0x04, 0x06, 0x01, 0x04,
462         0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0xf9, 0x02, 0x10, 0x00, 0x4d,
463                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
464                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
465                           0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
466                           0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
467                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
468                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
469                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
470         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
471                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
472                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
473                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
474                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
475                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
476                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
477                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
478         0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x68, 0x00,
479                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
480                           0x00, 0x0c, 0x02, 0x01, 0x00, 0x16, 0x00, 0x94,
481                           0x00, 0x10, 0x06, 0x08, 0x00, 0x18, 0x00,
482         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
483                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
484                           0x40, 0x20,
485         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
486         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
487         0x06, 0x00, 0x02, 0x09, 0x99,
488         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
489                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490                           0x00, 0x00, 0x00, 0x00, 0x00,
491         0x10, 0x00, 0x40, 0xa1, 0x02, 0x80, 0x00, 0x1d, 0x00, 0x00, 0x00,
492                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
493                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
494                           0x00, 0x49, 0x13, 0xff, 0x01, 0xc0, 0x00, 0x14,
495                           0x02, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00,
496                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
497                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
498                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
499         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
500                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
501                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
502                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
503                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
504                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
505                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
506                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
507         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
508                           0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x05, 0x82,
509                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
510                           0x01, 0xf0, 0x00,
511         0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
512                           0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
513                           0x40,
514         0x10, 0x1a, 0x01, 0x00,
515         0x10, 0x00, 0x01, 0xad,
516         0x00, 0x00, 0x01, 0x08,
517         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
518         0x10, 0x1b, 0x02, 0x00, 0x00,
519         0x10, 0x11, 0x08, 0x51, 0x00, 0xf0, 0x00, 0x3d, 0x00, 0xb4, 0x00,
520         0x10, 0x1d, 0x08, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
521         0x10, 0x0e, 0x01, 0x27,
522         0x10, 0x41, 0x11, 0x00, 0x0e, 0x35, 0x4f, 0x62, 0x71, 0x7f, 0x8b,
523                           0x96, 0xa0, 0xa9, 0xb2, 0xbb, 0xc3, 0xca, 0xd2,
524                           0xd8,
525         0x10, 0x03, 0x01, 0x00,
526         0x10, 0x0f, 0x02, 0x14, 0x14,
527         0x10, 0x03, 0x01, 0x0c,
528         0x10, 0x41, 0x11, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54, 0x64, 0x74,
529                           0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2, 0xe2, 0xf1,
530                           0xff,
531 /*                        0x00, 0x0e, 0x35, 0x4f, 0x62, 0x71, 0x7f, 0x8b,
532  *                        0x96, 0xa0, 0xa9, 0xb2, 0xbb, 0xc3, 0xca, 0xd2,
533  *                        0xd8, */
534         0x10, 0x0b, 0x01, 0x10,
535         0x10, 0x0d, 0x01, 0x11,
536         0x10, 0x0c, 0x01, 0x1c,
537         0x04, 0x06, 0x01, 0x03,
538         0x04, 0x04, 0x01, 0x00,
539         0, 0, 0
540 };
541 /* et31x110 - Trust 120 SpaceCam */
542 static const u8 spacecam_init[] = {
543         0x04, 0x05, 0x01, 0x01,
544         0x04, 0x04, 0x01, 0x01,
545         0x04, 0x06, 0x01, 0x04,
546         0x04, 0x04, 0x03, 0x00, 0x00, 0x00,
547         0x05, 0x05, 0x01, 0x00,
548         0, 0, 0
549 };
550 static const u8 spacecam_start[] = {
551         0x04, 0x06, 0x01, 0x44,
552         0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f,
553                           0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19,
554                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
555                           0x00, 0x01, 0x00, 0x19, 0x00, 0x3e, 0x00, 0x24,
556                           0x03, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
557                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
558                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
559                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
560         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
561                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
562                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
563                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
564                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
565                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
566                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
567                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
568         0x00, 0x80, 0x1f, 0xa0, 0x48, 0xc3, 0x02, 0x88, 0x0c, 0x68, 0x00,
569                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x08,
570                           0x00, 0x32, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
571                           0x00, 0x4b, 0x00, 0x7c, 0x00, 0x80, 0x00,
572         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
573                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
574                           0x40, 0x20,
575         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
576         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
577         0x05, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
578         0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
579                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
580                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
581                           0x00, 0x00, 0x00,
582         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
583                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
584                           0x00, 0x00, 0x00, 0x00, 0x00,
585         0x10, 0x00, 0x40, 0x83, 0x02, 0x20, 0x00, 0x11, 0x00, 0x00, 0x00,
586                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
587                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
588                           0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
589                           0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
590                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
591                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
592                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
593         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
594                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
595                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
596                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
597                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
598                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
599                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
600                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
601         0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
602                           0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x62,
603                           0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
604                           0x01, 0x60, 0x01, 0x00, 0x00,
605         0x04, 0x06, 0x01, 0xc0,
606         0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
607         0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
608                           0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
609                           0x40,
610         0x00, 0x80, 0x01, 0xa0,
611         0x10, 0x1a, 0x01, 0x00,
612         0x00, 0x91, 0x02, 0x32, 0x01,
613         0x00, 0x03, 0x02, 0x08, 0x02,
614         0x10, 0x00, 0x01, 0x83,
615         0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
616                           0x20, 0x01, 0x60, 0x01,
617         0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
618         0x10, 0x0e, 0x01, 0x08,
619         0x10, 0x41, 0x11, 0x00, 0x64, 0x99, 0xc0, 0xe2, 0xf9, 0xf9, 0xf9,
620                           0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
621                           0xf9,
622         0x10, 0x03, 0x01, 0x00,
623         0x10, 0x0f, 0x02, 0x13, 0x13,
624         0x10, 0x03, 0x01, 0x06,
625         0x10, 0x41, 0x11, 0x00, 0x64, 0x99, 0xc0, 0xe2, 0xf9, 0xf9, 0xf9,
626                           0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
627                           0xf9,
628         0x10, 0x0b, 0x01, 0x08,
629         0x10, 0x0d, 0x01, 0x10,
630         0x10, 0x0c, 0x01, 0x1f,
631         0x04, 0x06, 0x01, 0xc3,
632         0x04, 0x05, 0x01, 0x40,
633         0x04, 0x04, 0x01, 0x40,
634         0, 0, 0
635 };
636 /* et31x110 - pas106 - other Trust SpaceCam120 */
637 static const u8 spacecam2_start[] = {
638         0x04, 0x06, 0x01, 0x44,
639         0x04, 0x06, 0x01, 0x00,
640         0x00, 0x00, 0x40, 0x14, 0x83, 0x00, 0xba, 0x01, 0x10, 0x00, 0x4f,
641                           0xef, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x19,
642                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
643                           0x00, 0x01, 0x00, 0x19, 0x00, 0x06, 0x00, 0xfc,
644                           0x01, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
645                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
646                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
647                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
648         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
649                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
650                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
651                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
652                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
653                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
654                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
655                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
656         0x00, 0x80, 0x1f, 0xb8, 0x48, 0x0f, 0x04, 0x88, 0x14, 0x68, 0x00,
657                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x03,
658                           0x00, 0x24, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
659                           0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
660         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
661                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
662                           0x40, 0x20,
663         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
664         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0x00,
665         0x05, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
666         0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
667                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
668                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
669                           0x00, 0x00, 0x00,
670         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
671                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
672                           0x00, 0x00, 0x00, 0x00, 0x00,
673         0x10, 0x00, 0x40, 0x80, 0x02, 0x20, 0x00, 0x13, 0x00, 0x00, 0x00,
674                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
675                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
676                           0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
677                           0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
678                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
679                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
680                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
681         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
682                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
683                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
684                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
685                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
686                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
687                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
688                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
689         0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
690                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x62,
691                           0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
692                           0x01, 0x60, 0x01, 0x00, 0x00,
693         0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
694         0x04, 0x04, 0x01, 0x40,
695         0x04, 0x04, 0x01, 0x00,
696         I2C0, 0x40, 0x0c, 0x02, 0x0c, 0x12, 0x07, 0x00, 0x00, 0x00, 0x05,
697                           0x00, 0x00, 0x05, 0x05,
698         I2C0, 0x40, 0x02, 0x11, 0x06,
699         I2C0, 0x40, 0x02, 0x14, 0x00,
700         I2C0, 0x40, 0x02, 0x13, 0x01,           /* i2c end */
701         0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
702                           0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
703                           0x40,
704         I2C0, 0x40, 0x02, 0x02, 0x0c,           /* pixel clock */
705         I2C0, 0x40, 0x02, 0x0f, 0x00,
706         I2C0, 0x40, 0x02, 0x13, 0x01,           /* i2c end */
707         0x10, 0x00, 0x01, 0x01,
708         0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
709                           0x20, 0x01, 0x60, 0x01,
710         I2C0, 0x40, 0x02, 0x05, 0x0f,           /* exposure */
711         I2C0, 0x40, 0x02, 0x13, 0x01,           /* i2c end */
712         I2C0, 0x40, 0x07, 0x09, 0x0b, 0x0f, 0x05, 0x05, 0x0f, 0x00,
713                                                 /* gains */
714         I2C0, 0x40, 0x03, 0x12, 0x04, 0x01,
715         0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
716         0x10, 0x0e, 0x01, 0x08,
717         0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
718                           0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
719                           0xf9,
720         0x10, 0x03, 0x01, 0x00,
721         0x10, 0x0f, 0x02, 0x13, 0x13,
722         0x10, 0x03, 0x01, 0x06,
723         0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
724                           0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
725                           0xf9,
726         0x10, 0x0b, 0x01, 0x11,
727         0x10, 0x0d, 0x01, 0x10,
728         0x10, 0x0c, 0x01, 0x14,
729         0x04, 0x06, 0x01, 0x03,
730         0x04, 0x05, 0x01, 0x61,
731         0x04, 0x04, 0x01, 0x00,
732         0, 0, 0
733 };
734
735 /* nw802 - Conceptronic Video Pro */
736 static const u8 cvideopro_start[] = {
737         0x04, 0x06, 0x01, 0x04,
738         0x00, 0x00, 0x40, 0x54, 0x96, 0x98, 0xf9, 0x02, 0x18, 0x00, 0x4c,
739                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
740                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
741                           0x00, 0x0b, 0x00, 0x1b, 0x00, 0xc8, 0x00, 0xf4,
742                           0x05, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
743                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
744                           0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
745                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
746         0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
747                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
748                           0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
749                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
750                           0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
751                           0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
752                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
753                           0x00, 0x5d, 0x00, 0xc7, 0x00, 0x7e, 0x00, 0x30,
754         0x00, 0x80, 0x1f, 0x98, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
755                           0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
756                           0x00, 0x0c, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
757                           0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
758         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
759                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
760                           0x40, 0x20,
761         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
762         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
763         0x06, 0x00, 0x02, 0x09, 0x99,
764         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
765                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
766                           0x00, 0x00, 0x00, 0x00, 0x00,
767         0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
768                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
769                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
770                           0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
771                           0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
772                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
773                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
774                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
775         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
776                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
777                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
778                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
779                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
780                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
781                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
782                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
783         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
784                           0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x05, 0x82,
785                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
786                           0x01, 0xf0, 0x00,
787         0x02, 0x00, 0x11, 0x3c, 0x50, 0x8c, 0x3c, 0x50, 0x00, 0x00, 0x00,
788                           0x00, 0x78, 0x3f, 0x3f, 0x06, 0xf2, 0x8f, 0xf0,
789                           0x40,
790         0x10, 0x1a, 0x01, 0x03,
791         0x10, 0x00, 0x01, 0xac,
792         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
793         0x10, 0x1b, 0x02, 0x3b, 0x01,
794         0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
795         0x10, 0x1f, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
796         0x10, 0x1d, 0x02, 0x40, 0x06,
797         0x10, 0x0e, 0x01, 0x08,
798         0x10, 0x41, 0x11, 0x00, 0x0f, 0x46, 0x62, 0x76, 0x86, 0x94, 0xa0,
799                           0xab, 0xb6, 0xbf, 0xc8, 0xcf, 0xd7, 0xdc, 0xdc,
800                           0xdc,
801         0x10, 0x03, 0x01, 0x00,
802         0x10, 0x0f, 0x02, 0x12, 0x12,
803         0x10, 0x03, 0x01, 0x0c,
804         0x10, 0x41, 0x11, 0x00, 0x0f, 0x46, 0x62, 0x76, 0x86, 0x94, 0xa0,
805                           0xab, 0xb6, 0xbf, 0xc8, 0xcf, 0xd7, 0xdc, 0xdc,
806                           0xdc,
807         0x10, 0x0b, 0x01, 0x09,
808         0x10, 0x0d, 0x01, 0x10,
809         0x10, 0x0c, 0x01, 0x2f,
810         0x04, 0x06, 0x01, 0x03,
811         0x04, 0x04, 0x01, 0x00,
812         0, 0, 0
813 };
814
815 /* nw802 - D-link dru-350c cam */
816 static const u8 dlink_start[] = {
817         0x04, 0x06, 0x01, 0x04,
818         0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x92, 0x03, 0x10, 0x00, 0x4d,
819                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
820                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
821                           0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
822                           0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
823                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
824                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
825                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
826         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
827                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
828                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
829                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
830                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
831                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
832                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
833                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
834         0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x68, 0x00,
835                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
836                           0x00, 0x0c, 0x02, 0x01, 0x00, 0x16, 0x00, 0x94,
837                           0x00, 0x10, 0x06, 0x10, 0x00, 0x36, 0x00,
838         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
839                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
840                           0x40, 0x20,
841         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
842         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
843         0x06, 0x00, 0x02, 0x09, 0x99,
844         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
845                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
846                           0x00, 0x00, 0x00, 0x00, 0x00,
847         0x10, 0x00, 0x40, 0xa1, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
848                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
849                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
850                           0x00, 0x49, 0x13, 0x00, 0x00, 0xc0, 0x00, 0x14,
851                           0x02, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00,
852                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
853                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
854                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
855         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
856                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
857                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
858                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
859                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
860                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
861                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
862                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
863         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
864                           0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x82,
865                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
866                           0x01, 0xf0, 0x00,
867         0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
868                           0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
869                           0x40,
870         0x10, 0x1a, 0x01, 0x00,
871         0x10, 0x00, 0x01, 0xad,
872         0x00, 0x00, 0x01, 0x08,
873         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
874         0x10, 0x1b, 0x02, 0x00, 0x00,
875         0x10, 0x11, 0x08, 0x51, 0x00, 0xf0, 0x00, 0x3d, 0x00, 0xb4, 0x00,
876         0x10, 0x1d, 0x08, 0x40, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
877         0x10, 0x0e, 0x01, 0x20,
878         0x10, 0x41, 0x11, 0x00, 0x07, 0x1e, 0x38, 0x4d, 0x60, 0x70, 0x7f,
879                           0x8e, 0x9b, 0xa8, 0xb4, 0xbf, 0xca, 0xd5, 0xdf,
880                           0xea,
881         0x10, 0x03, 0x01, 0x00,
882         0x10, 0x0f, 0x02, 0x11, 0x11,
883         0x10, 0x03, 0x01, 0x10,
884         0x10, 0x41, 0x11, 0x00, 0x07, 0x1e, 0x38, 0x4d, 0x60, 0x70, 0x7f,
885                           0x8e, 0x9b, 0xa8, 0xb4, 0xbf, 0xca, 0xd5, 0xdf,
886                           0xea,
887         0x10, 0x0b, 0x01, 0x19,
888         0x10, 0x0d, 0x01, 0x10,
889         0x10, 0x0c, 0x01, 0x1e,
890         0x04, 0x06, 0x01, 0x03,
891         0x04, 0x04, 0x01, 0x00,
892         0, 0, 0
893 };
894
895 /* 06a5:d001 - nw801 - Sony
896  *              Plustek Opticam 500U or ProLink DS3303u (Hitachi HD49322BF) */
897 /*fixme: 320x240 only*/
898 static const u8 ds3303_start[] = {
899         0x05, 0x06, 0x01, 0x04,
900         0x00, 0x00, 0x40, 0x16, 0x00, 0x00, 0xf9, 0x02, 0x11, 0x00, 0x0e,
901                           0x01, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
902                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
903                           0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
904                           0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
905                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
906                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
907                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
908         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
909                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
910                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
911                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
912                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
913                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
914                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
915                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
916         0x00, 0x80, 0x22, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x08, 0x00,
917                           0x00, 0x00, 0x00, 0x00, 0xa9, 0xa8, 0x1f, 0x00,
918                           0x0d, 0x02, 0x07, 0x00, 0x01, 0x00, 0x19, 0x00,
919                           0xf2, 0x00, 0x18, 0x06, 0x10, 0x06, 0x10, 0x00,
920                           0x36, 0x00,
921         0x02, 0x00, 0x12, 0x03, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
922                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0x50,
923                           0x40, 0x20,
924         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
925         0x05, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
926         0x06, 0x00, 0x02, 0x09, 0x99,
927         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
928                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
929                           0x00, 0x00, 0x00, 0x00, 0x00,
930         0x10, 0x00, 0x40, 0x2f, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
931                           0x00, 0x00, 0x00, 0x10, 0x1f, 0x10, 0x08, 0x0a,
932                           0x0a, 0x51, 0x00, 0xf1, 0x00, 0x3c, 0x00, 0xb4,
933                           0x00, 0x01, 0x15, 0xfd, 0x07, 0x3d, 0x00, 0x00,
934                           0x00, 0x00, 0x00, 0x00, 0x8c, 0x04, 0x01, 0x20,
935                           0x02, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00,
936                           0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x03,
937                           0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06, 0xf7,
938         0x10, 0x40, 0x40, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80, 0x80,
939                           0x00, 0x2d, 0x46, 0x58, 0x67, 0x74, 0x7f, 0x88,
940                           0x94, 0x9d, 0xa6, 0xae, 0xb5, 0xbd, 0xc4, 0xcb,
941                           0xd1, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54, 0x64,
942                           0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2, 0xe2,
943                           0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
944                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
945                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
946         0x10, 0x80, 0x22, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
947                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x3f, 0x01,
948                           0x00, 0x00, 0xef, 0x00, 0x02, 0x0a, 0x82, 0x02,
949                           0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40, 0x01,
950                           0xf0, 0x00,
951
952         0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
953                           0x00, 0x78, 0x3f, 0x3f, 0x00, 0xf2, 0x8f, 0x81,
954                           0x40,
955         0x10, 0x1a, 0x01, 0x15,
956         0x10, 0x00, 0x01, 0x2f,
957         0x10, 0x8c, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
958         0x10, 0x1b, 0x02, 0x00, 0x00,
959         0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
960         0x10, 0x26, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
961         0x10, 0x24, 0x02, 0x40, 0x06,
962         0x10, 0x0e, 0x01, 0x08,
963         0x10, 0x48, 0x11, 0x00, 0x15, 0x40, 0x67, 0x84, 0x9d, 0xb2, 0xc6,
964                           0xd6, 0xe7, 0xf6, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
965                           0xf9,
966         0x10, 0x03, 0x01, 0x00,
967         0x10, 0x0f, 0x02, 0x16, 0x16,
968         0x10, 0x03, 0x01, 0x0c,
969         0x10, 0x48, 0x11, 0x00, 0x15, 0x40, 0x67, 0x84, 0x9d, 0xb2, 0xc6,
970                           0xd6, 0xe7, 0xf6, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
971                           0xf9,
972         0x10, 0x0b, 0x01, 0x26,
973         0x10, 0x0d, 0x01, 0x10,
974         0x10, 0x0c, 0x01, 0x1c,
975         0x05, 0x06, 0x01, 0x03,
976         0x05, 0x04, 0x01, 0x00,
977         0, 0, 0
978 };
979
980 /* 06a5:d001 - nw802 - Panasonic
981  *              GP-KR651US (Philips TDA8786) */
982 static const u8 kr651_start_1[] = {
983         0x04, 0x06, 0x01, 0x04,
984         0x00, 0x00, 0x40, 0x44, 0x96, 0x98, 0xf9, 0x02, 0x18, 0x00, 0x48,
985                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
986                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
987                           0x00, 0x0b, 0x00, 0x1b, 0x00, 0xc8, 0x00, 0xf4,
988                           0x05, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
989                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
990                           0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
991                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
992         0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
993                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
994                           0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
995                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
996                           0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
997                           0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
998                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
999                           0x00, 0x5d, 0x00, 0xc7, 0x00, 0x7e, 0x00, 0x30,
1000         0x00, 0x80, 0x1f, 0x18, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
1001                           0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
1002                           0x00, 0x0c, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
1003                           0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
1004         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
1005                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
1006                           0x40, 0x20,
1007         0x03, 0x00, 0x03, 0x02, 0x00, 0x00,
1008         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
1009         0x06, 0x00, 0x02, 0x09, 0x99,
1010         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1011                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1012                           0x00, 0x00, 0x00, 0x00, 0x00,
1013         0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
1014                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
1015                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1016                           0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
1017                           0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
1018                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
1019                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
1020                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
1021         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
1022                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
1023                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
1024                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
1025                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
1026                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
1027                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
1028                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
1029         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
1030                           0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x05, 0x82,
1031                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
1032                           0x01, 0xf0, 0x00,
1033         0, 0, 0
1034 };
1035 static const u8 kr651_start_qvga[] = {
1036         0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
1037                           0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
1038                           0x40,
1039         0x10, 0x1a, 0x01, 0x03,
1040         0x10, 0x00, 0x01, 0xac,
1041         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1042         0x10, 0x1b, 0x02, 0x00, 0x00,
1043         0x10, 0x11, 0x08, 0x29, 0x00, 0x18, 0x01, 0x1f, 0x00, 0xd2, 0x00,
1044         0x10, 0x1d, 0x06, 0xe0, 0x00, 0x0c, 0x00, 0x52, 0x00,
1045         0x10, 0x1d, 0x02, 0x28, 0x01,
1046         0, 0, 0
1047 };
1048 static const u8 kr651_start_vga[] = {
1049         0x02, 0x00, 0x11, 0x78, 0xa0, 0x8c, 0x78, 0xa0, 0x00, 0x00, 0x00,
1050                           0x00, 0xf0, 0x30, 0x03, 0x01, 0x82, 0x82, 0x98,
1051                           0x80,
1052         0x10, 0x1a, 0x01, 0x03,
1053         0x10, 0x00, 0x01, 0xa0,
1054         0x10, 0x85, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
1055         0x10, 0x1b, 0x02, 0x00, 0x00,
1056         0x10, 0x11, 0x08, 0x51, 0x00, 0x30, 0x02, 0x3d, 0x00, 0xa4, 0x01,
1057         0x10, 0x1d, 0x06, 0xe0, 0x00, 0x0c, 0x00, 0x52, 0x00,
1058         0x10, 0x1d, 0x02, 0x68, 0x00,
1059 };
1060 static const u8 kr651_start_2[] = {
1061         0x10, 0x0e, 0x01, 0x08,
1062         0x10, 0x41, 0x11, 0x00, 0x11, 0x3c, 0x5c, 0x74, 0x88, 0x99, 0xa8,
1063                           0xb7, 0xc4, 0xd0, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc,
1064                           0xdc,
1065         0x10, 0x03, 0x01, 0x00,
1066         0x10, 0x0f, 0x02, 0x0c, 0x0c,
1067         0x10, 0x03, 0x01, 0x0c,
1068         0x10, 0x41, 0x11, 0x00, 0x11, 0x3c, 0x5c, 0x74, 0x88, 0x99, 0xa8,
1069                           0xb7, 0xc4, 0xd0, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc,
1070                           0xdc,
1071         0x10, 0x0b, 0x01, 0x10,
1072         0x10, 0x0d, 0x01, 0x10,
1073         0x10, 0x0c, 0x01, 0x2d,
1074         0x04, 0x06, 0x01, 0x03,
1075         0x04, 0x04, 0x01, 0x00,
1076         0, 0, 0
1077 };
1078
1079 /* nw802 - iRez Kritter cam */
1080 static const u8 kritter_start[] = {
1081         0x04, 0x06, 0x01, 0x06,
1082         0x00, 0x00, 0x40, 0x44, 0x96, 0x98, 0x94, 0x03, 0x18, 0x00, 0x48,
1083                           0x0f, 0x1e, 0x00, 0x0c, 0x02, 0x01, 0x00, 0x19,
1084                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
1085                           0x00, 0x0b, 0x00, 0x1b, 0x00, 0x0a, 0x01, 0x28,
1086                           0x07, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
1087                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1088                           0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
1089                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1090         0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
1091                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1092                           0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
1093                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1094                           0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
1095                           0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
1096                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
1097                           0x00, 0x5d, 0x00, 0x0e, 0x00, 0x7e, 0x00, 0x30,
1098         0x00, 0x80, 0x1f, 0x18, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
1099                           0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
1100                           0x00, 0x0b, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
1101                           0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
1102         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
1103                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
1104                           0x40, 0x20,
1105         0x03, 0x00, 0x03, 0x02, 0x00, 0x00,
1106         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
1107         0x06, 0x00, 0x02, 0x09, 0x99,
1108         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1109                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1110                           0x00, 0x00, 0x00, 0x00, 0x00,
1111         0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
1112                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
1113                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1114                           0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
1115                           0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
1116                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
1117                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
1118                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
1119         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
1120                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
1121                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
1122                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
1123                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
1124                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
1125                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
1126                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
1127         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
1128                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x82,
1129                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
1130                           0x01, 0xf0, 0x00,
1131         0x02, 0x00, 0x11, 0x3c, 0x50, 0x8c, 0x3c, 0x50, 0x00, 0x00, 0x00,
1132                           0x00, 0x78, 0x3f, 0x3f, 0x06, 0xf2, 0x8f, 0xf0,
1133                           0x40,
1134         0x10, 0x1a, 0x01, 0x03,
1135         0x10, 0x00, 0x01, 0xaf,
1136         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1137         0x10, 0x1b, 0x02, 0x3b, 0x01,
1138         0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
1139         0x10, 0x1d, 0x06, 0xe0, 0x00, 0x0c, 0x00, 0x52, 0x00,
1140         0x10, 0x1d, 0x02, 0x00, 0x00,
1141         0x10, 0x0e, 0x01, 0x08,
1142         0x10, 0x41, 0x11, 0x00, 0x0d, 0x36, 0x4e, 0x60, 0x6f, 0x7b, 0x86,
1143                           0x90, 0x98, 0xa1, 0xa9, 0xb1, 0xb7, 0xbe, 0xc4,
1144                           0xcb,
1145         0x10, 0x03, 0x01, 0x00,
1146         0x10, 0x0f, 0x02, 0x0d, 0x0d,
1147         0x10, 0x03, 0x01, 0x02,
1148         0x10, 0x41, 0x11, 0x00, 0x0d, 0x36, 0x4e, 0x60, 0x6f, 0x7b, 0x86,
1149                           0x90, 0x98, 0xa1, 0xa9, 0xb1, 0xb7, 0xbe, 0xc4,
1150                           0xcb,
1151         0x10, 0x0b, 0x01, 0x17,
1152         0x10, 0x0d, 0x01, 0x10,
1153         0x10, 0x0c, 0x01, 0x1e,
1154         0x04, 0x06, 0x01, 0x03,
1155         0x04, 0x04, 0x01, 0x00,
1156         0, 0, 0
1157 };
1158
1159 /* nw802 - Mustek Wcam 300 mini */
1160 static const u8 mustek_start[] = {
1161         0x04, 0x06, 0x01, 0x04,
1162         0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x92, 0x03, 0x10, 0x00, 0x4d,
1163                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
1164                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
1165                           0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
1166                           0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
1167                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
1168                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
1169                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
1170         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
1171                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
1172                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
1173                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
1174                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
1175                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
1176                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
1177                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
1178         0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x68, 0x00,
1179                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
1180                           0x00, 0x0c, 0x02, 0x01, 0x00, 0x16, 0x00, 0x94,
1181                           0x00, 0x10, 0x06, 0xfc, 0x05, 0x0c, 0x06,
1182         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
1183                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
1184                           0x40, 0x20,
1185         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
1186         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
1187         0x06, 0x00, 0x02, 0x09, 0x99,
1188         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1189                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1190                           0x00, 0x00, 0x00, 0x00, 0x00,
1191         0x10, 0x00, 0x40, 0xa1, 0x02, 0x80, 0x00, 0x13, 0x00, 0x00, 0x00,
1192                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
1193                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1194                           0x00, 0x49, 0x13, 0x00, 0x00, 0xc0, 0x00, 0x14,
1195                           0x02, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00,
1196                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
1197                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
1198                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
1199         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
1200                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
1201                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
1202                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
1203                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
1204                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
1205                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
1206                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
1207         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
1208                           0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x82,
1209                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
1210                           0x01, 0xf0, 0x00,
1211         0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
1212                           0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
1213                           0x40,
1214         0x10, 0x1a, 0x01, 0x00,
1215         0x10, 0x00, 0x01, 0xad,
1216         0x00, 0x00, 0x01, 0x08,
1217         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1218         0x10, 0x1b, 0x02, 0x00, 0x00,
1219         0x10, 0x11, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1220         0x10, 0x1d, 0x08, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
1221         0x10, 0x0e, 0x01, 0x0f,
1222         0x10, 0x41, 0x11, 0x00, 0x0f, 0x29, 0x4a, 0x64, 0x7a, 0x8c, 0x9e,
1223                           0xad, 0xba, 0xc7, 0xd3, 0xde, 0xe8, 0xf1, 0xf9,
1224                           0xff,
1225         0x10, 0x0f, 0x02, 0x11, 0x11,
1226         0x10, 0x03, 0x01, 0x0c,
1227         0x10, 0x41, 0x11, 0x00, 0x0f, 0x29, 0x4a, 0x64, 0x7a, 0x8c, 0x9e,
1228                           0xad, 0xba, 0xc7, 0xd3, 0xde, 0xe8, 0xf1, 0xf9,
1229                           0xff,
1230         0x10, 0x0b, 0x01, 0x1c,
1231         0x10, 0x0d, 0x01, 0x1a,
1232         0x10, 0x0c, 0x01, 0x34,
1233         0x04, 0x05, 0x01, 0x61,
1234         0x04, 0x04, 0x01, 0x40,
1235         0x04, 0x06, 0x01, 0x03,
1236         0, 0, 0
1237 };
1238
1239 /* nw802 - Scope USB Microscope M2 (ProScope) (Hitachi HD49322BF) */
1240 static const u8 proscope_init[] = {
1241         0x04, 0x05, 0x01, 0x21,
1242         0x04, 0x04, 0x01, 0x01,
1243         0, 0, 0
1244 };
1245 static const u8 proscope_start_1[] = {
1246         0x04, 0x06, 0x01, 0x04,
1247         0x00, 0x00, 0x40, 0x10, 0x01, 0x00, 0xf9, 0x02, 0x10, 0x00, 0x04,
1248                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
1249                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
1250                           0x00, 0x08, 0x00, 0x17, 0x00, 0xce, 0x00, 0xf4,
1251                           0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
1252                           0x00, 0xce, 0x00, 0xf8, 0x03, 0x3e, 0x00, 0x86,
1253                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
1254                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
1255         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0xb6,
1256                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
1257                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
1258                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
1259                           0x00, 0xf6, 0x03, 0x34, 0x04, 0xf6, 0x03, 0x34,
1260                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
1261                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xe8,
1262                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
1263         0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x1f, 0x0f, 0x08, 0x20, 0xa8, 0x00,
1264                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
1265                           0x00, 0x0c, 0x02, 0x01, 0x00, 0x19, 0x00, 0x94,
1266                           0x00, 0x10, 0x06, 0x10, 0x00, 0x36, 0x00,
1267         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
1268                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
1269                           0x40, 0x20,
1270         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
1271         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
1272         0x06, 0x00, 0x02, 0x09, 0x99,
1273         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1274                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1275                           0x00, 0x00, 0x00, 0x00, 0x00,
1276         0x10, 0x00, 0x40, 0xad, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
1277                           0x00, 0x00, 0x00, 0x10, 0x1f, 0x10, 0x08, 0x0a,
1278                           0x0a, 0x51, 0x00, 0xf1, 0x00, 0x3c, 0x00, 0xb4,
1279                           0x00, 0x49, 0x13, 0x00, 0x00, 0x8c, 0x04, 0x01,
1280                           0x20, 0x02, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00,
1281                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
1282                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
1283                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
1284         0x10, 0x40, 0x40, 0x80, 0x00, 0x2d, 0x46, 0x58, 0x67, 0x74, 0x7f,
1285                           0x88, 0x94, 0x9d, 0xa6, 0xae, 0xb5, 0xbd, 0xc4,
1286                           0xcb, 0xd1, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
1287                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
1288                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
1289                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
1290                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
1291                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
1292         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x3f,
1293                           0x01, 0x00, 0x00, 0xef, 0x00, 0x09, 0x05, 0x82,
1294                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
1295                           0x01, 0xf0, 0x00,
1296         0, 0, 0
1297 };
1298 static const u8 proscope_start_qvga[] = {
1299         0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
1300                           0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
1301                           0x40,
1302         0x10, 0x1a, 0x01, 0x06,
1303         0x00, 0x03, 0x02, 0xf9, 0x02,
1304         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1305         0x10, 0x1b, 0x02, 0x00, 0x00,
1306         0x10, 0x11, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1307         0x10, 0x1d, 0x08, 0xc0, 0x0d, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
1308         0x10, 0x0e, 0x01, 0x10,
1309         0, 0, 0
1310 };
1311 static const u8 proscope_start_vga[] = {
1312         0x00, 0x03, 0x02, 0xf9, 0x02,
1313         0x10, 0x85, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
1314         0x02, 0x00, 0x11, 0x78, 0xa0, 0x8c, 0x78, 0xa0, 0x00, 0x00, 0x00,
1315                           0x00, 0xf0, 0x16, 0x00, 0x00, 0x82, 0x84, 0x00,
1316                           0x80,
1317         0x10, 0x1a, 0x01, 0x06,
1318         0x10, 0x00, 0x01, 0xa1,
1319         0x10, 0x1b, 0x02, 0x00, 0x00,
1320         0x10, 0x1d, 0x08, 0xc0, 0x0d, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
1321         0x10, 0x11, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
1322         0x10, 0x0e, 0x01, 0x10,
1323         0x10, 0x41, 0x11, 0x00, 0x10, 0x51, 0x6e, 0x83, 0x93, 0xa1, 0xae,
1324                           0xb9, 0xc3, 0xcc, 0xd4, 0xdd, 0xe4, 0xeb, 0xf2,
1325                           0xf9,
1326         0x10, 0x03, 0x01, 0x00,
1327         0, 0, 0
1328 };
1329 static const u8 proscope_start_2[] = {
1330         0x10, 0x0f, 0x02, 0x0c, 0x0c,
1331         0x10, 0x03, 0x01, 0x0c,
1332         0x10, 0x41, 0x11, 0x00, 0x10, 0x51, 0x6e, 0x83, 0x93, 0xa1, 0xae,
1333                           0xb9, 0xc3, 0xcc, 0xd4, 0xdd, 0xe4, 0xeb, 0xf2,
1334                           0xf9,
1335         0x10, 0x0b, 0x01, 0x0b,
1336         0x10, 0x0d, 0x01, 0x10,
1337         0x10, 0x0c, 0x01, 0x1b,
1338         0x04, 0x06, 0x01, 0x03,
1339         0x04, 0x05, 0x01, 0x21,
1340         0x04, 0x04, 0x01, 0x00,
1341         0, 0, 0
1342 };
1343
1344 /* nw800 - hv7121b? (seems pas106) - Divio Chicony TwinkleCam */
1345 static const u8 twinkle_start[] = {
1346         0x04, 0x06, 0x01, 0x44,
1347         0x04, 0x06, 0x01, 0x00,
1348         0x00, 0x00, 0x40, 0x14, 0x83, 0x00, 0xba, 0x01, 0x10, 0x00, 0x4f,
1349                           0xef, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x19,
1350                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
1351                           0x00, 0x01, 0x00, 0x19, 0x00, 0x06, 0x00, 0xfc,
1352                           0x01, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
1353                           0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
1354                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
1355                           0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
1356         0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
1357                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
1358                           0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
1359                           0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
1360                           0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
1361                           0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
1362                           0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
1363                           0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
1364         0x00, 0x80, 0x1f, 0xb8, 0x48, 0x0f, 0x04, 0x88, 0x14, 0x68, 0x00,
1365                           0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x03,
1366                           0x00, 0x24, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
1367                           0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
1368         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
1369                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
1370                           0x40, 0x20,
1371         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
1372         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0x00,
1373         0x05, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
1374         0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1375                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1376                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1377                           0x00, 0x00, 0x00,
1378         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1379                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1380                           0x00, 0x00, 0x00, 0x00, 0x00,
1381         0x10, 0x00, 0x40, 0x80, 0x02, 0x20, 0x00, 0x11, 0x00, 0x00, 0x00,
1382                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x08,
1383                           0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1384                           0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
1385                           0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
1386                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
1387                           0x03, 0x00, 0x00, 0x10, 0x00, 0x20, 0x10, 0x06,
1388                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x00, 0x80,
1389         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
1390                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
1391                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
1392                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
1393                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
1394                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
1395                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
1396                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
1397         0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
1398                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x62,
1399                           0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
1400                           0x01, 0x60, 0x01, 0x00, 0x00,
1401
1402         0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
1403         0x04, 0x04, 0x01, 0x10,
1404         0x04, 0x04, 0x01, 0x00,
1405         0x04, 0x05, 0x01, 0x61,
1406         0x04, 0x04, 0x01, 0x01,
1407         I2C0, 0x40, 0x0c, 0x02, 0x0c, 0x12, 0x07, 0x00, 0x00, 0x00, 0x00,
1408                           0x00, 0x00, 0x00, 0x0a,
1409         I2C0, 0x40, 0x02, 0x11, 0x06,
1410         I2C0, 0x40, 0x02, 0x14, 0x00,
1411         I2C0, 0x40, 0x02, 0x13, 0x01,           /* i2c end */
1412         I2C0, 0x40, 0x02, 0x07, 0x01,
1413         0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
1414                           0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
1415                           0x40,
1416         I2C0, 0x40, 0x02, 0x02, 0x0c,
1417         I2C0, 0x40, 0x02, 0x13, 0x01,
1418         0x10, 0x00, 0x01, 0x01,
1419         0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
1420                           0x20, 0x01, 0x60, 0x01,
1421         I2C0, 0x40, 0x02, 0x05, 0x0f,
1422         I2C0, 0x40, 0x02, 0x13, 0x01,
1423         I2C0, 0x40, 0x08, 0x08, 0x04, 0x0b, 0x01, 0x01, 0x02, 0x00, 0x17,
1424         I2C0, 0x40, 0x03, 0x12, 0x00, 0x01,
1425         0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
1426         I2C0, 0x40, 0x02, 0x12, 0x00,
1427         I2C0, 0x40, 0x02, 0x0e, 0x00,
1428         I2C0, 0x40, 0x02, 0x11, 0x06,
1429         0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
1430                           0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
1431                           0xf9,
1432         0x10, 0x03, 0x01, 0x00,
1433         0x10, 0x0f, 0x02, 0x0c, 0x0c,
1434         0x10, 0x03, 0x01, 0x06,
1435         0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
1436                           0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
1437                           0xf9,
1438         0x10, 0x0b, 0x01, 0x19,
1439         0x10, 0x0d, 0x01, 0x10,
1440         0x10, 0x0c, 0x01, 0x0d,
1441         0x04, 0x06, 0x01, 0x03,
1442         0x04, 0x05, 0x01, 0x61,
1443         0x04, 0x04, 0x01, 0x41,
1444         0, 0, 0
1445 };
1446
1447 /* nw802 dvc-v6 */
1448 static const u8 dvcv6_start[] = {
1449         0x04, 0x06, 0x01, 0x06,
1450         0x00, 0x00, 0x40, 0x54, 0x96, 0x98, 0xf9, 0x02, 0x18, 0x00, 0x4c,
1451                           0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
1452                           0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
1453                           0x00, 0x0b, 0x00, 0x1b, 0x00, 0xc8, 0x00, 0xf4,
1454                           0x05, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
1455                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1456                           0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
1457                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1458         0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
1459                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1460                           0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
1461                           0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
1462                           0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
1463                           0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
1464                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
1465                           0x00, 0x5d, 0x00, 0xc7, 0x00, 0x7e, 0x00, 0x30,
1466         0x00, 0x80, 0x1f, 0x98, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
1467                           0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
1468                           0x00, 0x0c, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
1469                           0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
1470         0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
1471                           0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
1472                           0x40, 0x20,
1473         0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
1474         0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
1475         0x06, 0x00, 0x02, 0x09, 0x99,
1476         0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1477                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1478                           0x00, 0x00, 0x00, 0x00, 0x00,
1479         0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
1480                           0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
1481                           0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1482                           0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
1483                           0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
1484                           0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
1485                           0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
1486                           0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
1487         0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
1488                           0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
1489                           0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
1490                           0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
1491                           0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
1492                           0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
1493                           0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
1494                           0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
1495         0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
1496                           0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x05, 0x82,
1497                           0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
1498                           0x01, 0xf0, 0x00,
1499         0x00, 0x03, 0x02, 0x94, 0x03,
1500         0x00, 0x1d, 0x04, 0x0a, 0x01, 0x28, 0x07,
1501         0x00, 0x7b, 0x02, 0xe0, 0x00,
1502         0x10, 0x8d, 0x01, 0x00,
1503         0x00, 0x09, 0x04, 0x1e, 0x00, 0x0c, 0x02,
1504         0x00, 0x91, 0x02, 0x0b, 0x02,
1505         0x10, 0x00, 0x01, 0xaf,
1506         0x02, 0x00, 0x11, 0x3c, 0x50, 0x8f, 0x3c, 0x50, 0x00, 0x00, 0x00,
1507                           0x00, 0x78, 0x3f, 0x3f, 0x06, 0xf2, 0x8f, 0xf0,
1508                           0x40,
1509         0x10, 0x1a, 0x01, 0x02,
1510         0x10, 0x00, 0x01, 0xaf,
1511         0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
1512         0x10, 0x1b, 0x02, 0x07, 0x01,
1513         0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
1514         0x10, 0x1f, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
1515         0x10, 0x1d, 0x02, 0x40, 0x06,
1516         0x10, 0x0e, 0x01, 0x08,
1517         0x10, 0x41, 0x11, 0x00, 0x0f, 0x54, 0x6f, 0x82, 0x91, 0x9f, 0xaa,
1518                           0xb4, 0xbd, 0xc5, 0xcd, 0xd5, 0xdb, 0xdc, 0xdc,
1519                           0xdc,
1520         0x10, 0x03, 0x01, 0x00,
1521         0x10, 0x0f, 0x02, 0x12, 0x12,
1522         0x10, 0x03, 0x01, 0x11,
1523         0x10, 0x41, 0x11, 0x00, 0x0f, 0x54, 0x6f, 0x82, 0x91, 0x9f, 0xaa,
1524                           0xb4, 0xbd, 0xc5, 0xcd, 0xd5, 0xdb, 0xdc, 0xdc,
1525                           0xdc,
1526         0x10, 0x0b, 0x01, 0x16,
1527         0x10, 0x0d, 0x01, 0x10,
1528         0x10, 0x0c, 0x01, 0x1a,
1529         0x04, 0x06, 0x01, 0x03,
1530         0x04, 0x04, 0x01, 0x00,
1531 };
1532
1533 static const u8 *webcam_start[] = {
1534         [Generic800] = nw800_start,
1535         [SpaceCam] = spacecam_start,
1536         [SpaceCam2] = spacecam2_start,
1537         [Cvideopro] = cvideopro_start,
1538         [Dlink350c] = dlink_start,
1539         [DS3303u] = ds3303_start,
1540         [Kr651us] = kr651_start_1,
1541         [Kritter] = kritter_start,
1542         [Mustek300] = mustek_start,
1543         [Proscope] = proscope_start_1,
1544         [Twinkle] = twinkle_start,
1545         [DvcV6] = dvcv6_start,
1546         [P35u] = nw801_start_1,
1547         [Generic802] = nw802_start,
1548 };
1549
1550 /* -- write a register -- */
1551 static void reg_w(struct gspca_dev *gspca_dev,
1552                         u16 index,
1553                         const u8 *data,
1554                         int len)
1555 {
1556         struct usb_device *dev = gspca_dev->dev;
1557         int ret;
1558
1559         if (gspca_dev->usb_err < 0)
1560                 return;
1561         if (len == 1)
1562                 PDEBUG(D_USBO, "SET 00 0000 %04x %02x", index, *data);
1563         else
1564                 PDEBUG(D_USBO, "SET 00 0000 %04x %02x %02x ...",
1565                                 index, *data, data[1]);
1566         memcpy(gspca_dev->usb_buf, data, len);
1567         ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1568                         0x00,
1569                         USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1570                         0x00,           /* value */
1571                         index,
1572                         gspca_dev->usb_buf,
1573                         len,
1574                         500);
1575         if (ret < 0) {
1576                 pr_err("reg_w err %d\n", ret);
1577                 gspca_dev->usb_err = ret;
1578         }
1579 }
1580
1581 /* -- read registers in usb_buf -- */
1582 static void reg_r(struct gspca_dev *gspca_dev,
1583                         u16 index,
1584                         int len)
1585 {
1586         struct usb_device *dev = gspca_dev->dev;
1587         int ret;
1588
1589         if (gspca_dev->usb_err < 0)
1590                 return;
1591         ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
1592                         0x00,
1593                         USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1594                         0x00, index,
1595                         gspca_dev->usb_buf, len, 500);
1596         if (ret < 0) {
1597                 pr_err("reg_r err %d\n", ret);
1598                 gspca_dev->usb_err = ret;
1599                 return;
1600         }
1601         if (len == 1)
1602                 PDEBUG(D_USBI, "GET 00 0000 %04x %02x",
1603                                 index, gspca_dev->usb_buf[0]);
1604         else
1605                 PDEBUG(D_USBI, "GET 00 0000 %04x %02x %02x ..",
1606                                 index, gspca_dev->usb_buf[0],
1607                                 gspca_dev->usb_buf[1]);
1608 }
1609
1610 static void i2c_w(struct gspca_dev *gspca_dev,
1611                         u8 i2c_addr,
1612                         const u8 *data,
1613                         int len)
1614 {
1615         u8 val[2];
1616         int i;
1617
1618         reg_w(gspca_dev, 0x0600, data + 1, len - 1);
1619         reg_w(gspca_dev, 0x0600, data, len);
1620         val[0] = len;
1621         val[1] = i2c_addr;
1622         reg_w(gspca_dev, 0x0502, val, 2);
1623         val[0] = 0x01;
1624         reg_w(gspca_dev, 0x0501, val, 1);
1625         for (i = 5; --i >= 0; ) {
1626                 msleep(4);
1627                 reg_r(gspca_dev, 0x0505, 1);
1628                 if (gspca_dev->usb_err < 0)
1629                         return;
1630                 if (gspca_dev->usb_buf[0] == 0)
1631                         return;
1632         }
1633         gspca_dev->usb_err = -ETIME;
1634 }
1635
1636 static void reg_w_buf(struct gspca_dev *gspca_dev,
1637                         const u8 *cmd)
1638 {
1639         u16 reg;
1640         int len;
1641
1642         for (;;) {
1643                 reg = *cmd++ << 8;
1644                 reg += *cmd++;
1645                 len = *cmd++;
1646                 if (len == 0)
1647                         break;
1648                 if (cmd[-3] != I2C0)
1649                         reg_w(gspca_dev, reg, cmd, len);
1650                 else
1651                         i2c_w(gspca_dev, reg, cmd, len);
1652                 cmd += len;
1653         }
1654 }
1655
1656 static int swap_bits(int v)
1657 {
1658         int r, i;
1659
1660         r = 0;
1661         for (i = 0; i < 8; i++) {
1662                 r <<= 1;
1663                 if (v & 1)
1664                         r++;
1665                 v >>= 1;
1666         }
1667         return r;
1668 }
1669
1670 static void setgain(struct gspca_dev *gspca_dev)
1671 {
1672         struct sd *sd = (struct sd *) gspca_dev;
1673         u8 val, v[2];
1674
1675         val = sd->ctrls[GAIN].val;
1676         switch (sd->webcam) {
1677         case P35u:
1678                 /* Note the control goes from 0-255 not 0-127, but anything
1679                    above 127 just means amplifying noise */
1680                 val >>= 1;                      /* 0 - 255 -> 0 - 127 */
1681                 reg_w(gspca_dev, 0x1026, &val, 1);
1682                 break;
1683         case Kr651us:
1684                 /* 0 - 253 */
1685                 val = swap_bits(val);
1686                 v[0] = val << 3;
1687                 v[1] = val >> 5;
1688                 reg_w(gspca_dev, 0x101d, v, 2); /* SIF reg0/1 (AGC) */
1689                 break;
1690         }
1691 }
1692
1693 static void setexposure(struct gspca_dev *gspca_dev)
1694 {
1695         struct sd *sd = (struct sd *) gspca_dev;
1696         s16 val;
1697         u8 v[2];
1698
1699         val = sd->ctrls[EXPOSURE].val;
1700         switch (sd->webcam) {
1701         case P35u:
1702                 v[0] = ((9 - val) << 3) | 0x01;
1703                 reg_w(gspca_dev, 0x1019, v, 1);
1704                 break;
1705         case Cvideopro:
1706         case DvcV6:
1707         case Kritter:
1708         case Kr651us:
1709                 v[0] = val;
1710                 v[1] = val >> 8;
1711                 reg_w(gspca_dev, 0x101b, v, 2);
1712                 break;
1713         }
1714 }
1715
1716 static void setautogain(struct gspca_dev *gspca_dev)
1717 {
1718         struct sd *sd = (struct sd *) gspca_dev;
1719         int w, h;
1720
1721         if (gspca_dev->ctrl_dis & (1 << AUTOGAIN))
1722                 return;
1723         if (!sd->ctrls[AUTOGAIN].val) {
1724                 sd->ag_cnt = -1;
1725                 return;
1726         }
1727         sd->ag_cnt = AG_CNT_START;
1728
1729         reg_r(gspca_dev, 0x1004, 1);
1730         if (gspca_dev->usb_buf[0] & 0x04) {     /* if AE_FULL_FRM */
1731                 sd->ae_res = gspca_dev->width * gspca_dev->height;
1732         } else {                                /* get the AE window size */
1733                 reg_r(gspca_dev, 0x1011, 8);
1734                 w = (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]
1735                   - (gspca_dev->usb_buf[3] << 8) - gspca_dev->usb_buf[2];
1736                 h = (gspca_dev->usb_buf[5] << 8) + gspca_dev->usb_buf[4]
1737                   - (gspca_dev->usb_buf[7] << 8) - gspca_dev->usb_buf[6];
1738                 sd->ae_res = h * w;
1739                 if (sd->ae_res == 0)
1740                         sd->ae_res = gspca_dev->width * gspca_dev->height;
1741         }
1742 }
1743
1744 static int nw802_test_reg(struct gspca_dev *gspca_dev,
1745                         u16 index,
1746                         u8 value)
1747 {
1748         /* write the value */
1749         reg_w(gspca_dev, index, &value, 1);
1750
1751         /* read it */
1752         reg_r(gspca_dev, index, 1);
1753
1754         return gspca_dev->usb_buf[0] == value;
1755 }
1756
1757 /* this function is called at probe time */
1758 static int sd_config(struct gspca_dev *gspca_dev,
1759                         const struct usb_device_id *id)
1760 {
1761         struct sd *sd = (struct sd *) gspca_dev;
1762
1763         if ((unsigned) webcam >= NWEBCAMS)
1764                 webcam = 0;
1765         sd->webcam = webcam;
1766         gspca_dev->cam.ctrls = sd->ctrls;
1767         gspca_dev->cam.needs_full_bandwidth = 1;
1768         sd->ag_cnt = -1;
1769
1770         /*
1771          * Autodetect sequence inspired from some log.
1772          * We try to detect what registers exist or not.
1773          * If 0x0500 does not exist => NW802
1774          * If it does, test 0x109b. If it doesn't exist,
1775          * then it's a NW801. Else, a NW800
1776          * If a et31x110 (nw800 and 06a5:d800)
1777          *      get the sensor ID
1778          */
1779         if (!nw802_test_reg(gspca_dev, 0x0500, 0x55)) {
1780                 sd->bridge = BRIDGE_NW802;
1781                 if (sd->webcam == Generic800)
1782                         sd->webcam = Generic802;
1783         } else if (!nw802_test_reg(gspca_dev, 0x109b, 0xaa)) {
1784                 sd->bridge = BRIDGE_NW801;
1785                 if (sd->webcam == Generic800)
1786                         sd->webcam = P35u;
1787         } else if (id->idVendor == 0x06a5 && id->idProduct == 0xd800) {
1788                 reg_r(gspca_dev, 0x0403, 1);            /* GPIO */
1789                 PDEBUG(D_PROBE, "et31x110 sensor type %02x",
1790                                 gspca_dev->usb_buf[0]);
1791                 switch (gspca_dev->usb_buf[0] >> 1) {
1792                 case 0x00:                              /* ?? */
1793                         if (sd->webcam == Generic800)
1794                                 sd->webcam = SpaceCam;
1795                         break;
1796                 case 0x01:                              /* Hynix? */
1797                         if (sd->webcam == Generic800)
1798                                 sd->webcam = Twinkle;
1799                         break;
1800                 case 0x0a:                              /* Pixart */
1801                         if (sd->webcam == Generic800)
1802                                 sd->webcam = SpaceCam2;
1803                         break;
1804                 }
1805         }
1806         if (webcam_chip[sd->webcam] != sd->bridge) {
1807                 pr_err("Bad webcam type %d for NW80%d\n",
1808                        sd->webcam, sd->bridge);
1809                 gspca_dev->usb_err = -ENODEV;
1810                 return gspca_dev->usb_err;
1811         }
1812         PDEBUG(D_PROBE, "Bridge nw80%d - type: %d", sd->bridge, sd->webcam);
1813
1814         if (sd->bridge == BRIDGE_NW800) {
1815                 switch (sd->webcam) {
1816                 case DS3303u:
1817                         gspca_dev->cam.cam_mode = cif_mode;     /* qvga */
1818                         break;
1819                 default:
1820                         gspca_dev->cam.cam_mode = &cif_mode[1]; /* cif */
1821                         break;
1822                 }
1823                 gspca_dev->cam.nmodes = 1;
1824         } else {
1825                 gspca_dev->cam.cam_mode = vga_mode;
1826                 switch (sd->webcam) {
1827                 case Kr651us:
1828                 case Proscope:
1829                 case P35u:
1830                         gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
1831                         break;
1832                 default:
1833                         gspca_dev->cam.nmodes = 1;      /* qvga only */
1834                         break;
1835                 }
1836         }
1837         switch (sd->webcam) {
1838         case P35u:
1839 /*              sd->ctrls[EXPOSURE].max = 9;
1840  *              sd->ctrls[EXPOSURE].def = 9; */
1841                 /* coarse expo auto gain function gain minimum, to avoid
1842                  * a large settings jump the first auto adjustment */
1843                 sd->ctrls[GAIN].def = 255 / 5 * 2;
1844                 break;
1845         case Cvideopro:
1846         case DvcV6:
1847         case Kritter:
1848                 gspca_dev->ctrl_dis = (1 << GAIN) | (1 << AUTOGAIN);
1849                 /* fall thru */
1850         case Kr651us:
1851                 sd->ctrls[EXPOSURE].max = 315;
1852                 sd->ctrls[EXPOSURE].def = 150;
1853                 break;
1854         default:
1855                 gspca_dev->ctrl_dis = (1 << GAIN) | (1 << EXPOSURE)
1856                                          | (1 << AUTOGAIN);
1857                 break;
1858         }
1859
1860 #if AUTOGAIN_DEF
1861         if (!(gspca_dev->ctrl_dis & (1 << AUTOGAIN)))
1862                 gspca_dev->ctrl_inac = (1 << GAIN) | (1 << EXPOSURE);
1863 #endif
1864         return gspca_dev->usb_err;
1865 }
1866
1867 /* this function is called at probe and resume time */
1868 static int sd_init(struct gspca_dev *gspca_dev)
1869 {
1870         struct sd *sd = (struct sd *) gspca_dev;
1871
1872         switch (sd->bridge) {
1873         case BRIDGE_NW800:
1874                 switch (sd->webcam) {
1875                 case SpaceCam:
1876                         reg_w_buf(gspca_dev, spacecam_init);
1877                         break;
1878                 default:
1879                         reg_w_buf(gspca_dev, nw800_init);
1880                         break;
1881                 }
1882                 break;
1883         default:
1884                 switch (sd->webcam) {
1885                 case Mustek300:
1886                 case P35u:
1887                 case Proscope:
1888                         reg_w_buf(gspca_dev, proscope_init);
1889                         break;
1890                 }
1891                 break;
1892         }
1893         return gspca_dev->usb_err;
1894 }
1895
1896 /* -- start the camera -- */
1897 static int sd_start(struct gspca_dev *gspca_dev)
1898 {
1899         struct sd *sd = (struct sd *) gspca_dev;
1900         const u8 *cmd;
1901
1902         cmd = webcam_start[sd->webcam];
1903         reg_w_buf(gspca_dev, cmd);
1904         switch (sd->webcam) {
1905         case P35u:
1906                 if (gspca_dev->width == 320)
1907                         reg_w_buf(gspca_dev, nw801_start_qvga);
1908                 else
1909                         reg_w_buf(gspca_dev, nw801_start_vga);
1910                 reg_w_buf(gspca_dev, nw801_start_2);
1911                 break;
1912         case Kr651us:
1913                 if (gspca_dev->width == 320)
1914                         reg_w_buf(gspca_dev, kr651_start_qvga);
1915                 else
1916                         reg_w_buf(gspca_dev, kr651_start_vga);
1917                 reg_w_buf(gspca_dev, kr651_start_2);
1918                 break;
1919         case Proscope:
1920                 if (gspca_dev->width == 320)
1921                         reg_w_buf(gspca_dev, proscope_start_qvga);
1922                 else
1923                         reg_w_buf(gspca_dev, proscope_start_vga);
1924                 reg_w_buf(gspca_dev, proscope_start_2);
1925                 break;
1926         }
1927
1928         setgain(gspca_dev);
1929         setexposure(gspca_dev);
1930         setautogain(gspca_dev);
1931         sd->exp_too_high_cnt = 0;
1932         sd->exp_too_low_cnt = 0;
1933         return gspca_dev->usb_err;
1934 }
1935
1936 static void sd_stopN(struct gspca_dev *gspca_dev)
1937 {
1938         struct sd *sd = (struct sd *) gspca_dev;
1939         u8 value;
1940
1941         /* 'go' off */
1942         if (sd->bridge != BRIDGE_NW801) {
1943                 value = 0x02;
1944                 reg_w(gspca_dev, 0x0406, &value, 1);
1945         }
1946
1947         /* LED off */
1948         switch (sd->webcam) {
1949         case Cvideopro:
1950         case Kr651us:
1951         case DvcV6:
1952         case Kritter:
1953                 value = 0xff;
1954                 break;
1955         case Dlink350c:
1956                 value = 0x21;
1957                 break;
1958         case SpaceCam:
1959         case SpaceCam2:
1960         case Proscope:
1961         case Twinkle:
1962                 value = 0x01;
1963                 break;
1964         default:
1965                 return;
1966         }
1967         reg_w(gspca_dev, 0x0404, &value, 1);
1968 }
1969
1970 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1971                         u8 *data,                       /* isoc packet */
1972                         int len)                        /* iso packet length */
1973 {
1974         /*
1975          * frame header = '00 00 hh ww ss xx ff ff'
1976          * with:
1977          *      - 'hh': height / 4
1978          *      - 'ww': width / 4
1979          *      - 'ss': frame sequence number c0..dd
1980          */
1981         if (data[0] == 0x00 && data[1] == 0x00
1982          && data[6] == 0xff && data[7] == 0xff) {
1983                 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
1984                 gspca_frame_add(gspca_dev, FIRST_PACKET, data + 8, len - 8);
1985         } else {
1986                 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
1987         }
1988 }
1989
1990 static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
1991 {
1992         struct sd *sd = (struct sd *) gspca_dev;
1993
1994         sd->ctrls[AUTOGAIN].val = val;
1995         if (val)
1996                 gspca_dev->ctrl_inac = (1 << GAIN) | (1 << EXPOSURE);
1997         else
1998                 gspca_dev->ctrl_inac = 0;
1999         if (gspca_dev->streaming)
2000                 setautogain(gspca_dev);
2001         return gspca_dev->usb_err;
2002 }
2003
2004 #include "autogain_functions.h"
2005
2006 static void do_autogain(struct gspca_dev *gspca_dev)
2007 {
2008         struct sd *sd = (struct sd *) gspca_dev;
2009         int luma;
2010
2011         if (sd->ag_cnt < 0)
2012                 return;
2013         if (--sd->ag_cnt >= 0)
2014                 return;
2015         sd->ag_cnt = AG_CNT_START;
2016
2017         /* get the average luma */
2018         reg_r(gspca_dev, sd->bridge == BRIDGE_NW801 ? 0x080d : 0x080c, 4);
2019         luma = (gspca_dev->usb_buf[3] << 24) + (gspca_dev->usb_buf[2] << 16)
2020                 + (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0];
2021         luma /= sd->ae_res;
2022
2023         switch (sd->webcam) {
2024         case P35u:
2025                 coarse_grained_expo_autogain(gspca_dev, luma, 100, 5);
2026                 break;
2027         default:
2028                 auto_gain_n_exposure(gspca_dev, luma, 100, 5, 230, 0);
2029                 break;
2030         }
2031 }
2032
2033 /* V4L2 controls supported by the driver */
2034 static const struct ctrl sd_ctrls[NCTRLS] = {
2035 [GAIN] = {
2036             {
2037                 .id      = V4L2_CID_GAIN,
2038                 .type    = V4L2_CTRL_TYPE_INTEGER,
2039                 .name    = "Gain",
2040                 .minimum = 0,
2041                 .maximum = 253,
2042                 .step    = 1,
2043                 .default_value = 128
2044             },
2045             .set_control = setgain
2046         },
2047 [EXPOSURE] = {
2048             {
2049                 .id      = V4L2_CID_EXPOSURE,
2050                 .type    = V4L2_CTRL_TYPE_INTEGER,
2051                 .name    = "Exposure",
2052                 .minimum = 0,
2053                 .maximum = 9,
2054                 .step    = 1,
2055                 .default_value = 9
2056             },
2057             .set_control = setexposure
2058         },
2059 [AUTOGAIN] = {
2060             {
2061                 .id      = V4L2_CID_AUTOGAIN,
2062                 .type    = V4L2_CTRL_TYPE_BOOLEAN,
2063                 .name    = "Auto Gain",
2064                 .minimum = 0,
2065                 .maximum = 1,
2066                 .step    = 1,
2067                 .default_value = AUTOGAIN_DEF,
2068                 .flags   = V4L2_CTRL_FLAG_UPDATE
2069             },
2070             .set = sd_setautogain
2071         },
2072 };
2073
2074 /* sub-driver description */
2075 static const struct sd_desc sd_desc = {
2076         .name = MODULE_NAME,
2077         .ctrls = sd_ctrls,
2078         .nctrls = ARRAY_SIZE(sd_ctrls),
2079         .config = sd_config,
2080         .init = sd_init,
2081         .start = sd_start,
2082         .stopN = sd_stopN,
2083         .pkt_scan = sd_pkt_scan,
2084         .dq_callback = do_autogain,
2085 };
2086
2087 /* -- module initialisation -- */
2088 static const struct usb_device_id device_table[] = {
2089         {USB_DEVICE(0x046d, 0xd001)},
2090         {USB_DEVICE(0x0502, 0xd001)},
2091         {USB_DEVICE(0x052b, 0xd001)},
2092         {USB_DEVICE(0x055f, 0xd001)},
2093         {USB_DEVICE(0x06a5, 0x0000)},
2094         {USB_DEVICE(0x06a5, 0xd001)},
2095         {USB_DEVICE(0x06a5, 0xd800)},
2096         {USB_DEVICE(0x06be, 0xd001)},
2097         {USB_DEVICE(0x0728, 0xd001)},
2098         {}
2099 };
2100 MODULE_DEVICE_TABLE(usb, device_table);
2101
2102 /* -- device connect -- */
2103 static int sd_probe(struct usb_interface *intf,
2104                         const struct usb_device_id *id)
2105 {
2106         return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
2107                                 THIS_MODULE);
2108 }
2109
2110 static struct usb_driver sd_driver = {
2111         .name = MODULE_NAME,
2112         .id_table = device_table,
2113         .probe = sd_probe,
2114         .disconnect = gspca_disconnect,
2115 #ifdef CONFIG_PM
2116         .suspend = gspca_suspend,
2117         .resume = gspca_resume,
2118 #endif
2119 };
2120
2121 module_usb_driver(sd_driver);
2122
2123 module_param(webcam, int, 0644);
2124 MODULE_PARM_DESC(webcam,
2125         "Webcam type\n"
2126         "0: generic\n"
2127         "1: Trust 120 SpaceCam\n"
2128         "2: other Trust 120 SpaceCam\n"
2129         "3: Conceptronic Video Pro\n"
2130         "4: D-link dru-350c\n"
2131         "5: Plustek Opticam 500U\n"
2132         "6: Panasonic GP-KR651US\n"
2133         "7: iRez Kritter\n"
2134         "8: Mustek Wcam 300 mini\n"
2135         "9: Scalar USB Microscope M2 (Proscope)\n"
2136         "10: Divio Chicony TwinkleCam\n"
2137         "11: DVC-V6\n");