nw80x.c 75.9 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 42
#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;

/* controls */
enum e_ctrl {
	GAIN,
	EXPOSURE,
	AUTOGAIN,
	NCTRLS		/* number of controls */
};

43 44
#define AUTOGAIN_DEF 1

45 46 47 48 49 50 51 52 53
/* specific webcam descriptor */
struct sd {
	struct gspca_dev gspca_dev;	/* !! must be the first item */

	struct gspca_ctrl ctrls[NCTRLS];

	u32 ae_res;
	s8 ag_cnt;
#define AG_CNT_START 13
54 55
	u8 exp_too_low_cnt;
	u8 exp_too_high_cnt;
56 57 58 59 60 61

	u8 bridge;
	u8 webcam;
};

enum bridges {
62
	BRIDGE_NW800,	/* and et31x110 */
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
	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 */
};

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 129 130 131 132 133 134 135 136 137 138 139 140
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
 */

141
/*
142 143 144 145 146 147 148 149 150 151 152
 * 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
 */
153

154 155 156 157
/* resolutions
 *	nw800: 320x240, 352x288
 *	nw801/802: 320x240, 640x480
 */
158
static const struct v4l2_pix_format cif_mode[] = {
159 160 161 162
	{320, 240, V4L2_PIX_FMT_JPGL, V4L2_FIELD_NONE,
		.bytesperline = 320,
		.sizeimage = 320 * 240 * 4 / 8,
		.colorspace = V4L2_COLORSPACE_JPEG},
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
	{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
188

189
static const u8 nw800_init[] = {
190 191
	0x04, 0x05, 0x01, 0x61,
	0x04, 0x04, 0x01, 0x01,
192
	0x04, 0x06, 0x01, 0x04,
193 194 195 196 197
	0x04, 0x04, 0x03, 0x00, 0x00, 0x00,
	0x05, 0x05, 0x01, 0x00,
	0, 0, 0
};
static const u8 nw800_start[] = {
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 339 340 341 342 343 344 345 346 347 348 349 350
	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
};

351 352 353
/* 06a5:d001 - nw801 - Panasonic
 *		P35u */
static const u8 nw801_start_1[] = {
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 396 397 398 399 400 401 402 403 404 405 406 407
	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,
};
408
static const u8 nw801_start_qvga[] = {
409 410 411 412 413 414 415 416 417 418 419
	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,
};
420
static const u8 nw801_start_vga[] = {
421 422 423 424 425 426 427 428 429 430
	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,
};
431
static const u8 nw801_start_2[] = {
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
	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?) */
460
static const u8 nw802_start[] = {
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 536 537 538 539 540 541 542 543 544 545 546 547
	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,
548 549 550
	0, 0, 0
};
static const u8 spacecam_start[] = {
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 624 625 626 627 628 629 630 631 632 633 634 635
	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
};
636 637
/* et31x110 - pas106 - other Trust SpaceCam120 */
static const u8 spacecam2_start[] = {
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 688 689 690 691 692 693 694 695 696 697 698 699
	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,
700
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
701 702 703
	0x02, 0x00, 0x11, 0x48, 0x58, 0x9e, 0x48, 0x58, 0x00, 0x00, 0x00,
			  0x00, 0x84, 0x36, 0x05, 0x01, 0xf2, 0x86, 0x65,
			  0x40,
704
	I2C0, 0x40, 0x02, 0x02, 0x0c,		/* pixel clock */
705
	I2C0, 0x40, 0x02, 0x0f, 0x00,
706
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
707 708 709
	0x10, 0x00, 0x01, 0x01,
	0x10, 0x8f, 0x0c, 0x62, 0x01, 0x24, 0x01, 0x62, 0x01, 0x24, 0x01,
			  0x20, 0x01, 0x60, 0x01,
710 711
	I2C0, 0x40, 0x02, 0x05, 0x0f,		/* exposure */
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
712
	I2C0, 0x40, 0x07, 0x09, 0x0b, 0x0f, 0x05, 0x05, 0x0f, 0x00,
713
						/* gains */
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
	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 */
736
static const u8 cvideopro_start[] = {
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 804 805 806 807 808 809 810 811 812 813 814 815
	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 */
816
static const u8 dlink_start[] = {
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 883 884 885 886 887 888 889 890 891 892 893 894
	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
};

895 896 897 898
/* 06a5:d001 - nw801 - Sony
 *		Plustek Opticam 500U or ProLink DS3303u (Hitachi HD49322BF) */
/*fixme: 320x240 only*/
static const u8 ds3303_start[] = {
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 968 969 970 971 972 973 974 975 976 977 978 979
	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
};

980 981 982
/* 06a5:d001 - nw802 - Panasonic
 *		GP-KR651US (Philips TDA8786) */
static const u8 kr651_start_1[] = {
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 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
	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
};
1035
static const u8 kr651_start_qvga[] = {
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
	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
};
1048
static const u8 kr651_start_vga[] = {
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
	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,
};
1060
static const u8 kr651_start_2[] = {
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079
	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 */
1080
static const u8 kritter_start[] = {
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 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159
	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 */
1160
static const u8 mustek_start[] = {
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 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239
	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) */
1240
static const u8 proscope_init[] = {
1241 1242
	0x04, 0x05, 0x01, 0x21,
	0x04, 0x04, 0x01, 0x01,
1243 1244 1245
	0, 0, 0
};
static const u8 proscope_start_1[] = {
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 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
	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
};
1298
static const u8 proscope_start_qvga[] = {
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310
	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
};
1311
static const u8 proscope_start_vga[] = {
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328
	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
};
1329
static const u8 proscope_start_2[] = {
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343
	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
};

1344 1345
/* nw800 - hv7121b? (seems pas106) - Divio Chicony TwinkleCam */
static const u8 twinkle_start[] = {
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 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410
	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,
1411
	I2C0, 0x40, 0x02, 0x13, 0x01,		/* i2c end */
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
	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 */
1448
static const u8 dvcv6_start[] = {
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 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532
	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,
};

1533
static const u8 *webcam_start[] = {
1534 1535
	[Generic800] = nw800_start,
	[SpaceCam] = spacecam_start,
1536 1537 1538 1539 1540 1541 1542
	[SpaceCam2] = spacecam2_start,
	[Cvideopro] = cvideopro_start,
	[Dlink350c] = dlink_start,
	[DS3303u] = ds3303_start,
	[Kr651us] = kr651_start_1,
	[Kritter] = kritter_start,
	[Mustek300] = mustek_start,
1543
	[Proscope] = proscope_start_1,
1544 1545 1546 1547
	[Twinkle] = twinkle_start,
	[DvcV6] = dvcv6_start,
	[P35u] = nw801_start_1,
	[Generic802] = nw802_start,
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575
};

/* -- 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) {
1576
		pr_err("reg_w err %d\n", ret);
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596
		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) {
1597
		pr_err("reg_r err %d\n", ret);
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 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650
		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
1651
			i2c_w(gspca_dev, reg, cmd, len);
1652 1653 1654 1655
		cmd += len;
	}
}

1656
static int swap_bits(int v)
1657 1658 1659 1660
{
	int r, i;

	r = 0;
1661
	for (i = 0; i < 8; i++) {
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674
		r <<= 1;
		if (v & 1)
			r++;
		v >>= 1;
	}
	return r;
}

static void setgain(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
	u8 val, v[2];

1675
	val = sd->ctrls[GAIN].val;
1676 1677 1678 1679
	switch (sd->webcam) {
	case P35u:
		/* Note the control goes from 0-255 not 0-127, but anything
		   above 127 just means amplifying noise */
1680
		val >>= 1;			/* 0 - 255 -> 0 - 127 */
1681 1682 1683
		reg_w(gspca_dev, 0x1026, &val, 1);
		break;
	case Kr651us:
1684 1685
		/* 0 - 253 */
		val = swap_bits(val);
1686 1687 1688 1689 1690 1691 1692 1693 1694 1695
		v[0] = val << 3;
		v[1] = val >> 5;
		reg_w(gspca_dev, 0x101d, v, 2);	/* SIF reg0/1 (AGC) */
		break;
	}
}

static void setexposure(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
1696
	s16 val;
1697 1698
	u8 v[2];

1699
	val = sd->ctrls[EXPOSURE].val;
1700 1701
	switch (sd->webcam) {
	case P35u:
1702
		v[0] = ((9 - val) << 3) | 0x01;
1703 1704
		reg_w(gspca_dev, 0x1019, v, 1);
		break;
1705 1706 1707
	case Cvideopro:
	case DvcV6:
	case Kritter:
1708
	case Kr651us:
1709 1710
		v[0] = val;
		v[1] = val >> 8;
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 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756
		reg_w(gspca_dev, 0x101b, v, 2);
		break;
	}
}

static void setautogain(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
	int w, h;

	if (gspca_dev->ctrl_dis & (1 << AUTOGAIN))
		return;
	if (!sd->ctrls[AUTOGAIN].val) {
		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;
}

1757 1758 1759
/* this function is called at probe time */
static int sd_config(struct gspca_dev *gspca_dev,
			const struct usb_device_id *id)
1760 1761 1762
{
	struct sd *sd = (struct sd *) gspca_dev;

1763 1764 1765 1766 1767 1768
	if ((unsigned) webcam >= NWEBCAMS)
		webcam = 0;
	sd->webcam = webcam;
	gspca_dev->cam.ctrls = sd->ctrls;
	sd->ag_cnt = -1;

1769 1770 1771 1772 1773 1774
	/*
	 * 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
1775 1776
	 * If a et31x110 (nw800 and 06a5:d800)
	 *	get the sensor ID
1777 1778 1779 1780 1781 1782 1783 1784 1785
	 */
	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;
1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803
	} 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;
		}
1804
	}
1805
	if (webcam_chip[sd->webcam] != sd->bridge) {
1806 1807
		pr_err("Bad webcam type %d for NW80%d\n",
		       sd->webcam, sd->bridge);
1808 1809 1810 1811
		gspca_dev->usb_err = -ENODEV;
		return gspca_dev->usb_err;
	}
	PDEBUG(D_PROBE, "Bridge nw80%d - type: %d", sd->bridge, sd->webcam);
1812 1813

	if (sd->bridge == BRIDGE_NW800) {
1814 1815 1816 1817 1818 1819 1820 1821 1822
		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;
1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837
	} 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;
		}
	}
	switch (sd->webcam) {
	case P35u:
1838
/*		sd->ctrls[EXPOSURE].max = 9;
1839 1840 1841 1842
 *		sd->ctrls[EXPOSURE].def = 9; */
		/* coarse expo auto gain function gain minimum, to avoid
		 * a large settings jump the first auto adjustment */
		sd->ctrls[GAIN].def = 255 / 5 * 2;
1843
		break;
1844 1845 1846 1847 1848
	case Cvideopro:
	case DvcV6:
	case Kritter:
		gspca_dev->ctrl_dis = (1 << GAIN) | (1 << AUTOGAIN);
		/* fall thru */
1849 1850 1851 1852 1853
	case Kr651us:
		sd->ctrls[EXPOSURE].max = 315;
		sd->ctrls[EXPOSURE].def = 150;
		break;
	default:
1854 1855
		gspca_dev->ctrl_dis = (1 << GAIN) | (1 << EXPOSURE)
					 | (1 << AUTOGAIN);
1856 1857
		break;
	}
1858 1859 1860 1861 1862

#if AUTOGAIN_DEF
	if (!(gspca_dev->ctrl_dis & (1 << AUTOGAIN)))
		gspca_dev->ctrl_inac = (1 << GAIN) | (1 << EXPOSURE);
#endif
1863 1864
	return gspca_dev->usb_err;
}
1865

1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891
/* 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;
	}
1892 1893 1894 1895 1896 1897 1898 1899 1900
	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;

1901
	cmd = webcam_start[sd->webcam];
1902 1903 1904 1905
	reg_w_buf(gspca_dev, cmd);
	switch (sd->webcam) {
	case P35u:
		if (gspca_dev->width == 320)
1906
			reg_w_buf(gspca_dev, nw801_start_qvga);
1907
		else
1908 1909
			reg_w_buf(gspca_dev, nw801_start_vga);
		reg_w_buf(gspca_dev, nw801_start_2);
1910 1911 1912
		break;
	case Kr651us:
		if (gspca_dev->width == 320)
1913
			reg_w_buf(gspca_dev, kr651_start_qvga);
1914
		else
1915 1916
			reg_w_buf(gspca_dev, kr651_start_vga);
		reg_w_buf(gspca_dev, kr651_start_2);
1917 1918 1919
		break;
	case Proscope:
		if (gspca_dev->width == 320)
1920
			reg_w_buf(gspca_dev, proscope_start_qvga);
1921
		else
1922 1923
			reg_w_buf(gspca_dev, proscope_start_vga);
		reg_w_buf(gspca_dev, proscope_start_2);
1924 1925 1926 1927 1928 1929
		break;
	}

	setgain(gspca_dev);
	setexposure(gspca_dev);
	setautogain(gspca_dev);
1930 1931
	sd->exp_too_high_cnt = 0;
	sd->exp_too_low_cnt = 0;
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 1957 1958 1959 1960 1961 1962 1963 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 2002
	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 int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	sd->ctrls[AUTOGAIN].val = val;
	if (val)
		gspca_dev->ctrl_inac = (1 << GAIN) | (1 << EXPOSURE);
	else
		gspca_dev->ctrl_inac = 0;
	if (gspca_dev->streaming)
		setautogain(gspca_dev);
	return gspca_dev->usb_err;
}

2003 2004
#include "autogain_functions.h"

2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021
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;

2022 2023 2024 2025 2026 2027 2028
	switch (sd->webcam) {
	case P35u:
		coarse_grained_expo_autogain(gspca_dev, luma, 100, 5);
		break;
	default:
		auto_gain_n_exposure(gspca_dev, luma, 100, 5, 230, 0);
		break;
2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039
	}
}

/* V4L2 controls supported by the driver */
static const struct ctrl sd_ctrls[NCTRLS] = {
[GAIN] = {
	    {
		.id      = V4L2_CID_GAIN,
		.type    = V4L2_CTRL_TYPE_INTEGER,
		.name    = "Gain",
		.minimum = 0,
2040
		.maximum = 253,
2041
		.step    = 1,
2042
		.default_value = 128
2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053
	    },
	    .set_control = setgain
	},
[EXPOSURE] = {
	    {
		.id      = V4L2_CID_EXPOSURE,
		.type    = V4L2_CTRL_TYPE_INTEGER,
		.name    = "Exposure",
		.minimum = 0,
		.maximum = 9,
		.step    = 1,
2054
		.default_value = 9
2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065
	    },
	    .set_control = setexposure
	},
[AUTOGAIN] = {
	    {
		.id      = V4L2_CID_AUTOGAIN,
		.type    = V4L2_CTRL_TYPE_BOOLEAN,
		.name    = "Auto Gain",
		.minimum = 0,
		.maximum = 1,
		.step    = 1,
2066
		.default_value = AUTOGAIN_DEF,
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 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146
		.flags   = V4L2_CTRL_FLAG_UPDATE
	    },
	    .set = sd_setautogain
	},
};

/* sub-driver description */
static const struct sd_desc sd_desc = {
	.name = MODULE_NAME,
	.ctrls = sd_ctrls,
	.nctrls = ARRAY_SIZE(sd_ctrls),
	.config = sd_config,
	.init = sd_init,
	.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
};

/* -- module insert / remove -- */
static int __init sd_mod_init(void)
{
	return usb_register(&sd_driver);
}
static void __exit sd_mod_exit(void)
{
	usb_deregister(&sd_driver);
}

module_init(sd_mod_init);
module_exit(sd_mod_exit);

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"
2147
	"11: DVC-V6\n");