nw80x.c 75.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 * DivIO nw80x subdriver
 *
 * Copyright (C) 2011 Jean-François Moine (http://moinejf.free.fr)
 * Copyright (C) 2003 Sylvain Munaut <tnt@246tNt.com>
 *			Kjell Claesson <keyson@users.sourceforge.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

23 24
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#define MODULE_NAME "nw80x"

#include "gspca.h"

MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("NW80x USB Camera Driver");
MODULE_LICENSE("GPL");

static int webcam;

/* specific webcam descriptor */
struct sd {
	struct gspca_dev gspca_dev;	/* !! must be the first item */

	u32 ae_res;
	s8 ag_cnt;
#define AG_CNT_START 13
42 43
	u8 exp_too_low_cnt;
	u8 exp_too_high_cnt;
44 45 46 47 48 49

	u8 bridge;
	u8 webcam;
};

enum bridges {
50
	BRIDGE_NW800,	/* and et31x110 */
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
	BRIDGE_NW801,
	BRIDGE_NW802,
};
enum webcams {
	Generic800,
	SpaceCam,	/* Trust 120 SpaceCam */
	SpaceCam2,	/* other Trust 120 SpaceCam */
	Cvideopro,	/* Conceptronic Video Pro */
	Dlink350c,
	DS3303u,
	Kr651us,
	Kritter,
	Mustek300,
	Proscope,
	Twinkle,
	DvcV6,
	P35u,
	Generic802,
	NWEBCAMS	/* number of webcams */
};

72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
static const u8 webcam_chip[NWEBCAMS] = {
	[Generic800]	= BRIDGE_NW800,	/* 06a5:0000
					 * Typhoon Webcam 100 USB */

	[SpaceCam]	= BRIDGE_NW800,	/* 06a5:d800
				* Trust SpaceCam120 or SpaceCam100 PORTABLE */

	[SpaceCam2]	= BRIDGE_NW800,	/* 06a5:d800 - pas106
			* other Trust SpaceCam120 or SpaceCam100 PORTABLE */

	[Cvideopro]	= BRIDGE_NW802,	/* 06a5:d001
			* Conceptronic Video Pro 'CVIDEOPRO USB Webcam CCD' */

	[Dlink350c]	= BRIDGE_NW802,	/* 06a5:d001
					 * D-Link NetQam Pro 250plus */

	[DS3303u]	= BRIDGE_NW801,	/* 06a5:d001
				* Plustek Opticam 500U or ProLink DS3303u */

	[Kr651us]	= BRIDGE_NW802,	/* 06a5:d001
					 * Panasonic GP-KR651US */

	[Kritter]	= BRIDGE_NW802,	/* 06a5:d001
					 * iRez Kritter cam */

	[Mustek300]	= BRIDGE_NW802,	/* 055f:d001
					 * Mustek Wcam 300 mini */

	[Proscope]	= BRIDGE_NW802,	/* 06a5:d001
					 * Scalar USB Microscope (ProScope) */

	[Twinkle]	= BRIDGE_NW800,	/* 06a5:d800 - hv7121b? (seems pas106)
					 * Divio Chicony TwinkleCam
					 * DSB-C110 */

	[DvcV6]		= BRIDGE_NW802,	/* 0502:d001
					 * DVC V6 */

	[P35u]		= BRIDGE_NW801,	/* 052b:d001, 06a5:d001 and 06be:d001
					 * EZCam Pro p35u */

	[Generic802]	= BRIDGE_NW802,
};
/*
 * other webcams:
 *	- nw801 046d:d001
 *		Logitech QuickCam Pro (dark focus ring)
 *	- nw801 0728:d001
 *		AVerMedia Camguard
 *	- nw??? 06a5:d001
 *		D-Link NetQam Pro 250plus
 *	- nw800 065a:d800
 *		Showcam NGS webcam
 *	- nw??? ????:????
 *		Sceptre svc300
 */

129
/*
130 131 132 133 134 135 136 137 138 139 140
 * registers
 *    nw800/et31x110	  nw801		  nw802
 *	0000..009e	0000..00a1	0000..009e
 *	0200..0211	   id		   id
 *	0300..0302	   id		   id
 *	0400..0406	  (inex)	0400..0406
 *	0500..0505	0500..0506	  (inex)
 *	0600..061a	0600..0601	0600..0601
 *	0800..0814	   id		   id
 *	1000..109c	1000..10a1	1000..109a
 */
141

142 143 144 145
/* resolutions
 *	nw800: 320x240, 352x288
 *	nw801/802: 320x240, 640x480
 */
146
static const struct v4l2_pix_format cif_mode[] = {
147 148 149 150
	{320, 240, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
		.bytesperline = 320,
		.sizeimage = 320 * 240 * 4 / 8,
		.colorspace = V4L2_COLORSPACE_JPEG},
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
	{352, 288, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
		.bytesperline = 352,
		.sizeimage = 352 * 288 * 4 / 8,
		.colorspace = V4L2_COLORSPACE_JPEG}
};
static const struct v4l2_pix_format vga_mode[] = {
	{320, 240, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
		.bytesperline = 320,
		.sizeimage = 320 * 240 * 4 / 8,
		.colorspace = V4L2_COLORSPACE_JPEG},
	{640, 480, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
		.bytesperline = 640,
		.sizeimage = 640 * 480 * 3 / 8,
		.colorspace = V4L2_COLORSPACE_JPEG},
};

/*
 * The sequences below contain:
 *	- 1st and 2nd bytes: either
 *		- register number (BE)
 *		- I2C0 + i2c address
 *	- 3rd byte: data length (=0 for end of sequence)
 *	- n bytes: data
 */
#define I2C0 0xff
176

177
static const u8 nw800_init[] = {
178 179
	0x04, 0x05, 0x01, 0x61,
	0x04, 0x04, 0x01, 0x01,
180
	0x04, 0x06, 0x01, 0x04,
181 182 183 184 185
	0x04, 0x04, 0x03, 0x00, 0x00, 0x00,
	0x05, 0x05, 0x01, 0x00,
	0, 0, 0
};
static const u8 nw800_start[] = {
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
	0x04, 0x06, 0x01, 0xc0,
	0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f,
			  0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x3e, 0x00, 0x24,
			  0x03, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xa0, 0x48, 0xc3, 0x02, 0x88, 0x0c, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x08,
			  0x00, 0x32, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
			  0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0xc0,
	0x05, 0x00, 0x06, 0xe8, 0x00, 0x00, 0x00, 0x20, 0x20,
	0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x83, 0x02, 0x20, 0x00, 0x13, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x62,
			  0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
			  0x01, 0x60, 0x01, 0x00, 0x00,

	0x04, 0x04, 0x01, 0xff,
	0x04, 0x06, 0x01, 0xc4,

	0x04, 0x06, 0x01, 0xc0,
	0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f,
			  0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x3e, 0x00, 0x24,
			  0x03, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xa0, 0x48, 0xc3, 0x02, 0x88, 0x0c, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x08,
			  0x00, 0x32, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
			  0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0xc0,
	0x05, 0x00, 0x06, 0xe8, 0x00, 0x00, 0x00, 0x20, 0x20,
	0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x83, 0x02, 0x20, 0x00, 0x13, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x62,
			  0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
			  0x01, 0x60, 0x01, 0x00, 0x00,

	0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
			  0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
			  0x40,
	0x00, 0x80, 0x01, 0xa0,
	0x10, 0x1a, 0x01, 0x00,
	0x00, 0x91, 0x02, 0x6c, 0x01,
	0x00, 0x03, 0x02, 0xc8, 0x01,
	0x10, 0x1a, 0x01, 0x00,
	0x10, 0x00, 0x01, 0x83,
	0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
			  0x20, 0x01, 0x60, 0x01,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x10, 0x1b, 0x02, 0x69, 0x00,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x05, 0x02, 0x01, 0x02,
	0x06, 0x00, 0x02, 0x04, 0xd9,
	0x05, 0x05, 0x01, 0x20,
	0x05, 0x05, 0x01, 0x21,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x08, 0x21, 0x3d, 0x52, 0x63, 0x75, 0x83,
			  0x91, 0x9e, 0xaa, 0xb6, 0xc1, 0xcc, 0xd6, 0xe0,
			  0xea,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x13, 0x13,
	0x10, 0x03, 0x01, 0x14,
	0x10, 0x41, 0x11, 0x00, 0x08, 0x21, 0x3d, 0x52, 0x63, 0x75, 0x83,
			  0x91, 0x9e, 0xaa, 0xb6, 0xc1, 0xcc, 0xd6, 0xe0,
			  0xea,
	0x10, 0x0b, 0x01, 0x14,
	0x10, 0x0d, 0x01, 0x20,
	0x10, 0x0c, 0x01, 0x34,
	0x04, 0x06, 0x01, 0xc3,
	0x04, 0x04, 0x01, 0x00,
	0x05, 0x02, 0x01, 0x02,
	0x06, 0x00, 0x02, 0x00, 0x48,
	0x05, 0x05, 0x01, 0x20,
	0x05, 0x05, 0x01, 0x21,
	0, 0, 0
};

339 340 341
/* 06a5:d001 - nw801 - Panasonic
 *		P35u */
static const u8 nw801_start_1[] = {
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
	0x05, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x0e, 0x00, 0x00, 0xf9, 0x02, 0x11, 0x00, 0x0e,
			  0x01, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
			  0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x22, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x08, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x69, 0xa8, 0x1f, 0x00,
			  0x0d, 0x02, 0x07, 0x00, 0x01, 0x00, 0x19, 0x00,
			  0xf2, 0x00, 0x18, 0x06, 0x10, 0x06, 0x10, 0x00,
			  0x36, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x00, 0x00, 0x00,
	0x05, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x22, 0x02, 0x80, 0x00, 0x1e, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x0a, 0x15, 0x08, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x01, 0x35, 0xfd, 0x07, 0x3d, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x14, 0x02,
			  0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
			  0x40, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x06,
			  0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06, 0xf7,
	0x10, 0x40, 0x40, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80, 0x80,
			  0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99, 0xa4,
			  0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc, 0xcf,
			  0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54, 0x64,
			  0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2, 0xe2,
			  0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
	0x10, 0x80, 0x22, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x82, 0x02,
			  0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40, 0x01,
			  0xf0, 0x00,
	0, 0, 0,
};
396
static const u8 nw801_start_qvga[] = {
397 398 399 400 401 402 403 404 405 406 407
	0x02, 0x00, 0x10, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x18, 0x0b, 0x06, 0xa2, 0x86, 0x78,
	0x02, 0x0f, 0x01, 0x6b,
	0x10, 0x1a, 0x01, 0x15,
	0x00, 0x00, 0x01, 0x1e,
	0x10, 0x00, 0x01, 0x2f,
	0x10, 0x8c, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x11, 0x08, 0x29, 0x00, 0x18, 0x01, 0x1f, 0x00, 0xd2, 0x00,
							/* AE window */
	0, 0, 0,
};
408
static const u8 nw801_start_vga[] = {
409 410 411 412 413 414 415 416 417 418
	0x02, 0x00, 0x10, 0x78, 0xa0, 0x97, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xf0,
	0x02, 0x0f, 0x01, 0xd5,
	0x10, 0x1a, 0x01, 0x15,
	0x00, 0x00, 0x01, 0x0e,
	0x10, 0x00, 0x01, 0x22,
	0x10, 0x8c, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
	0x10, 0x11, 0x08, 0x51, 0x00, 0x30, 0x02, 0x3d, 0x00, 0xa4, 0x01,
	0, 0, 0,
};
419
static const u8 nw801_start_2[] = {
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
	0x10, 0x04, 0x01, 0x1a,
	0x10, 0x19, 0x01, 0x09,				/* clock */
	0x10, 0x24, 0x06, 0xc0, 0x00, 0x3f, 0x02, 0x00, 0x01,
							 /* .. gain .. */
	0x00, 0x03, 0x02, 0x92, 0x03,
	0x00, 0x1d, 0x04, 0xf2, 0x00, 0x24, 0x07,
	0x00, 0x7b, 0x01, 0xcf,
	0x10, 0x94, 0x01, 0x07,
	0x05, 0x05, 0x01, 0x01,
	0x05, 0x04, 0x01, 0x01,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x48, 0x11, 0x00, 0x37, 0x55, 0x6b, 0x7d, 0x8d, 0x9b, 0xa8,
			  0xb4, 0xbf, 0xca, 0xd4, 0xdd, 0xe6, 0xef, 0xf0,
			  0xf0,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x0c, 0x0c,
	0x10, 0x03, 0x01, 0x08,
	0x10, 0x48, 0x11, 0x00, 0x37, 0x55, 0x6b, 0x7d, 0x8d, 0x9b, 0xa8,
			  0xb4, 0xbf, 0xca, 0xd4, 0xdd, 0xe6, 0xef, 0xf0,
			  0xf0,
	0x10, 0x0b, 0x01, 0x0b,
	0x10, 0x0d, 0x01, 0x0b,
	0x10, 0x0c, 0x01, 0x1f,
	0x05, 0x06, 0x01, 0x03,
	0, 0, 0
};

/* nw802 (sharp IR3Y38M?) */
448
static const u8 nw802_start[] = {
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
	0x04, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0xf9, 0x02, 0x10, 0x00, 0x4d,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
			  0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x01, 0x00, 0x16, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x08, 0x00, 0x18, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa1, 0x02, 0x80, 0x00, 0x1d, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0xff, 0x01, 0xc0, 0x00, 0x14,
			  0x02, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x05, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
			  0x40,
	0x10, 0x1a, 0x01, 0x00,
	0x10, 0x00, 0x01, 0xad,
	0x00, 0x00, 0x01, 0x08,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x51, 0x00, 0xf0, 0x00, 0x3d, 0x00, 0xb4, 0x00,
	0x10, 0x1d, 0x08, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0,
	0x10, 0x0e, 0x01, 0x27,
	0x10, 0x41, 0x11, 0x00, 0x0e, 0x35, 0x4f, 0x62, 0x71, 0x7f, 0x8b,
			  0x96, 0xa0, 0xa9, 0xb2, 0xbb, 0xc3, 0xca, 0xd2,
			  0xd8,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x14, 0x14,
	0x10, 0x03, 0x01, 0x0c,
	0x10, 0x41, 0x11, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54, 0x64, 0x74,
			  0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2, 0xe2, 0xf1,
			  0xff,
/*			  0x00, 0x0e, 0x35, 0x4f, 0x62, 0x71, 0x7f, 0x8b,
 *			  0x96, 0xa0, 0xa9, 0xb2, 0xbb, 0xc3, 0xca, 0xd2,
 *			  0xd8,	*/
	0x10, 0x0b, 0x01, 0x10,
	0x10, 0x0d, 0x01, 0x11,
	0x10, 0x0c, 0x01, 0x1c,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};
/* et31x110 - Trust 120 SpaceCam */
static const u8 spacecam_init[] = {
	0x04, 0x05, 0x01, 0x01,
	0x04, 0x04, 0x01, 0x01,
	0x04, 0x06, 0x01, 0x04,
	0x04, 0x04, 0x03, 0x00, 0x00, 0x00,
	0x05, 0x05, 0x01, 0x00,
536 537 538
	0, 0, 0
};
static const u8 spacecam_start[] = {
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
	0x04, 0x06, 0x01, 0x44,
	0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f,
			  0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x3e, 0x00, 0x24,
			  0x03, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xa0, 0x48, 0xc3, 0x02, 0x88, 0x0c, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x08,
			  0x00, 0x32, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
			  0x00, 0x4b, 0x00, 0x7c, 0x00, 0x80, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x05, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x83, 0x02, 0x20, 0x00, 0x11, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x62,
			  0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
			  0x01, 0x60, 0x01, 0x00, 0x00,
	0x04, 0x06, 0x01, 0xc0,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
			  0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
			  0x40,
	0x00, 0x80, 0x01, 0xa0,
	0x10, 0x1a, 0x01, 0x00,
	0x00, 0x91, 0x02, 0x32, 0x01,
	0x00, 0x03, 0x02, 0x08, 0x02,
	0x10, 0x00, 0x01, 0x83,
	0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
			  0x20, 0x01, 0x60, 0x01,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x64, 0x99, 0xc0, 0xe2, 0xf9, 0xf9, 0xf9,
			  0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
			  0xf9,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x13, 0x13,
	0x10, 0x03, 0x01, 0x06,
	0x10, 0x41, 0x11, 0x00, 0x64, 0x99, 0xc0, 0xe2, 0xf9, 0xf9, 0xf9,
			  0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
			  0xf9,
	0x10, 0x0b, 0x01, 0x08,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x1f,
	0x04, 0x06, 0x01, 0xc3,
	0x04, 0x05, 0x01, 0x40,
	0x04, 0x04, 0x01, 0x40,
	0, 0, 0
};
624 625
/* et31x110 - pas106 - other Trust SpaceCam120 */
static const u8 spacecam2_start[] = {
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687
	0x04, 0x06, 0x01, 0x44,
	0x04, 0x06, 0x01, 0x00,
	0x00, 0x00, 0x40, 0x14, 0x83, 0x00, 0xba, 0x01, 0x10, 0x00, 0x4f,
			  0xef, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x06, 0x00, 0xfc,
			  0x01, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xb8, 0x48, 0x0f, 0x04, 0x88, 0x14, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x03,
			  0x00, 0x24, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
			  0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0x00,
	0x05, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x80, 0x02, 0x20, 0x00, 0x13, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x62,
			  0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
			  0x01, 0x60, 0x01, 0x00, 0x00,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x04, 0x04, 0x01, 0x40,
	0x04, 0x04, 0x01, 0x00,
	I2C0, 0x40, 0x0c, 0x02, 0x0c, 0x12, 0x07, 0x00, 0x00, 0x00, 0x05,
			  0x00, 0x00, 0x05, 0x05,
	I2C0, 0x40, 0x02, 0x11, 0x06,
	I2C0, 0x40, 0x02, 0x14, 0x00,
688
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
689 690 691
	0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
			  0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
			  0x40,
692
	I2C0, 0x40, 0x02, 0x02, 0x0c,		/* pixel clock */
693
	I2C0, 0x40, 0x02, 0x0f, 0x00,
694
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
695 696 697
	0x10, 0x00, 0x01, 0x01,
	0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
			  0x20, 0x01, 0x60, 0x01,
698 699
	I2C0, 0x40, 0x02, 0x05, 0x0f,		/* exposure */
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
700
	I2C0, 0x40, 0x07, 0x09, 0x0b, 0x0f, 0x05, 0x05, 0x0f, 0x00,
701
						/* gains */
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
	I2C0, 0x40, 0x03, 0x12, 0x04, 0x01,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
			  0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
			  0xf9,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x13, 0x13,
	0x10, 0x03, 0x01, 0x06,
	0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
			  0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
			  0xf9,
	0x10, 0x0b, 0x01, 0x11,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x14,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x05, 0x01, 0x61,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};

/* nw802 - Conceptronic Video Pro */
724
static const u8 cvideopro_start[] = {
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
	0x04, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x54, 0x96, 0x98, 0xf9, 0x02, 0x18, 0x00, 0x4c,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x0b, 0x00, 0x1b, 0x00, 0xc8, 0x00, 0xf4,
			  0x05, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
			  0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
			  0x00, 0x5d, 0x00, 0xc7, 0x00, 0x7e, 0x00, 0x30,
	0x00, 0x80, 0x1f, 0x98, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
			  0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
			  0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x05, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x8c, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x3f, 0x06, 0xf2, 0x8f, 0xf0,
			  0x40,
	0x10, 0x1a, 0x01, 0x03,
	0x10, 0x00, 0x01, 0xac,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x3b, 0x01,
	0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
	0x10, 0x1f, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
	0x10, 0x1d, 0x02, 0x40, 0x06,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x0f, 0x46, 0x62, 0x76, 0x86, 0x94, 0xa0,
			  0xab, 0xb6, 0xbf, 0xc8, 0xcf, 0xd7, 0xdc, 0xdc,
			  0xdc,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x12, 0x12,
	0x10, 0x03, 0x01, 0x0c,
	0x10, 0x41, 0x11, 0x00, 0x0f, 0x46, 0x62, 0x76, 0x86, 0x94, 0xa0,
			  0xab, 0xb6, 0xbf, 0xc8, 0xcf, 0xd7, 0xdc, 0xdc,
			  0xdc,
	0x10, 0x0b, 0x01, 0x09,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x2f,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};

/* nw802 - D-link dru-350c cam */
804
static const u8 dlink_start[] = {
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
	0x04, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x92, 0x03, 0x10, 0x00, 0x4d,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
			  0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x01, 0x00, 0x16, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x10, 0x00, 0x36, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa1, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0xc0, 0x00, 0x14,
			  0x02, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
			  0x40,
	0x10, 0x1a, 0x01, 0x00,
	0x10, 0x00, 0x01, 0xad,
	0x00, 0x00, 0x01, 0x08,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x51, 0x00, 0xf0, 0x00, 0x3d, 0x00, 0xb4, 0x00,
	0x10, 0x1d, 0x08, 0x40, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
	0x10, 0x0e, 0x01, 0x20,
	0x10, 0x41, 0x11, 0x00, 0x07, 0x1e, 0x38, 0x4d, 0x60, 0x70, 0x7f,
			  0x8e, 0x9b, 0xa8, 0xb4, 0xbf, 0xca, 0xd5, 0xdf,
			  0xea,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x11, 0x11,
	0x10, 0x03, 0x01, 0x10,
	0x10, 0x41, 0x11, 0x00, 0x07, 0x1e, 0x38, 0x4d, 0x60, 0x70, 0x7f,
			  0x8e, 0x9b, 0xa8, 0xb4, 0xbf, 0xca, 0xd5, 0xdf,
			  0xea,
	0x10, 0x0b, 0x01, 0x19,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x1e,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};

883 884 885 886
/* 06a5:d001 - nw801 - Sony
 *		Plustek Opticam 500U or ProLink DS3303u (Hitachi HD49322BF) */
/*fixme: 320x240 only*/
static const u8 ds3303_start[] = {
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967
	0x05, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x16, 0x00, 0x00, 0xf9, 0x02, 0x11, 0x00, 0x0e,
			  0x01, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
			  0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x22, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x08, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa9, 0xa8, 0x1f, 0x00,
			  0x0d, 0x02, 0x07, 0x00, 0x01, 0x00, 0x19, 0x00,
			  0xf2, 0x00, 0x18, 0x06, 0x10, 0x06, 0x10, 0x00,
			  0x36, 0x00,
	0x02, 0x00, 0x12, 0x03, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0x50,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x05, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x2f, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x1f, 0x10, 0x08, 0x0a,
			  0x0a, 0x51, 0x00, 0xf1, 0x00, 0x3c, 0x00, 0xb4,
			  0x00, 0x01, 0x15, 0xfd, 0x07, 0x3d, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x8c, 0x04, 0x01, 0x20,
			  0x02, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00,
			  0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x03,
			  0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06, 0xf7,
	0x10, 0x40, 0x40, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80, 0x80,
			  0x00, 0x2d, 0x46, 0x58, 0x67, 0x74, 0x7f, 0x88,
			  0x94, 0x9d, 0xa6, 0xae, 0xb5, 0xbd, 0xc4, 0xcb,
			  0xd1, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54, 0x64,
			  0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2, 0xe2,
			  0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
	0x10, 0x80, 0x22, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x3f, 0x01,
			  0x00, 0x00, 0xef, 0x00, 0x02, 0x0a, 0x82, 0x02,
			  0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40, 0x01,
			  0xf0, 0x00,

	0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x3f, 0x00, 0xf2, 0x8f, 0x81,
			  0x40,
	0x10, 0x1a, 0x01, 0x15,
	0x10, 0x00, 0x01, 0x2f,
	0x10, 0x8c, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
	0x10, 0x26, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
	0x10, 0x24, 0x02, 0x40, 0x06,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x48, 0x11, 0x00, 0x15, 0x40, 0x67, 0x84, 0x9d, 0xb2, 0xc6,
			  0xd6, 0xe7, 0xf6, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
			  0xf9,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x16, 0x16,
	0x10, 0x03, 0x01, 0x0c,
	0x10, 0x48, 0x11, 0x00, 0x15, 0x40, 0x67, 0x84, 0x9d, 0xb2, 0xc6,
			  0xd6, 0xe7, 0xf6, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9,
			  0xf9,
	0x10, 0x0b, 0x01, 0x26,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x1c,
	0x05, 0x06, 0x01, 0x03,
	0x05, 0x04, 0x01, 0x00,
	0, 0, 0
};

968 969 970
/* 06a5:d001 - nw802 - Panasonic
 *		GP-KR651US (Philips TDA8786) */
static const u8 kr651_start_1[] = {
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
	0x04, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x44, 0x96, 0x98, 0xf9, 0x02, 0x18, 0x00, 0x48,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x0b, 0x00, 0x1b, 0x00, 0xc8, 0x00, 0xf4,
			  0x05, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
			  0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
			  0x00, 0x5d, 0x00, 0xc7, 0x00, 0x7e, 0x00, 0x30,
	0x00, 0x80, 0x1f, 0x18, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
			  0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x02, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
			  0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x05, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0, 0, 0
};
1023
static const u8 kr651_start_qvga[] = {
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
			  0x40,
	0x10, 0x1a, 0x01, 0x03,
	0x10, 0x00, 0x01, 0xac,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x29, 0x00, 0x18, 0x01, 0x1f, 0x00, 0xd2, 0x00,
	0x10, 0x1d, 0x06, 0xe0, 0x00, 0x0c, 0x00, 0x52, 0x00,
	0x10, 0x1d, 0x02, 0x28, 0x01,
	0, 0, 0
};
1036
static const u8 kr651_start_vga[] = {
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
	0x02, 0x00, 0x11, 0x78, 0xa0, 0x8c, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x30, 0x03, 0x01, 0x82, 0x82, 0x98,
			  0x80,
	0x10, 0x1a, 0x01, 0x03,
	0x10, 0x00, 0x01, 0xa0,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x51, 0x00, 0x30, 0x02, 0x3d, 0x00, 0xa4, 0x01,
	0x10, 0x1d, 0x06, 0xe0, 0x00, 0x0c, 0x00, 0x52, 0x00,
	0x10, 0x1d, 0x02, 0x68, 0x00,
};
1048
static const u8 kr651_start_2[] = {
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x11, 0x3c, 0x5c, 0x74, 0x88, 0x99, 0xa8,
			  0xb7, 0xc4, 0xd0, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc,
			  0xdc,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x0c, 0x0c,
	0x10, 0x03, 0x01, 0x0c,
	0x10, 0x41, 0x11, 0x00, 0x11, 0x3c, 0x5c, 0x74, 0x88, 0x99, 0xa8,
			  0xb7, 0xc4, 0xd0, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc,
			  0xdc,
	0x10, 0x0b, 0x01, 0x10,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x2d,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};

/* nw802 - iRez Kritter cam */
1068
static const u8 kritter_start[] = {
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147
	0x04, 0x06, 0x01, 0x06,
	0x00, 0x00, 0x40, 0x44, 0x96, 0x98, 0x94, 0x03, 0x18, 0x00, 0x48,
			  0x0f, 0x1e, 0x00, 0x0c, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x0b, 0x00, 0x1b, 0x00, 0x0a, 0x01, 0x28,
			  0x07, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
			  0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
			  0x00, 0x5d, 0x00, 0x0e, 0x00, 0x7e, 0x00, 0x30,
	0x00, 0x80, 0x1f, 0x18, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
			  0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0b, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x02, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
			  0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x8c, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x3f, 0x06, 0xf2, 0x8f, 0xf0,
			  0x40,
	0x10, 0x1a, 0x01, 0x03,
	0x10, 0x00, 0x01, 0xaf,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x3b, 0x01,
	0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
	0x10, 0x1d, 0x06, 0xe0, 0x00, 0x0c, 0x00, 0x52, 0x00,
	0x10, 0x1d, 0x02, 0x00, 0x00,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x0d, 0x36, 0x4e, 0x60, 0x6f, 0x7b, 0x86,
			  0x90, 0x98, 0xa1, 0xa9, 0xb1, 0xb7, 0xbe, 0xc4,
			  0xcb,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x0d, 0x0d,
	0x10, 0x03, 0x01, 0x02,
	0x10, 0x41, 0x11, 0x00, 0x0d, 0x36, 0x4e, 0x60, 0x6f, 0x7b, 0x86,
			  0x90, 0x98, 0xa1, 0xa9, 0xb1, 0xb7, 0xbe, 0xc4,
			  0xcb,
	0x10, 0x0b, 0x01, 0x17,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x1e,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};

/* nw802 - Mustek Wcam 300 mini */
1148
static const u8 mustek_start[] = {
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227
	0x04, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x92, 0x03, 0x10, 0x00, 0x4d,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0xce, 0x00, 0xf4,
			  0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x3f, 0x0f, 0x88, 0x20, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x01, 0x00, 0x16, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0xfc, 0x05, 0x0c, 0x06,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa1, 0x02, 0x80, 0x00, 0x13, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0xc0, 0x00, 0x14,
			  0x02, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
			  0x40,
	0x10, 0x1a, 0x01, 0x00,
	0x10, 0x00, 0x01, 0xad,
	0x00, 0x00, 0x01, 0x08,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1d, 0x08, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
	0x10, 0x0e, 0x01, 0x0f,
	0x10, 0x41, 0x11, 0x00, 0x0f, 0x29, 0x4a, 0x64, 0x7a, 0x8c, 0x9e,
			  0xad, 0xba, 0xc7, 0xd3, 0xde, 0xe8, 0xf1, 0xf9,
			  0xff,
	0x10, 0x0f, 0x02, 0x11, 0x11,
	0x10, 0x03, 0x01, 0x0c,
	0x10, 0x41, 0x11, 0x00, 0x0f, 0x29, 0x4a, 0x64, 0x7a, 0x8c, 0x9e,
			  0xad, 0xba, 0xc7, 0xd3, 0xde, 0xe8, 0xf1, 0xf9,
			  0xff,
	0x10, 0x0b, 0x01, 0x1c,
	0x10, 0x0d, 0x01, 0x1a,
	0x10, 0x0c, 0x01, 0x34,
	0x04, 0x05, 0x01, 0x61,
	0x04, 0x04, 0x01, 0x40,
	0x04, 0x06, 0x01, 0x03,
	0, 0, 0
};

/* nw802 - Scope USB Microscope M2 (ProScope) (Hitachi HD49322BF) */
1228
static const u8 proscope_init[] = {
1229 1230
	0x04, 0x05, 0x01, 0x21,
	0x04, 0x04, 0x01, 0x01,
1231 1232 1233
	0, 0, 0
};
static const u8 proscope_start_1[] = {
1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285
	0x04, 0x06, 0x01, 0x04,
	0x00, 0x00, 0x40, 0x10, 0x01, 0x00, 0xf9, 0x02, 0x10, 0x00, 0x04,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x08, 0x00, 0x17, 0x00, 0xce, 0x00, 0xf4,
			  0x05, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0xce, 0x00, 0xf8, 0x03, 0x3e, 0x00, 0x86,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0xb6,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xf6, 0x03, 0x34, 0x04, 0xf6, 0x03, 0x34,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xe8,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xb4, 0x6f, 0x1f, 0x0f, 0x08, 0x20, 0xa8, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x01, 0x00, 0x19, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x10, 0x00, 0x36, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xad, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x1f, 0x10, 0x08, 0x0a,
			  0x0a, 0x51, 0x00, 0xf1, 0x00, 0x3c, 0x00, 0xb4,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0x8c, 0x04, 0x01,
			  0x20, 0x02, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x2d, 0x46, 0x58, 0x67, 0x74, 0x7f,
			  0x88, 0x94, 0x9d, 0xa6, 0xae, 0xb5, 0xbd, 0xc4,
			  0xcb, 0xd1, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x3f,
			  0x01, 0x00, 0x00, 0xef, 0x00, 0x09, 0x05, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0, 0, 0
};
1286
static const u8 proscope_start_qvga[] = {
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x9e, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x10, 0x02, 0xf2, 0x8f, 0x78,
			  0x40,
	0x10, 0x1a, 0x01, 0x06,
	0x00, 0x03, 0x02, 0xf9, 0x02,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1d, 0x08, 0xc0, 0x0d, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
	0x10, 0x0e, 0x01, 0x10,
	0, 0, 0
};
1299
static const u8 proscope_start_vga[] = {
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316
	0x00, 0x03, 0x02, 0xf9, 0x02,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
	0x02, 0x00, 0x11, 0x78, 0xa0, 0x8c, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x16, 0x00, 0x00, 0x82, 0x84, 0x00,
			  0x80,
	0x10, 0x1a, 0x01, 0x06,
	0x10, 0x00, 0x01, 0xa1,
	0x10, 0x1b, 0x02, 0x00, 0x00,
	0x10, 0x1d, 0x08, 0xc0, 0x0d, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0xdf, 0x01,
	0x10, 0x0e, 0x01, 0x10,
	0x10, 0x41, 0x11, 0x00, 0x10, 0x51, 0x6e, 0x83, 0x93, 0xa1, 0xae,
			  0xb9, 0xc3, 0xcc, 0xd4, 0xdd, 0xe4, 0xeb, 0xf2,
			  0xf9,
	0x10, 0x03, 0x01, 0x00,
	0, 0, 0
};
1317
static const u8 proscope_start_2[] = {
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
	0x10, 0x0f, 0x02, 0x0c, 0x0c,
	0x10, 0x03, 0x01, 0x0c,
	0x10, 0x41, 0x11, 0x00, 0x10, 0x51, 0x6e, 0x83, 0x93, 0xa1, 0xae,
			  0xb9, 0xc3, 0xcc, 0xd4, 0xdd, 0xe4, 0xeb, 0xf2,
			  0xf9,
	0x10, 0x0b, 0x01, 0x0b,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x1b,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x05, 0x01, 0x21,
	0x04, 0x04, 0x01, 0x00,
	0, 0, 0
};

1332 1333
/* nw800 - hv7121b? (seems pas106) - Divio Chicony TwinkleCam */
static const u8 twinkle_start[] = {
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398
	0x04, 0x06, 0x01, 0x44,
	0x04, 0x06, 0x01, 0x00,
	0x00, 0x00, 0x40, 0x14, 0x83, 0x00, 0xba, 0x01, 0x10, 0x00, 0x4f,
			  0xef, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x06, 0x00, 0xfc,
			  0x01, 0x3e, 0x00, 0x86, 0x00, 0x3e, 0x00, 0x86,
			  0x00, 0x3e, 0x00, 0x86, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x56, 0x00, 0x9e,
			  0x00, 0x56, 0x00, 0x9e, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x6e, 0x00, 0xb6, 0x00, 0x6e, 0x00, 0x78,
			  0x04, 0x6e, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xca, 0x03, 0x46, 0x04, 0xca, 0x03, 0x46,
			  0x04, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0,
			  0x00, 0x3e, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x2e,
	0x00, 0x80, 0x1f, 0xb8, 0x48, 0x0f, 0x04, 0x88, 0x14, 0x68, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x03,
			  0x00, 0x24, 0x01, 0x01, 0x00, 0x16, 0x00, 0x04,
			  0x00, 0x4b, 0x00, 0x76, 0x00, 0x86, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0x61, 0x00,
	0x05, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x06, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0x80, 0x02, 0x20, 0x00, 0x11, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x08,
			  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x10, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x00, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1d, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x62,
			  0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01, 0x20,
			  0x01, 0x60, 0x01, 0x00, 0x00,

	0x10, 0x85, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	0x04, 0x04, 0x01, 0x10,
	0x04, 0x04, 0x01, 0x00,
	0x04, 0x05, 0x01, 0x61,
	0x04, 0x04, 0x01, 0x01,
	I2C0, 0x40, 0x0c, 0x02, 0x0c, 0x12, 0x07, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x0a,
	I2C0, 0x40, 0x02, 0x11, 0x06,
	I2C0, 0x40, 0x02, 0x14, 0x00,
1399
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435
	I2C0, 0x40, 0x02, 0x07, 0x01,
	0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
			  0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
			  0x40,
	I2C0, 0x40, 0x02, 0x02, 0x0c,
	I2C0, 0x40, 0x02, 0x13, 0x01,
	0x10, 0x00, 0x01, 0x01,
	0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
			  0x20, 0x01, 0x60, 0x01,
	I2C0, 0x40, 0x02, 0x05, 0x0f,
	I2C0, 0x40, 0x02, 0x13, 0x01,
	I2C0, 0x40, 0x08, 0x08, 0x04, 0x0b, 0x01, 0x01, 0x02, 0x00, 0x17,
	I2C0, 0x40, 0x03, 0x12, 0x00, 0x01,
	0x10, 0x11, 0x08, 0x00, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x1f, 0x01,
	I2C0, 0x40, 0x02, 0x12, 0x00,
	I2C0, 0x40, 0x02, 0x0e, 0x00,
	I2C0, 0x40, 0x02, 0x11, 0x06,
	0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
			  0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
			  0xf9,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x0c, 0x0c,
	0x10, 0x03, 0x01, 0x06,
	0x10, 0x41, 0x11, 0x00, 0x17, 0x3f, 0x69, 0x7b, 0x8c, 0x9a, 0xa7,
			  0xb3, 0xbf, 0xc9, 0xd3, 0xdd, 0xe6, 0xef, 0xf7,
			  0xf9,
	0x10, 0x0b, 0x01, 0x19,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x0d,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x05, 0x01, 0x61,
	0x04, 0x04, 0x01, 0x41,
	0, 0, 0
};

/* nw802 dvc-v6 */
1436
static const u8 dvcv6_start[] = {
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520
	0x04, 0x06, 0x01, 0x06,
	0x00, 0x00, 0x40, 0x54, 0x96, 0x98, 0xf9, 0x02, 0x18, 0x00, 0x4c,
			  0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19,
			  0x00, 0x01, 0x00, 0x19, 0x00, 0x01, 0x00, 0x19,
			  0x00, 0x0b, 0x00, 0x1b, 0x00, 0xc8, 0x00, 0xf4,
			  0x05, 0xb4, 0x00, 0xcc, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa2, 0x00, 0xc6, 0x00, 0x60, 0x00, 0xc6,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
	0x00, 0x40, 0x40, 0x00, 0xae, 0x00, 0xd2, 0x00, 0xae, 0x00, 0xd2,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0xa8, 0x00, 0xc0, 0x00, 0x66, 0x00, 0xc0,
			  0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
			  0x00, 0x0a, 0x00, 0x54, 0x00, 0x0a, 0x00, 0x54,
			  0x00, 0x10, 0x00, 0x36, 0x00, 0xd2, 0x00, 0xee,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6,
			  0x00, 0x5d, 0x00, 0xc7, 0x00, 0x7e, 0x00, 0x30,
	0x00, 0x80, 0x1f, 0x98, 0x43, 0x3f, 0x0d, 0x88, 0x20, 0x80, 0x3f,
			  0x47, 0xaf, 0x00, 0x00, 0xa8, 0x08, 0x00, 0x11,
			  0x00, 0x0c, 0x02, 0x0c, 0x00, 0x1c, 0x00, 0x94,
			  0x00, 0x10, 0x06, 0x24, 0x00, 0x4a, 0x00,
	0x02, 0x00, 0x12, 0x78, 0xa0, 0x9e, 0x78, 0xa0, 0x00, 0x00, 0x00,
			  0x00, 0xf0, 0x18, 0x0b, 0x06, 0x62, 0x82, 0xa0,
			  0x40, 0x20,
	0x03, 0x00, 0x03, 0x03, 0x00, 0x00,
	0x04, 0x00, 0x07, 0x01, 0x10, 0x00, 0x00, 0x00, 0xff, 0x00,
	0x06, 0x00, 0x02, 0x09, 0x99,
	0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00,
	0x10, 0x00, 0x40, 0xa0, 0x02, 0x80, 0x00, 0x12, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x08, 0x0a,
			  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x49, 0x13, 0x00, 0x00, 0xe0, 0x00, 0x0c,
			  0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
			  0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08,
			  0x03, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x06,
			  0xf7, 0xee, 0x1c, 0x1c, 0xe9, 0xfc, 0x10, 0x80,
	0x10, 0x40, 0x40, 0x80, 0x00, 0x05, 0x35, 0x5e, 0x78, 0x8b, 0x99,
			  0xa4, 0xae, 0xb5, 0xbc, 0xc1, 0xc6, 0xc9, 0xcc,
			  0xcf, 0xd0, 0x00, 0x11, 0x22, 0x32, 0x43, 0x54,
			  0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3, 0xd2,
			  0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32, 0x43,
			  0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3, 0xc3,
			  0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x11, 0x22, 0x32,
			  0x43, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb3,
	0x10, 0x80, 0x1b, 0xc3, 0xd2, 0xe2, 0xf1, 0xff, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x05, 0x82,
			  0x02, 0xe4, 0x01, 0x40, 0x01, 0xf0, 0x00, 0x40,
			  0x01, 0xf0, 0x00,
	0x00, 0x03, 0x02, 0x94, 0x03,
	0x00, 0x1d, 0x04, 0x0a, 0x01, 0x28, 0x07,
	0x00, 0x7b, 0x02, 0xe0, 0x00,
	0x10, 0x8d, 0x01, 0x00,
	0x00, 0x09, 0x04, 0x1e, 0x00, 0x0c, 0x02,
	0x00, 0x91, 0x02, 0x0b, 0x02,
	0x10, 0x00, 0x01, 0xaf,
	0x02, 0x00, 0x11, 0x3c, 0x50, 0x8f, 0x3c, 0x50, 0x00, 0x00, 0x00,
			  0x00, 0x78, 0x3f, 0x3f, 0x06, 0xf2, 0x8f, 0xf0,
			  0x40,
	0x10, 0x1a, 0x01, 0x02,
	0x10, 0x00, 0x01, 0xaf,
	0x10, 0x85, 0x08, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xef, 0x00,
	0x10, 0x1b, 0x02, 0x07, 0x01,
	0x10, 0x11, 0x08, 0x61, 0x00, 0xe0, 0x00, 0x49, 0x00, 0xa8, 0x00,
	0x10, 0x1f, 0x06, 0x01, 0x20, 0x02, 0xe8, 0x03, 0x00,
	0x10, 0x1d, 0x02, 0x40, 0x06,
	0x10, 0x0e, 0x01, 0x08,
	0x10, 0x41, 0x11, 0x00, 0x0f, 0x54, 0x6f, 0x82, 0x91, 0x9f, 0xaa,
			  0xb4, 0xbd, 0xc5, 0xcd, 0xd5, 0xdb, 0xdc, 0xdc,
			  0xdc,
	0x10, 0x03, 0x01, 0x00,
	0x10, 0x0f, 0x02, 0x12, 0x12,
	0x10, 0x03, 0x01, 0x11,
	0x10, 0x41, 0x11, 0x00, 0x0f, 0x54, 0x6f, 0x82, 0x91, 0x9f, 0xaa,
			  0xb4, 0xbd, 0xc5, 0xcd, 0xd5, 0xdb, 0xdc, 0xdc,
			  0xdc,
	0x10, 0x0b, 0x01, 0x16,
	0x10, 0x0d, 0x01, 0x10,
	0x10, 0x0c, 0x01, 0x1a,
	0x04, 0x06, 0x01, 0x03,
	0x04, 0x04, 0x01, 0x00,
};

1521
static const u8 *webcam_start[] = {
1522 1523
	[Generic800] = nw800_start,
	[SpaceCam] = spacecam_start,
1524 1525 1526 1527 1528 1529 1530
	[SpaceCam2] = spacecam2_start,
	[Cvideopro] = cvideopro_start,
	[Dlink350c] = dlink_start,
	[DS3303u] = ds3303_start,
	[Kr651us] = kr651_start_1,
	[Kritter] = kritter_start,
	[Mustek300] = mustek_start,
1531
	[Proscope] = proscope_start_1,
1532 1533 1534 1535
	[Twinkle] = twinkle_start,
	[DvcV6] = dvcv6_start,
	[P35u] = nw801_start_1,
	[Generic802] = nw802_start,
1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563
};

/* -- write a register -- */
static void reg_w(struct gspca_dev *gspca_dev,
			u16 index,
			const u8 *data,
			int len)
{
	struct usb_device *dev = gspca_dev->dev;
	int ret;

	if (gspca_dev->usb_err < 0)
		return;
	if (len == 1)
		PDEBUG(D_USBO, "SET 00 0000 %04x %02x", index, *data);
	else
		PDEBUG(D_USBO, "SET 00 0000 %04x %02x %02x ...",
				index, *data, data[1]);
	memcpy(gspca_dev->usb_buf, data, len);
	ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
			0x00,
			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
			0x00,		/* value */
			index,
			gspca_dev->usb_buf,
			len,
			500);
	if (ret < 0) {
1564
		pr_err("reg_w err %d\n", ret);
1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584
		gspca_dev->usb_err = ret;
	}
}

/* -- read registers in usb_buf -- */
static void reg_r(struct gspca_dev *gspca_dev,
			u16 index,
			int len)
{
	struct usb_device *dev = gspca_dev->dev;
	int ret;

	if (gspca_dev->usb_err < 0)
		return;
	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
			0x00,
			USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
			0x00, index,
			gspca_dev->usb_buf, len, 500);
	if (ret < 0) {
1585
		pr_err("reg_r err %d\n", ret);
1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638
		gspca_dev->usb_err = ret;
		return;
	}
	if (len == 1)
		PDEBUG(D_USBI, "GET 00 0000 %04x %02x",
				index, gspca_dev->usb_buf[0]);
	else
		PDEBUG(D_USBI, "GET 00 0000 %04x %02x %02x ..",
				index, gspca_dev->usb_buf[0],
				gspca_dev->usb_buf[1]);
}

static void i2c_w(struct gspca_dev *gspca_dev,
			u8 i2c_addr,
			const u8 *data,
			int len)
{
	u8 val[2];
	int i;

	reg_w(gspca_dev, 0x0600, data + 1, len - 1);
	reg_w(gspca_dev, 0x0600, data, len);
	val[0] = len;
	val[1] = i2c_addr;
	reg_w(gspca_dev, 0x0502, val, 2);
	val[0] = 0x01;
	reg_w(gspca_dev, 0x0501, val, 1);
	for (i = 5; --i >= 0; ) {
		msleep(4);
		reg_r(gspca_dev, 0x0505, 1);
		if (gspca_dev->usb_err < 0)
			return;
		if (gspca_dev->usb_buf[0] == 0)
			return;
	}
	gspca_dev->usb_err = -ETIME;
}

static void reg_w_buf(struct gspca_dev *gspca_dev,
			const u8 *cmd)
{
	u16 reg;
	int len;

	for (;;) {
		reg = *cmd++ << 8;
		reg += *cmd++;
		len = *cmd++;
		if (len == 0)
			break;
		if (cmd[-3] != I2C0)
			reg_w(gspca_dev, reg, cmd, len);
		else
1639
			i2c_w(gspca_dev, reg, cmd, len);
1640 1641 1642 1643
		cmd += len;
	}
}

1644
static int swap_bits(int v)
1645 1646 1647 1648
{
	int r, i;

	r = 0;
1649
	for (i = 0; i < 8; i++) {
1650 1651 1652 1653 1654 1655 1656 1657
		r <<= 1;
		if (v & 1)
			r++;
		v >>= 1;
	}
	return r;
}

1658
static void setgain(struct gspca_dev *gspca_dev, u8 val)
1659 1660
{
	struct sd *sd = (struct sd *) gspca_dev;
1661
	u8 v[2];
1662 1663 1664 1665 1666 1667

	switch (sd->webcam) {
	case P35u:
		reg_w(gspca_dev, 0x1026, &val, 1);
		break;
	case Kr651us:
1668 1669
		/* 0 - 253 */
		val = swap_bits(val);
1670 1671 1672 1673 1674 1675 1676
		v[0] = val << 3;
		v[1] = val >> 5;
		reg_w(gspca_dev, 0x101d, v, 2);	/* SIF reg0/1 (AGC) */
		break;
	}
}

1677
static void setexposure(struct gspca_dev *gspca_dev, s32 val)
1678 1679 1680 1681 1682 1683
{
	struct sd *sd = (struct sd *) gspca_dev;
	u8 v[2];

	switch (sd->webcam) {
	case P35u:
1684
		v[0] = ((9 - val) << 3) | 0x01;
1685 1686
		reg_w(gspca_dev, 0x1019, v, 1);
		break;
1687 1688 1689
	case Cvideopro:
	case DvcV6:
	case Kritter:
1690
	case Kr651us:
1691 1692
		v[0] = val;
		v[1] = val >> 8;
1693 1694 1695 1696 1697
		reg_w(gspca_dev, 0x101b, v, 2);
		break;
	}
}

1698
static void setautogain(struct gspca_dev *gspca_dev, s32 val)
1699 1700 1701 1702
{
	struct sd *sd = (struct sd *) gspca_dev;
	int w, h;

1703
	if (!val) {
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736
		sd->ag_cnt = -1;
		return;
	}
	sd->ag_cnt = AG_CNT_START;

	reg_r(gspca_dev, 0x1004, 1);
	if (gspca_dev->usb_buf[0] & 0x04) {	/* if AE_FULL_FRM */
		sd->ae_res = gspca_dev->width * gspca_dev->height;
	} else {				/* get the AE window size */
		reg_r(gspca_dev, 0x1011, 8);
		w = (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]
		  - (gspca_dev->usb_buf[3] << 8) - gspca_dev->usb_buf[2];
		h = (gspca_dev->usb_buf[5] << 8) + gspca_dev->usb_buf[4]
		  - (gspca_dev->usb_buf[7] << 8) - gspca_dev->usb_buf[6];
		sd->ae_res = h * w;
		if (sd->ae_res == 0)
			sd->ae_res = gspca_dev->width * gspca_dev->height;
	}
}

static int nw802_test_reg(struct gspca_dev *gspca_dev,
			u16 index,
			u8 value)
{
	/* write the value */
	reg_w(gspca_dev, index, &value, 1);

	/* read it */
	reg_r(gspca_dev, index, 1);

	return gspca_dev->usb_buf[0] == value;
}

1737 1738 1739
/* this function is called at probe time */
static int sd_config(struct gspca_dev *gspca_dev,
			const struct usb_device_id *id)
1740 1741 1742
{
	struct sd *sd = (struct sd *) gspca_dev;

1743 1744 1745
	if ((unsigned) webcam >= NWEBCAMS)
		webcam = 0;
	sd->webcam = webcam;
1746
	gspca_dev->cam.needs_full_bandwidth = 1;
1747 1748
	sd->ag_cnt = -1;

1749 1750 1751 1752 1753 1754
	/*
	 * Autodetect sequence inspired from some log.
	 * We try to detect what registers exist or not.
	 * If 0x0500 does not exist => NW802
	 * If it does, test 0x109b. If it doesn't exist,
	 * then it's a NW801. Else, a NW800
1755 1756
	 * If a et31x110 (nw800 and 06a5:d800)
	 *	get the sensor ID
1757 1758 1759 1760 1761 1762 1763 1764 1765
	 */
	if (!nw802_test_reg(gspca_dev, 0x0500, 0x55)) {
		sd->bridge = BRIDGE_NW802;
		if (sd->webcam == Generic800)
			sd->webcam = Generic802;
	} else if (!nw802_test_reg(gspca_dev, 0x109b, 0xaa)) {
		sd->bridge = BRIDGE_NW801;
		if (sd->webcam == Generic800)
			sd->webcam = P35u;
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783
	} else if (id->idVendor == 0x06a5 && id->idProduct == 0xd800) {
		reg_r(gspca_dev, 0x0403, 1);		/* GPIO */
		PDEBUG(D_PROBE, "et31x110 sensor type %02x",
				gspca_dev->usb_buf[0]);
		switch (gspca_dev->usb_buf[0] >> 1) {
		case 0x00:				/* ?? */
			if (sd->webcam == Generic800)
				sd->webcam = SpaceCam;
			break;
		case 0x01:				/* Hynix? */
			if (sd->webcam == Generic800)
				sd->webcam = Twinkle;
			break;
		case 0x0a:				/* Pixart */
			if (sd->webcam == Generic800)
				sd->webcam = SpaceCam2;
			break;
		}
1784
	}
1785
	if (webcam_chip[sd->webcam] != sd->bridge) {
1786 1787
		pr_err("Bad webcam type %d for NW80%d\n",
		       sd->webcam, sd->bridge);
1788 1789 1790 1791
		gspca_dev->usb_err = -ENODEV;
		return gspca_dev->usb_err;
	}
	PDEBUG(D_PROBE, "Bridge nw80%d - type: %d", sd->bridge, sd->webcam);
1792 1793

	if (sd->bridge == BRIDGE_NW800) {
1794 1795 1796 1797 1798 1799 1800 1801 1802
		switch (sd->webcam) {
		case DS3303u:
			gspca_dev->cam.cam_mode = cif_mode;	/* qvga */
			break;
		default:
			gspca_dev->cam.cam_mode = &cif_mode[1];	/* cif */
			break;
		}
		gspca_dev->cam.nmodes = 1;
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815
	} else {
		gspca_dev->cam.cam_mode = vga_mode;
		switch (sd->webcam) {
		case Kr651us:
		case Proscope:
		case P35u:
			gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
			break;
		default:
			gspca_dev->cam.nmodes = 1;	/* qvga only */
			break;
		}
	}
1816

1817 1818
	return gspca_dev->usb_err;
}
1819

1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;

	switch (sd->bridge) {
	case BRIDGE_NW800:
		switch (sd->webcam) {
		case SpaceCam:
			reg_w_buf(gspca_dev, spacecam_init);
			break;
		default:
			reg_w_buf(gspca_dev, nw800_init);
			break;
		}
		break;
	default:
		switch (sd->webcam) {
		case Mustek300:
		case P35u:
		case Proscope:
			reg_w_buf(gspca_dev, proscope_init);
			break;
		}
		break;
	}
1846 1847 1848 1849 1850 1851 1852 1853 1854
	return gspca_dev->usb_err;
}

/* -- start the camera -- */
static int sd_start(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
	const u8 *cmd;

1855
	cmd = webcam_start[sd->webcam];
1856 1857 1858 1859
	reg_w_buf(gspca_dev, cmd);
	switch (sd->webcam) {
	case P35u:
		if (gspca_dev->width == 320)
1860
			reg_w_buf(gspca_dev, nw801_start_qvga);
1861
		else
1862 1863
			reg_w_buf(gspca_dev, nw801_start_vga);
		reg_w_buf(gspca_dev, nw801_start_2);
1864 1865 1866
		break;
	case Kr651us:
		if (gspca_dev->width == 320)
1867
			reg_w_buf(gspca_dev, kr651_start_qvga);
1868
		else
1869 1870
			reg_w_buf(gspca_dev, kr651_start_vga);
		reg_w_buf(gspca_dev, kr651_start_2);
1871 1872 1873
		break;
	case Proscope:
		if (gspca_dev->width == 320)
1874
			reg_w_buf(gspca_dev, proscope_start_qvga);
1875
		else
1876 1877
			reg_w_buf(gspca_dev, proscope_start_vga);
		reg_w_buf(gspca_dev, proscope_start_2);
1878 1879 1880
		break;
	}

1881 1882
	sd->exp_too_high_cnt = 0;
	sd->exp_too_low_cnt = 0;
1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956
	return gspca_dev->usb_err;
}

static void sd_stopN(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
	u8 value;

	/* 'go' off */
	if (sd->bridge != BRIDGE_NW801) {
		value = 0x02;
		reg_w(gspca_dev, 0x0406, &value, 1);
	}

	/* LED off */
	switch (sd->webcam) {
	case Cvideopro:
	case Kr651us:
	case DvcV6:
	case Kritter:
		value = 0xff;
		break;
	case Dlink350c:
		value = 0x21;
		break;
	case SpaceCam:
	case SpaceCam2:
	case Proscope:
	case Twinkle:
		value = 0x01;
		break;
	default:
		return;
	}
	reg_w(gspca_dev, 0x0404, &value, 1);
}

static void sd_pkt_scan(struct gspca_dev *gspca_dev,
			u8 *data,			/* isoc packet */
			int len)			/* iso packet length */
{
	/*
	 * frame header = '00 00 hh ww ss xx ff ff'
	 * with:
	 *	- 'hh': height / 4
	 *	- 'ww': width / 4
	 *	- 'ss': frame sequence number c0..dd
	 */
	if (data[0] == 0x00 && data[1] == 0x00
	 && data[6] == 0xff && data[7] == 0xff) {
		gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
		gspca_frame_add(gspca_dev, FIRST_PACKET, data + 8, len - 8);
	} else {
		gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
	}
}

static void do_autogain(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
	int luma;

	if (sd->ag_cnt < 0)
		return;
	if (--sd->ag_cnt >= 0)
		return;
	sd->ag_cnt = AG_CNT_START;

	/* get the average luma */
	reg_r(gspca_dev, sd->bridge == BRIDGE_NW801 ? 0x080d : 0x080c, 4);
	luma = (gspca_dev->usb_buf[3] << 24) + (gspca_dev->usb_buf[2] << 16)
		+ (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0];
	luma /= sd->ae_res;

1957 1958
	switch (sd->webcam) {
	case P35u:
1959
		gspca_coarse_grained_expo_autogain(gspca_dev, luma, 100, 5);
1960 1961
		break;
	default:
1962
		gspca_expo_autogain(gspca_dev, luma, 100, 5, 230, 0);
1963
		break;
1964 1965 1966
	}
}

1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001

static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
{
	struct gspca_dev *gspca_dev =
		container_of(ctrl->handler, struct gspca_dev, ctrl_handler);

	gspca_dev->usb_err = 0;

	if (!gspca_dev->streaming)
		return 0;

	switch (ctrl->id) {
	/* autogain/gain/exposure control cluster */
	case V4L2_CID_AUTOGAIN:
		if (ctrl->is_new)
			setautogain(gspca_dev, ctrl->val);
		if (!ctrl->val) {
			if (gspca_dev->gain->is_new)
				setgain(gspca_dev, gspca_dev->gain->val);
			if (gspca_dev->exposure->is_new)
				setexposure(gspca_dev,
					    gspca_dev->exposure->val);
		}
		break;
	/* Some webcams only have exposure, so handle that separately from the
	   autogain/gain/exposure cluster in the previous case. */
	case V4L2_CID_EXPOSURE:
		setexposure(gspca_dev, gspca_dev->exposure->val);
		break;
	}
	return gspca_dev->usb_err;
}

static const struct v4l2_ctrl_ops sd_ctrl_ops = {
	.s_ctrl = sd_s_ctrl,
2002 2003
};

2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046
static int sd_init_controls(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *)gspca_dev;
	struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;

	gspca_dev->vdev.ctrl_handler = hdl;
	v4l2_ctrl_handler_init(hdl, 3);
	switch (sd->webcam) {
	case P35u:
		gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
			V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
		/* For P35u choose coarse expo auto gain function gain minimum,
		 * to avoid a large settings jump the first auto adjustment */
		gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
			V4L2_CID_GAIN, 0, 127, 1, 127 / 5 * 2);
		gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
			V4L2_CID_EXPOSURE, 0, 9, 1, 9);
		break;
	case Kr651us:
		gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
			V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
		gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
			V4L2_CID_GAIN, 0, 253, 1, 128);
		/* fall through */
	case Cvideopro:
	case DvcV6:
	case Kritter:
		gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
			V4L2_CID_EXPOSURE, 0, 315, 1, 150);
		break;
	default:
		break;
	}

	if (hdl->error) {
		pr_err("Could not initialize controls\n");
		return hdl->error;
	}
	if (gspca_dev->autogain)
		v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false);
	return 0;
}

2047 2048 2049 2050 2051
/* sub-driver description */
static const struct sd_desc sd_desc = {
	.name = MODULE_NAME,
	.config = sd_config,
	.init = sd_init,
2052
	.init_controls = sd_init_controls,
2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092
	.start = sd_start,
	.stopN = sd_stopN,
	.pkt_scan = sd_pkt_scan,
	.dq_callback = do_autogain,
};

/* -- module initialisation -- */
static const struct usb_device_id device_table[] = {
	{USB_DEVICE(0x046d, 0xd001)},
	{USB_DEVICE(0x0502, 0xd001)},
	{USB_DEVICE(0x052b, 0xd001)},
	{USB_DEVICE(0x055f, 0xd001)},
	{USB_DEVICE(0x06a5, 0x0000)},
	{USB_DEVICE(0x06a5, 0xd001)},
	{USB_DEVICE(0x06a5, 0xd800)},
	{USB_DEVICE(0x06be, 0xd001)},
	{USB_DEVICE(0x0728, 0xd001)},
	{}
};
MODULE_DEVICE_TABLE(usb, device_table);

/* -- device connect -- */
static int sd_probe(struct usb_interface *intf,
			const struct usb_device_id *id)
{
	return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
				THIS_MODULE);
}

static struct usb_driver sd_driver = {
	.name = MODULE_NAME,
	.id_table = device_table,
	.probe = sd_probe,
	.disconnect = gspca_disconnect,
#ifdef CONFIG_PM
	.suspend = gspca_suspend,
	.resume = gspca_resume,
#endif
};

2093
module_usb_driver(sd_driver);
2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108

module_param(webcam, int, 0644);
MODULE_PARM_DESC(webcam,
	"Webcam type\n"
	"0: generic\n"
	"1: Trust 120 SpaceCam\n"
	"2: other Trust 120 SpaceCam\n"
	"3: Conceptronic Video Pro\n"
	"4: D-link dru-350c\n"
	"5: Plustek Opticam 500U\n"
	"6: Panasonic GP-KR651US\n"
	"7: iRez Kritter\n"
	"8: Mustek Wcam 300 mini\n"
	"9: Scalar USB Microscope M2 (Proscope)\n"
	"10: Divio Chicony TwinkleCam\n"
2109
	"11: DVC-V6\n");