vc032x.c 99.2 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 23 24 25 26 27 28 29 30 31 32 33 34
/*
 *		Z-star vc0321 library
 *		Copyright (C) 2006 Koninski Artur takeshi87@o2.pl
 *		Copyright (C) 2006 Michel Xhaard
 *
 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
 *
 * 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
 */

#define MODULE_NAME "vc032x"

#include "gspca.h"

MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
MODULE_LICENSE("GPL");

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

35 36 37 38
	u8 hflip;
	u8 vflip;
	u8 lightfreq;
	u8 sharpness;
39

40 41
	u8 image_offset;

42
	u8 bridge;
43 44
#define BRIDGE_VC0321 0
#define BRIDGE_VC0323 1
45
	u8 sensor;
46
#define SENSOR_HV7131R 0
47
#define SENSOR_MI0360 1
48 49 50 51 52 53 54
#define SENSOR_MI1310_SOC 2
#define SENSOR_MI1320 3
#define SENSOR_MI1320_SOC 4
#define SENSOR_OV7660 5
#define SENSOR_OV7670 6
#define SENSOR_PO1200 7
#define SENSOR_PO3130NC 8
55 56 57 58
	u8 flags;
#define FL_SAMSUNG 0x01		/* SamsungQ1 (2 sensors) */
#define FL_HFLIP 0x02		/* mirrored by default */
#define FL_VFLIP 0x04		/* vertical flipped by default */
59 60 61
};

/* V4L2 controls supported by the driver */
62 63 64 65
static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
66 67
static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
68 69
static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
70 71

static struct ctrl sd_ctrls[] = {
72
/* next 2 controls work with some sensors only */
73
#define HFLIP_IDX 0
74 75 76 77 78 79 80 81 82 83 84 85 86 87
	{
	    {
		.id      = V4L2_CID_HFLIP,
		.type    = V4L2_CTRL_TYPE_BOOLEAN,
		.name    = "Mirror",
		.minimum = 0,
		.maximum = 1,
		.step    = 1,
#define HFLIP_DEF 0
		.default_value = HFLIP_DEF,
	    },
	    .set = sd_sethflip,
	    .get = sd_gethflip,
	},
88
#define VFLIP_IDX 1
89 90 91 92 93 94 95 96 97 98 99 100 101 102
	{
	    {
		.id      = V4L2_CID_VFLIP,
		.type    = V4L2_CTRL_TYPE_BOOLEAN,
		.name    = "Vflip",
		.minimum = 0,
		.maximum = 1,
		.step    = 1,
#define VFLIP_DEF 0
		.default_value = VFLIP_DEF,
	    },
	    .set = sd_setvflip,
	    .get = sd_getvflip,
	},
103
#define LIGHTFREQ_IDX 2
104 105 106 107 108 109
	{
	    {
		.id	 = V4L2_CID_POWER_LINE_FREQUENCY,
		.type    = V4L2_CTRL_TYPE_MENU,
		.name    = "Light frequency filter",
		.minimum = 0,
110
		.maximum = 2,	/* 0: No, 1: 50Hz, 2:60Hz */
111
		.step    = 1,
112 113
#define FREQ_DEF 1
		.default_value = FREQ_DEF,
114 115 116 117
	    },
	    .set = sd_setfreq,
	    .get = sd_getfreq,
	},
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
/* po1200 only */
#define SHARPNESS_IDX 3
	{
	 {
	  .id = V4L2_CID_SHARPNESS,
	  .type = V4L2_CTRL_TYPE_INTEGER,
	  .name = "Sharpness",
	  .minimum = 0,
	  .maximum = 2,
	  .step = 1,
#define SHARPNESS_DEF 1
	  .default_value = SHARPNESS_DEF,
	  },
	 .set = sd_setsharpness,
	 .get = sd_getsharpness,
	 },
134 135
};

136
static const struct v4l2_pix_format vc0321_mode[] = {
137
	{320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
138
		.bytesperline = 320,
139 140 141
		.sizeimage = 320 * 240 * 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 1},
142
	{640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
143
		.bytesperline = 640,
144 145 146
		.sizeimage = 640 * 480 * 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 0},
147
};
148
static const struct v4l2_pix_format vc0323_mode[] = {
149 150 151 152 153 154 155 156 157 158
	{320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
		.bytesperline = 320,
		.sizeimage = 320 * 240 * 3 / 8 + 590,
		.colorspace = V4L2_COLORSPACE_JPEG,
		.priv = 1},
	{640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
		.bytesperline = 640,
		.sizeimage = 640 * 480 * 3 / 8 + 590,
		.colorspace = V4L2_COLORSPACE_JPEG,
		.priv = 0},
159
	{1280, 960, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, /* mi1310_soc only */
160
		.bytesperline = 1280,
161
		.sizeimage = 1280 * 960 * 3 / 8 + 590,
162 163
		.colorspace = V4L2_COLORSPACE_JPEG,
		.priv = 2},
164
};
165
static const struct v4l2_pix_format bi_mode[] = {
166
	{320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
167 168 169
		.bytesperline = 320,
		.sizeimage = 320 * 240 * 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
170
		.priv = 2},
171
	{640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
172 173 174 175
		.bytesperline = 640,
		.sizeimage = 640 * 480 * 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 1},
176
	{1280, 1024, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
177 178 179 180 181
		.bytesperline = 1280,
		.sizeimage = 1280 * 1024 * 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 0},
};
182
static const struct v4l2_pix_format svga_mode[] = {
183 184 185 186 187 188 189
	{800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
		.bytesperline = 800,
		.sizeimage = 800 * 600 * 1 / 4 + 590,
		.colorspace = V4L2_COLORSPACE_JPEG,
		.priv = 0},
};

190 191 192 193 194
/* OV7660/7670 registers */
#define OV7660_REG_MVFP 0x1e
#define OV7660_MVFP_MIRROR	0x20
#define OV7660_MVFP_VFLIP	0x10

195
static const u8 mi0360_matrix[9] = {
196 197 198
	0x50, 0xf8, 0xf8, 0xf5, 0x50, 0xfb, 0xff, 0xf1, 0x50
};

199
static const u8 mi0360_initVGA_JPG[][4] = {
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
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
	{0xb3, 0x00, 0x24, 0xcc},
	{0xb3, 0x00, 0x25, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x03, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},
	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x35, 0xdd, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x00, 0x25, 0xcc},
	{0xbc, 0x00, 0x71, 0xcc},
	{0xb8, 0x00, 0x13, 0xcc},
	{0xb8, 0x27, 0x20, 0xcc},
	{0xb8, 0x2c, 0x50, 0xcc},
	{0xb8, 0x2d, 0xf8, 0xcc},
	{0xb8, 0x2e, 0xf8, 0xcc},
	{0xb8, 0x2f, 0xf8, 0xcc},
	{0xb8, 0x30, 0x50, 0xcc},
	{0xb8, 0x31, 0xf8, 0xcc},
	{0xb8, 0x32, 0xf8, 0xcc},
	{0xb8, 0x33, 0xf8, 0xcc},
	{0xb8, 0x34, 0x50, 0xcc},
	{0xb8, 0x35, 0x00, 0xcc},
	{0xb8, 0x36, 0x00, 0xcc},
	{0xb8, 0x37, 0x00, 0xcc},
	{0xb8, 0x01, 0x79, 0xcc},
	{0xb8, 0x08, 0xe0, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{0xb8, 0x01, 0x79, 0xcc},
	{0xb8, 0x14, 0x18, 0xcc},
	{0xb8, 0xb2, 0x0a, 0xcc},
	{0xb8, 0xb4, 0x0a, 0xcc},
	{0xb8, 0xb5, 0x0a, 0xcc},
	{0xb8, 0xfe, 0x00, 0xcc},
	{0xb8, 0xff, 0x28, 0xcc},
	{0xb9, 0x00, 0x28, 0xcc},
	{0xb9, 0x01, 0x28, 0xcc},
	{0xb9, 0x02, 0x28, 0xcc},
	{0xb9, 0x03, 0x00, 0xcc},
	{0xb9, 0x04, 0x00, 0xcc},
	{0xb9, 0x05, 0x3c, 0xcc},
	{0xb9, 0x06, 0x3c, 0xcc},
	{0xb9, 0x07, 0x3c, 0xcc},
	{0xb9, 0x08, 0x3c, 0xcc},
	{0xb8, 0x8e, 0x00, 0xcc},
	{0xb8, 0x8f, 0xff, 0xcc},
	{0xb8, 0x81, 0x09, 0xcc},
	{0x31, 0x00, 0x00, 0xbb},
	{0x09, 0x01, 0xc7, 0xbb},
	{0x34, 0x01, 0x00, 0xbb},
	{0x2b, 0x00, 0x28, 0xbb},
	{0x2c, 0x00, 0x30, 0xbb},
	{0x2d, 0x00, 0x30, 0xbb},
	{0x2e, 0x00, 0x28, 0xbb},
	{0x62, 0x04, 0x11, 0xbb},
	{0x03, 0x01, 0xe0, 0xbb},
	{0x2c, 0x00, 0x2c, 0xbb},
	{0x20, 0xd0, 0x00, 0xbb},
	{0x01, 0x00, 0x08, 0xbb},
	{0x06, 0x00, 0x10, 0xbb},
	{0x05, 0x00, 0x20, 0xbb},
	{0x20, 0x00, 0x00, 0xbb},
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x02, 0xcc},
	{0xb6, 0x02, 0x80, 0xcc},
	{0xb6, 0x05, 0x01, 0xcc},
	{0xb6, 0x04, 0xe0, 0xcc},
	{0xb6, 0x12, 0x78, 0xcc},
	{0xb6, 0x18, 0x02, 0xcc},
	{0xb6, 0x17, 0x58, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xb3, 0x02, 0x02, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
	{0xbf, 0xcc, 0x10, 0xcc},
	{0xb9, 0x12, 0x00, 0xcc},
	{0xb9, 0x13, 0x0a, 0xcc},
	{0xb9, 0x14, 0x0a, 0xcc},
	{0xb9, 0x15, 0x0a, 0xcc},
	{0xb9, 0x16, 0x0a, 0xcc},
	{0xb9, 0x18, 0x00, 0xcc},
	{0xb9, 0x19, 0x0f, 0xcc},
	{0xb9, 0x1a, 0x0f, 0xcc},
	{0xb9, 0x1b, 0x0f, 0xcc},
	{0xb9, 0x1c, 0x0f, 0xcc},
	{0xb8, 0x8e, 0x00, 0xcc},
	{0xb8, 0x8f, 0xff, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb8, 0x0c, 0x20, 0xcc},
	{0xb8, 0x0d, 0x70, 0xcc},
	{0xb6, 0x13, 0x13, 0xcc},
	{0x35, 0x00, 0x60, 0xbb},
	{0xb3, 0x5c, 0x01, 0xcc},
	{}
};
308
static const u8 mi0360_initQVGA_JPG[][4] = {
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 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 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
	{0xb3, 0x00, 0x24, 0xcc},
	{0xb3, 0x00, 0x25, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x03, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},
	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x35, 0xdd, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x00, 0x25, 0xcc},
	{0xbc, 0x00, 0xd1, 0xcc},
	{0xb8, 0x00, 0x13, 0xcc},
	{0xb8, 0x27, 0x20, 0xcc},
	{0xb8, 0x2c, 0x50, 0xcc},
	{0xb8, 0x2d, 0xf8, 0xcc},
	{0xb8, 0x2e, 0xf8, 0xcc},
	{0xb8, 0x2f, 0xf8, 0xcc},
	{0xb8, 0x30, 0x50, 0xcc},
	{0xb8, 0x31, 0xf8, 0xcc},
	{0xb8, 0x32, 0xf8, 0xcc},
	{0xb8, 0x33, 0xf8, 0xcc},
	{0xb8, 0x34, 0x50, 0xcc},
	{0xb8, 0x35, 0x00, 0xcc},
	{0xb8, 0x36, 0x00, 0xcc},
	{0xb8, 0x37, 0x00, 0xcc},
	{0xb8, 0x01, 0x79, 0xcc},
	{0xb8, 0x08, 0xe0, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{0xb8, 0x01, 0x79, 0xcc},
	{0xb8, 0x14, 0x18, 0xcc},
	{0xb8, 0xb2, 0x0a, 0xcc},
	{0xb8, 0xb4, 0x0a, 0xcc},
	{0xb8, 0xb5, 0x0a, 0xcc},
	{0xb8, 0xfe, 0x00, 0xcc},
	{0xb8, 0xff, 0x28, 0xcc},
	{0xb9, 0x00, 0x28, 0xcc},
	{0xb9, 0x01, 0x28, 0xcc},
	{0xb9, 0x02, 0x28, 0xcc},
	{0xb9, 0x03, 0x00, 0xcc},
	{0xb9, 0x04, 0x00, 0xcc},
	{0xb9, 0x05, 0x3c, 0xcc},
	{0xb9, 0x06, 0x3c, 0xcc},
	{0xb9, 0x07, 0x3c, 0xcc},
	{0xb9, 0x08, 0x3c, 0xcc},
	{0xb8, 0x8e, 0x00, 0xcc},
	{0xb8, 0x8f, 0xff, 0xcc},
	{0xb8, 0x81, 0x09, 0xcc},
	{0x31, 0x00, 0x00, 0xbb},
	{0x09, 0x01, 0xc7, 0xbb},
	{0x34, 0x01, 0x00, 0xbb},
	{0x2b, 0x00, 0x28, 0xbb},
	{0x2c, 0x00, 0x30, 0xbb},
	{0x2d, 0x00, 0x30, 0xbb},
	{0x2e, 0x00, 0x28, 0xbb},
	{0x62, 0x04, 0x11, 0xbb},
	{0x03, 0x01, 0xe0, 0xbb},
	{0x2c, 0x00, 0x2c, 0xbb},
	{0x20, 0xd0, 0x00, 0xbb},
	{0x01, 0x00, 0x08, 0xbb},
	{0x06, 0x00, 0x10, 0xbb},
	{0x05, 0x00, 0x20, 0xbb},
	{0x20, 0x00, 0x00, 0xbb},
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x01, 0xcc},
	{0xb6, 0x02, 0x40, 0xcc},
	{0xb6, 0x05, 0x00, 0xcc},
	{0xb6, 0x04, 0xf0, 0xcc},
	{0xb6, 0x12, 0x78, 0xcc},
	{0xb6, 0x18, 0x00, 0xcc},
	{0xb6, 0x17, 0x96, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xb3, 0x02, 0x02, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
	{0xbf, 0xcc, 0x10, 0xcc},
	{0xb9, 0x12, 0x00, 0xcc},
	{0xb9, 0x13, 0x0a, 0xcc},
	{0xb9, 0x14, 0x0a, 0xcc},
	{0xb9, 0x15, 0x0a, 0xcc},
	{0xb9, 0x16, 0x0a, 0xcc},
	{0xb9, 0x18, 0x00, 0xcc},
	{0xb9, 0x19, 0x0f, 0xcc},
	{0xb9, 0x1a, 0x0f, 0xcc},
	{0xb9, 0x1b, 0x0f, 0xcc},
	{0xb9, 0x1c, 0x0f, 0xcc},
	{0xb8, 0x8e, 0x00, 0xcc},
	{0xb8, 0x8f, 0xff, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb6, 0x13, 0x13, 0xcc},
	{0xbc, 0x02, 0x18, 0xcc},
	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},
	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},
	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},
	{0xbc, 0x0a, 0x10, 0xcc},
	{0xb8, 0x0c, 0x20, 0xcc},
	{0xb8, 0x0d, 0x70, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},
	{0xbc, 0x0c, 0x00, 0xcc},
	{0x35, 0x00, 0xef, 0xbb},
	{0xb3, 0x5c, 0x01, 0xcc},
	{}
};

428
static const u8 mi1310_socinitVGA_JPG[][4] = {
429 430
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
431 432 433 434
	{0xb3, 0x00, 0x64, 0xcc},
	{0xb3, 0x00, 0x65, 0xcc},
	{0xb3, 0x05, 0x00, 0xcc},
	{0xb3, 0x06, 0x00, 0xcc},
435 436 437 438
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xdd, 0xcc},
439
	{0xb3, 0x02, 0x00, 0xcc},
440
	{0xb3, 0x03, 0x0a, 0xcc},
441
	{0xb3, 0x04, 0x05, 0xcc},
442 443
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
444 445
	{0xb3, 0x22, 0x03, 0xcc},
	{0xb3, 0x23, 0xc0, 0xcc},
446 447
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
448 449 450 451 452 453 454 455 456 457
	{0xb3, 0x16, 0x04, 0xcc},
	{0xb3, 0x17, 0xff, 0xcc},
	{0xb3, 0x00, 0x65, 0xcc},
	{0xb8, 0x00, 0x00, 0xcc},
	{0xbc, 0x00, 0xd0, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},
	{0xf0, 0x00, 0x02, 0xbb},
	{0xc8, 0x9f, 0x0b, 0xbb},
	{0x5b, 0x00, 0x01, 0xbb},
	{0x2f, 0xde, 0x20, 0xbb},
458
	{0xf0, 0x00, 0x00, 0xbb},
459
	{0x20, 0x03, 0x02, 0xbb},	/* h/v flip */
460
	{0xf0, 0x00, 0x01, 0xbb},
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
	{0x05, 0x00, 0x07, 0xbb},
	{0x34, 0x00, 0x00, 0xbb},
	{0x35, 0xff, 0x00, 0xbb},
	{0xdc, 0x07, 0x02, 0xbb},
	{0xdd, 0x3c, 0x18, 0xbb},
	{0xde, 0x92, 0x6d, 0xbb},
	{0xdf, 0xcd, 0xb1, 0xbb},
	{0xe0, 0xff, 0xe7, 0xbb},
	{0x06, 0xf0, 0x0d, 0xbb},
	{0x06, 0x70, 0x0e, 0xbb},
	{0x4c, 0x00, 0x01, 0xbb},
	{0x4d, 0x00, 0x01, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x2e, 0x0c, 0x55, 0xbb},
	{0x21, 0xb6, 0x6e, 0xbb},
	{0x36, 0x30, 0x10, 0xbb},
	{0x37, 0x00, 0xc1, 0xbb},
478
	{0xf0, 0x00, 0x00, 0xbb},
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
	{0x07, 0x00, 0x84, 0xbb},
	{0x08, 0x02, 0x4a, 0xbb},
	{0x05, 0x01, 0x10, 0xbb},
	{0x06, 0x00, 0x39, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x58, 0x02, 0x67, 0xbb},
	{0x57, 0x02, 0x00, 0xbb},
	{0x5a, 0x02, 0x67, 0xbb},
	{0x59, 0x02, 0x00, 0xbb},
	{0x5c, 0x12, 0x0d, 0xbb},
	{0x5d, 0x16, 0x11, 0xbb},
	{0x39, 0x06, 0x18, 0xbb},
	{0x3a, 0x06, 0x18, 0xbb},
	{0x3b, 0x06, 0x18, 0xbb},
	{0x3c, 0x06, 0x18, 0xbb},
	{0x64, 0x7b, 0x5b, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x36, 0x30, 0x10, 0xbb},
	{0x37, 0x00, 0xc0, 0xbb},
	{0xbc, 0x0e, 0x00, 0xcc},
	{0xbc, 0x0f, 0x05, 0xcc},
	{0xbc, 0x10, 0xc0, 0xcc},
	{0xbc, 0x11, 0x03, 0xcc},
502 503 504 505 506
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x02, 0xcc},
	{0xb6, 0x02, 0x80, 0xcc},
	{0xb6, 0x05, 0x01, 0xcc},
	{0xb6, 0x04, 0xe0, 0xcc},
507 508
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb6, 0x13, 0x25, 0xcc},
509 510 511 512 513 514 515
	{0xb6, 0x18, 0x02, 0xcc},
	{0xb6, 0x17, 0x58, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
516
	{0xbf, 0xcc, 0x00, 0xcc},
517 518 519 520 521 522 523 524 525 526
	{0xbc, 0x02, 0x18, 0xcc},
	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},
	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},
	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},
	{0xbc, 0x0a, 0x10, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},
	{0xbc, 0x0c, 0x00, 0xcc},
527 528 529 530 531 532 533 534 535 536 537 538 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
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x80, 0x00, 0x03, 0xbb},
	{0x81, 0xc7, 0x14, 0xbb},
	{0x82, 0xeb, 0xe8, 0xbb},
	{0x83, 0xfe, 0xf4, 0xbb},
	{0x84, 0xcd, 0x10, 0xbb},
	{0x85, 0xf3, 0xee, 0xbb},
	{0x86, 0xff, 0xf1, 0xbb},
	{0x87, 0xcd, 0x10, 0xbb},
	{0x88, 0xf3, 0xee, 0xbb},
	{0x89, 0x01, 0xf1, 0xbb},
	{0x8a, 0xe5, 0x17, 0xbb},
	{0x8b, 0xe8, 0xe2, 0xbb},
	{0x8c, 0xf7, 0xed, 0xbb},
	{0x8d, 0x00, 0xff, 0xbb},
	{0x8e, 0xec, 0x10, 0xbb},
	{0x8f, 0xf0, 0xed, 0xbb},
	{0x90, 0xf9, 0xf2, 0xbb},
	{0x91, 0x00, 0x00, 0xbb},
	{0x92, 0xe9, 0x0d, 0xbb},
	{0x93, 0xf4, 0xf2, 0xbb},
	{0x94, 0xfb, 0xf5, 0xbb},
	{0x95, 0x00, 0xff, 0xbb},
	{0xb6, 0x0f, 0x08, 0xbb},
	{0xb7, 0x3d, 0x16, 0xbb},
	{0xb8, 0x0c, 0x04, 0xbb},
	{0xb9, 0x1c, 0x07, 0xbb},
	{0xba, 0x0a, 0x03, 0xbb},
	{0xbb, 0x1b, 0x09, 0xbb},
	{0xbc, 0x17, 0x0d, 0xbb},
	{0xbd, 0x23, 0x1d, 0xbb},
	{0xbe, 0x00, 0x28, 0xbb},
	{0xbf, 0x11, 0x09, 0xbb},
	{0xc0, 0x16, 0x15, 0xbb},
	{0xc1, 0x00, 0x1b, 0xbb},
	{0xc2, 0x0e, 0x07, 0xbb},
	{0xc3, 0x14, 0x10, 0xbb},
	{0xc4, 0x00, 0x17, 0xbb},
	{0x06, 0x74, 0x8e, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x06, 0xf4, 0x8e, 0xbb},
	{0x00, 0x00, 0x50, 0xdd},
	{0x06, 0x74, 0x8e, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x24, 0x50, 0x20, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x34, 0x0c, 0x50, 0xbb},
575
	{0xb3, 0x01, 0x41, 0xcc},
576 577 578 579
	{0xf0, 0x00, 0x00, 0xbb},
	{0x03, 0x03, 0xc0, 0xbb},
	{},
};
580
static const u8 mi1310_socinitQVGA_JPG[][4] = {
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
	{0xb0, 0x03, 0x19, 0xcc},	{0xb0, 0x04, 0x02, 0xcc},
	{0xb3, 0x00, 0x64, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
	{0xb3, 0x05, 0x00, 0xcc},	{0xb3, 0x06, 0x00, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},	{0xb3, 0x35, 0xdd, 0xcc},
	{0xb3, 0x02, 0x00, 0xcc},	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x03, 0xcc},
	{0xb3, 0x23, 0xc0, 0xcc},	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},	{0xb3, 0x16, 0x04, 0xcc},
	{0xb3, 0x17, 0xff, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
	{0xb8, 0x00, 0x00, 0xcc},	{0xbc, 0x00, 0xf0, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},	{0xf0, 0x00, 0x02, 0xbb},
	{0xc8, 0x9f, 0x0b, 0xbb},	{0x5b, 0x00, 0x01, 0xbb},
	{0x2f, 0xde, 0x20, 0xbb},	{0xf0, 0x00, 0x00, 0xbb},
596 597
	{0x20, 0x03, 0x02, 0xbb},	/* h/v flip */
	{0xf0, 0x00, 0x01, 0xbb},
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 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650
	{0x05, 0x00, 0x07, 0xbb},	{0x34, 0x00, 0x00, 0xbb},
	{0x35, 0xff, 0x00, 0xbb},	{0xdc, 0x07, 0x02, 0xbb},
	{0xdd, 0x3c, 0x18, 0xbb},	{0xde, 0x92, 0x6d, 0xbb},
	{0xdf, 0xcd, 0xb1, 0xbb},	{0xe0, 0xff, 0xe7, 0xbb},
	{0x06, 0xf0, 0x0d, 0xbb},	{0x06, 0x70, 0x0e, 0xbb},
	{0x4c, 0x00, 0x01, 0xbb},	{0x4d, 0x00, 0x01, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x2e, 0x0c, 0x55, 0xbb},
	{0x21, 0xb6, 0x6e, 0xbb},	{0x36, 0x30, 0x10, 0xbb},
	{0x37, 0x00, 0xc1, 0xbb},	{0xf0, 0x00, 0x00, 0xbb},
	{0x07, 0x00, 0x84, 0xbb},	{0x08, 0x02, 0x4a, 0xbb},
	{0x05, 0x01, 0x10, 0xbb},	{0x06, 0x00, 0x39, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x58, 0x02, 0x67, 0xbb},
	{0x57, 0x02, 0x00, 0xbb},	{0x5a, 0x02, 0x67, 0xbb},
	{0x59, 0x02, 0x00, 0xbb},	{0x5c, 0x12, 0x0d, 0xbb},
	{0x5d, 0x16, 0x11, 0xbb},	{0x39, 0x06, 0x18, 0xbb},
	{0x3a, 0x06, 0x18, 0xbb},	{0x3b, 0x06, 0x18, 0xbb},
	{0x3c, 0x06, 0x18, 0xbb},	{0x64, 0x7b, 0x5b, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x36, 0x30, 0x10, 0xbb},
	{0x37, 0x00, 0xc0, 0xbb},	{0xbc, 0x0e, 0x00, 0xcc},
	{0xbc, 0x0f, 0x05, 0xcc},	{0xbc, 0x10, 0xc0, 0xcc},
	{0xbc, 0x11, 0x03, 0xcc},	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x01, 0xcc},	{0xb6, 0x02, 0x40, 0xcc},
	{0xb6, 0x05, 0x00, 0xcc},	{0xb6, 0x04, 0xf0, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},	{0xb6, 0x13, 0x25, 0xcc},
	{0xb6, 0x18, 0x00, 0xcc},	{0xb6, 0x17, 0x96, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},	{0xbf, 0xcc, 0x00, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},	{0xf0, 0x00, 0x01, 0xbb},
	{0x80, 0x00, 0x03, 0xbb},	{0x81, 0xc7, 0x14, 0xbb},
	{0x82, 0xeb, 0xe8, 0xbb},	{0x83, 0xfe, 0xf4, 0xbb},
	{0x84, 0xcd, 0x10, 0xbb},	{0x85, 0xf3, 0xee, 0xbb},
	{0x86, 0xff, 0xf1, 0xbb},	{0x87, 0xcd, 0x10, 0xbb},
	{0x88, 0xf3, 0xee, 0xbb},	{0x89, 0x01, 0xf1, 0xbb},
	{0x8a, 0xe5, 0x17, 0xbb},	{0x8b, 0xe8, 0xe2, 0xbb},
	{0x8c, 0xf7, 0xed, 0xbb},	{0x8d, 0x00, 0xff, 0xbb},
	{0x8e, 0xec, 0x10, 0xbb},	{0x8f, 0xf0, 0xed, 0xbb},
	{0x90, 0xf9, 0xf2, 0xbb},	{0x91, 0x00, 0x00, 0xbb},
	{0x92, 0xe9, 0x0d, 0xbb},	{0x93, 0xf4, 0xf2, 0xbb},
	{0x94, 0xfb, 0xf5, 0xbb},	{0x95, 0x00, 0xff, 0xbb},
	{0xb6, 0x0f, 0x08, 0xbb},	{0xb7, 0x3d, 0x16, 0xbb},
	{0xb8, 0x0c, 0x04, 0xbb},	{0xb9, 0x1c, 0x07, 0xbb},
	{0xba, 0x0a, 0x03, 0xbb},	{0xbb, 0x1b, 0x09, 0xbb},
	{0xbc, 0x17, 0x0d, 0xbb},	{0xbd, 0x23, 0x1d, 0xbb},
	{0xbe, 0x00, 0x28, 0xbb},	{0xbf, 0x11, 0x09, 0xbb},
	{0xc0, 0x16, 0x15, 0xbb},	{0xc1, 0x00, 0x1b, 0xbb},
	{0xc2, 0x0e, 0x07, 0xbb},	{0xc3, 0x14, 0x10, 0xbb},
	{0xc4, 0x00, 0x17, 0xbb},	{0x06, 0x74, 0x8e, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},	{0x06, 0xf4, 0x8e, 0xbb},
	{0x00, 0x00, 0x50, 0xdd},	{0x06, 0x74, 0x8e, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x24, 0x50, 0x20, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x34, 0x0c, 0x50, 0xbb},
	{0xb3, 0x01, 0x41, 0xcc},	{0xf0, 0x00, 0x00, 0xbb},
651 652 653
	{0x03, 0x03, 0xc0, 0xbb},
	{},
};
654 655 656
static const u8 mi1310_soc_InitSXGA_JPG[][4] = {
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
657 658
	{0xb3, 0x00, 0x64, 0xcc},
	{0xb3, 0x00, 0x65, 0xcc},
659
	{0xb3, 0x05, 0x00, 0xcc},
660
	{0xb3, 0x06, 0x00, 0xcc},
661 662 663 664
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xdd, 0xcc},
665
	{0xb3, 0x02, 0x00, 0xcc},
666 667 668 669
	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x04, 0x0d, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
670 671
	{0xb3, 0x22, 0x03, 0xcc},
	{0xb3, 0x23, 0xc0, 0xcc},
672 673 674 675
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x04, 0xcc},
	{0xb3, 0x17, 0xff, 0xcc},
676 677 678 679 680 681 682
	{0xb3, 0x00, 0x65, 0xcc},
	{0xb8, 0x00, 0x00, 0xcc},
	{0xbc, 0x00, 0x70, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},
	{0xf0, 0x00, 0x02, 0xbb},
	{0xc8, 0x9f, 0x0b, 0xbb},
	{0x5b, 0x00, 0x01, 0xbb},
683
	{0xf0, 0x00, 0x00, 0xbb},
684
	{0x20, 0x03, 0x02, 0xbb},	/* h/v flip */
685
	{0xf0, 0x00, 0x01, 0xbb},
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701
	{0x05, 0x00, 0x07, 0xbb},
	{0x34, 0x00, 0x00, 0xbb},
	{0x35, 0xff, 0x00, 0xbb},
	{0xdc, 0x07, 0x02, 0xbb},
	{0xdd, 0x3c, 0x18, 0xbb},
	{0xde, 0x92, 0x6d, 0xbb},
	{0xdf, 0xcd, 0xb1, 0xbb},
	{0xe0, 0xff, 0xe7, 0xbb},
	{0x06, 0xf0, 0x0d, 0xbb},
	{0x06, 0x70, 0x0e, 0xbb},
	{0x4c, 0x00, 0x01, 0xbb},
	{0x4d, 0x00, 0x01, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x2e, 0x0c, 0x60, 0xbb},
	{0x21, 0xb6, 0x6e, 0xbb},
	{0x37, 0x01, 0x40, 0xbb},
702
	{0xf0, 0x00, 0x00, 0xbb},
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
	{0x07, 0x00, 0x84, 0xbb},
	{0x08, 0x02, 0x4a, 0xbb},
	{0x05, 0x01, 0x10, 0xbb},
	{0x06, 0x00, 0x39, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x58, 0x02, 0x67, 0xbb},
	{0x57, 0x02, 0x00, 0xbb},
	{0x5a, 0x02, 0x67, 0xbb},
	{0x59, 0x02, 0x00, 0xbb},
	{0x5c, 0x12, 0x0d, 0xbb},
	{0x5d, 0x16, 0x11, 0xbb},
	{0x39, 0x06, 0x18, 0xbb},
	{0x3a, 0x06, 0x18, 0xbb},
	{0x3b, 0x06, 0x18, 0xbb},
	{0x3c, 0x06, 0x18, 0xbb},
	{0x64, 0x7b, 0x5b, 0xbb},
719 720 721
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x05, 0xcc},
	{0xb6, 0x02, 0x00, 0xcc},
722 723
	{0xb6, 0x05, 0x03, 0xcc},
	{0xb6, 0x04, 0xc0, 0xcc},
724
	{0xb6, 0x12, 0xf8, 0xcc},
725 726 727
	{0xb6, 0x13, 0x29, 0xcc},
	{0xb6, 0x18, 0x09, 0xcc},
	{0xb6, 0x17, 0x60, 0xcc},
728 729 730 731 732
	{0xb6, 0x16, 0x00, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
733
	{0xbf, 0xcc, 0x00, 0xcc},
734
	{0xb3, 0x01, 0x41, 0xcc},
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 804 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
	{0x00, 0x00, 0x80, 0xdd},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x00, 0x00, 0x10, 0xdd},
	{0x22, 0xa0, 0x78, 0xbb},
	{0x23, 0xa0, 0x78, 0xbb},
	{0x24, 0x7f, 0x00, 0xbb},
	{0x28, 0xea, 0x02, 0xbb},
	{0x29, 0x86, 0x7a, 0xbb},
	{0x5e, 0x52, 0x4c, 0xbb},
	{0x5f, 0x20, 0x24, 0xbb},
	{0x60, 0x00, 0x02, 0xbb},
	{0x02, 0x00, 0xee, 0xbb},
	{0x03, 0x39, 0x23, 0xbb},
	{0x04, 0x07, 0x24, 0xbb},
	{0x09, 0x00, 0xc0, 0xbb},
	{0x0a, 0x00, 0x79, 0xbb},
	{0x0b, 0x00, 0x04, 0xbb},
	{0x0c, 0x00, 0x5c, 0xbb},
	{0x0d, 0x00, 0xd9, 0xbb},
	{0x0e, 0x00, 0x53, 0xbb},
	{0x0f, 0x00, 0x21, 0xbb},
	{0x10, 0x00, 0xa4, 0xbb},
	{0x11, 0x00, 0xe5, 0xbb},
	{0x15, 0x00, 0x00, 0xbb},
	{0x16, 0x00, 0x00, 0xbb},
	{0x17, 0x00, 0x00, 0xbb},
	{0x18, 0x00, 0x00, 0xbb},
	{0x19, 0x00, 0x00, 0xbb},
	{0x1a, 0x00, 0x00, 0xbb},
	{0x1b, 0x00, 0x00, 0xbb},
	{0x1c, 0x00, 0x00, 0xbb},
	{0x1d, 0x00, 0x00, 0xbb},
	{0x1e, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x00, 0x00, 0x20, 0xdd},
	{0x06, 0xf0, 0x8e, 0xbb},
	{0x00, 0x00, 0x80, 0xdd},
	{0x06, 0x70, 0x8e, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x00, 0x00, 0x20, 0xdd},
	{0x5e, 0x6a, 0x53, 0xbb},
	{0x5f, 0x40, 0x2c, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x00, 0x00, 0x20, 0xdd},
	{0x58, 0x00, 0x00, 0xbb},
	{0x53, 0x09, 0x03, 0xbb},
	{0x54, 0x31, 0x18, 0xbb},
	{0x55, 0x8b, 0x5f, 0xbb},
	{0x56, 0xc0, 0xa9, 0xbb},
	{0x57, 0xe0, 0xd2, 0xbb},
	{0xe1, 0x00, 0x00, 0xbb},
	{0xdc, 0x09, 0x03, 0xbb},
	{0xdd, 0x31, 0x18, 0xbb},
	{0xde, 0x8b, 0x5f, 0xbb},
	{0xdf, 0xc0, 0xa9, 0xbb},
	{0xe0, 0xe0, 0xd2, 0xbb},
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x06, 0xf0, 0x8e, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x2f, 0xde, 0x20, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x24, 0x50, 0x20, 0xbb},
	{0xbc, 0x0e, 0x00, 0xcc},
	{0xbc, 0x0f, 0x05, 0xcc},
	{0xbc, 0x10, 0xc0, 0xcc},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x34, 0x0c, 0x50, 0xbb},
	{0xbc, 0x11, 0x03, 0xcc},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x80, 0x00, 0x03, 0xbb},
	{0x81, 0xc7, 0x14, 0xbb},
	{0x82, 0xeb, 0xe8, 0xbb},
	{0x83, 0xfe, 0xf4, 0xbb},
	{0x84, 0xcd, 0x10, 0xbb},
	{0x85, 0xf3, 0xee, 0xbb},
	{0x86, 0xff, 0xf1, 0xbb},
	{0x87, 0xcd, 0x10, 0xbb},
	{0x88, 0xf3, 0xee, 0xbb},
	{0x89, 0x01, 0xf1, 0xbb},
	{0x8a, 0xe5, 0x17, 0xbb},
	{0x8b, 0xe8, 0xe2, 0xbb},
	{0x8c, 0xf7, 0xed, 0xbb},
	{0x8d, 0x00, 0xff, 0xbb},
	{0x8e, 0xec, 0x10, 0xbb},
	{0x8f, 0xf0, 0xed, 0xbb},
	{0x90, 0xf9, 0xf2, 0xbb},
	{0x91, 0x00, 0x00, 0xbb},
	{0x92, 0xe9, 0x0d, 0xbb},
	{0x93, 0xf4, 0xf2, 0xbb},
	{0x94, 0xfb, 0xf5, 0xbb},
	{0x95, 0x00, 0xff, 0xbb},
	{0xb6, 0x0f, 0x08, 0xbb},
	{0xb7, 0x3d, 0x16, 0xbb},
	{0xb8, 0x0c, 0x04, 0xbb},
	{0xb9, 0x1c, 0x07, 0xbb},
	{0xba, 0x0a, 0x03, 0xbb},
	{0xbb, 0x1b, 0x09, 0xbb},
	{0xbc, 0x17, 0x0d, 0xbb},
	{0xbd, 0x23, 0x1d, 0xbb},
	{0xbe, 0x00, 0x28, 0xbb},
	{0xbf, 0x11, 0x09, 0xbb},
	{0xc0, 0x16, 0x15, 0xbb},
	{0xc1, 0x00, 0x1b, 0xbb},
	{0xc2, 0x0e, 0x07, 0xbb},
	{0xc3, 0x14, 0x10, 0xbb},
	{0xc4, 0x00, 0x17, 0xbb},
	{0x06, 0x74, 0x8e, 0xbb},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x03, 0x03, 0xc0, 0xbb},
845 846
	{}
};
847

848
static const u8 mi1320_gamma[17] = {
849 850 851
	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
852
static const u8 mi1320_matrix[9] = {
853 854
	0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
};
855
static const u8 mi1320_initVGA_data[][4] = {
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 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
	{0xb3, 0x01, 0x01, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
	{0xb0, 0x03, 0x19, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
	{0xb0, 0x04, 0x02, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
	{0xb3, 0x00, 0x64, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
	{0xb0, 0x16, 0x03, 0xcc},	{0xb3, 0x05, 0x00, 0xcc},
	{0xb3, 0x06, 0x00, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xc8, 0xcc},	{0xb3, 0x02, 0x00, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x03, 0xcc},	{0xb3, 0x23, 0xc0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x04, 0xcc},	{0xb3, 0x17, 0xff, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},	{0xbc, 0x00, 0xd0, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},	{0xf0, 0x00, 0x00, 0xbb},
	{0x0d, 0x00, 0x09, 0xbb},	{0x00, 0x01, 0x00, 0xdd},
	{0x0d, 0x00, 0x08, 0xbb},	{0xf0, 0x00, 0x01, 0xbb},
	{0xa1, 0x05, 0x00, 0xbb},	{0xa4, 0x03, 0xc0, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
	{0xc8, 0x9f, 0x0b, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
	{0xf0, 0x00, 0x00, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
	{0x20, 0x01, 0x00, 0xbb},	{0x00, 0x00, 0x10, 0xdd},
	{0xf0, 0x00, 0x01, 0xbb},	{0x9d, 0x3c, 0xa0, 0xbb},
	{0x47, 0x30, 0x30, 0xbb},	{0xf0, 0x00, 0x00, 0xbb},
	{0x0a, 0x80, 0x11, 0xbb},	{0x35, 0x00, 0x22, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x9d, 0xc5, 0x05, 0xbb},
	{0xdc, 0x0f, 0xfc, 0xbb},	{0xf0, 0x00, 0x01, 0xbb},
	{0x06, 0x74, 0x0e, 0xbb},	{0x80, 0x00, 0x06, 0xbb},
	{0x81, 0x04, 0x00, 0xbb},	{0x82, 0x01, 0x02, 0xbb},
	{0x83, 0x03, 0x02, 0xbb},	{0x84, 0x05, 0x00, 0xbb},
	{0x85, 0x01, 0x00, 0xbb},	{0x86, 0x03, 0x02, 0xbb},
	{0x87, 0x05, 0x00, 0xbb},	{0x88, 0x01, 0x00, 0xbb},
	{0x89, 0x02, 0x02, 0xbb},	{0x8a, 0xfd, 0x04, 0xbb},
	{0x8b, 0xfc, 0xfd, 0xbb},	{0x8c, 0xff, 0xfd, 0xbb},
	{0x8d, 0x00, 0x00, 0xbb},	{0x8e, 0xfe, 0x05, 0xbb},
	{0x8f, 0xfc, 0xfd, 0xbb},	{0x90, 0xfe, 0xfd, 0xbb},
	{0x91, 0x00, 0x00, 0xbb},	{0x92, 0xfe, 0x03, 0xbb},
	{0x93, 0xfd, 0xfe, 0xbb},	{0x94, 0xff, 0xfd, 0xbb},
	{0x95, 0x00, 0x00, 0xbb},	{0xb6, 0x07, 0x05, 0xbb},
	{0xb7, 0x13, 0x06, 0xbb},	{0xb8, 0x08, 0x06, 0xbb},
	{0xb9, 0x14, 0x08, 0xbb},	{0xba, 0x06, 0x05, 0xbb},
	{0xbb, 0x13, 0x06, 0xbb},	{0xbc, 0x03, 0x01, 0xbb},
	{0xbd, 0x03, 0x04, 0xbb},	{0xbe, 0x00, 0x02, 0xbb},
	{0xbf, 0x03, 0x01, 0xbb},	{0xc0, 0x02, 0x04, 0xbb},
	{0xc1, 0x00, 0x04, 0xbb},	{0xc2, 0x02, 0x01, 0xbb},
	{0xc3, 0x01, 0x03, 0xbb},	{0xc4, 0x00, 0x04, 0xbb},
	{0xf0, 0x00, 0x00, 0xbb},	{0x05, 0x01, 0x13, 0xbb},
	{0x06, 0x00, 0x11, 0xbb},	{0x07, 0x00, 0x85, 0xbb},
	{0x08, 0x00, 0x27, 0xbb},	{0x20, 0x01, 0x03, 0xbb},
	{0x21, 0x80, 0x00, 0xbb},	{0x22, 0x0d, 0x0f, 0xbb},
	{0x24, 0x80, 0x00, 0xbb},	{0x59, 0x00, 0xff, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x39, 0x03, 0x0d, 0xbb},
	{0x3a, 0x06, 0x1b, 0xbb},	{0x3b, 0x00, 0x95, 0xbb},
	{0x3c, 0x04, 0xdb, 0xbb},	{0x57, 0x02, 0x00, 0xbb},
	{0x58, 0x02, 0x66, 0xbb},	{0x59, 0x00, 0xff, 0xbb},
	{0x5a, 0x01, 0x33, 0xbb},	{0x5c, 0x12, 0x0d, 0xbb},
	{0x5d, 0x16, 0x11, 0xbb},	{0x64, 0x5e, 0x1c, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x2f, 0xd1, 0x00, 0xbb},
	{0x5b, 0x00, 0x01, 0xbb},	{0xf0, 0x00, 0x02, 0xbb},
	{0x36, 0x68, 0x10, 0xbb},	{0x00, 0x00, 0x30, 0xdd},
	{0x37, 0x82, 0x00, 0xbb},	{0xbc, 0x0e, 0x00, 0xcc},
	{0xbc, 0x0f, 0x05, 0xcc},	{0xbc, 0x10, 0xc0, 0xcc},
	{0xbc, 0x11, 0x03, 0xcc},	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x05, 0xcc},	{0xb6, 0x02, 0x00, 0xcc},
	{0xb6, 0x05, 0x04, 0xcc},	{0xb6, 0x04, 0x00, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},	{0xb6, 0x13, 0x29, 0xcc},
	{0xb6, 0x18, 0x0a, 0xcc},	{0xb6, 0x17, 0x00, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},	{0xbf, 0xc0, 0x26, 0xcc},
	{0xbf, 0xc1, 0x02, 0xcc},	{0xbf, 0xcc, 0x04, 0xcc},
	{0xbc, 0x02, 0x18, 0xcc},	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},	{0xbc, 0x0a, 0x10, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},	{0xbc, 0x0c, 0x00, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},	{0xb3, 0x01, 0x41, 0xcc},
	{}
};
934
static const u8 mi1320_initQVGA_data[][4] = {
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 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002
	{0xb3, 0x01, 0x01, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
	{0xb0, 0x03, 0x19, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
	{0xb0, 0x04, 0x02, 0xcc},	{0x00, 0x00, 0x33, 0xdd},
	{0xb3, 0x00, 0x64, 0xcc},	{0xb3, 0x00, 0x65, 0xcc},
	{0xb0, 0x16, 0x03, 0xcc},	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xc8, 0xcc},	{0xb3, 0x02, 0x00, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x01, 0xcc},	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x00, 0x65, 0xcc},	{0xb8, 0x00, 0x00, 0xcc},
	{0xbc, 0x00, 0xd0, 0xcc},	{0xbc, 0x01, 0x01, 0xcc},
	{0xf0, 0x00, 0x00, 0xbb},	{0x0d, 0x00, 0x09, 0xbb},
	{0x00, 0x01, 0x00, 0xdd},	{0x0d, 0x00, 0x08, 0xbb},
	{0xf0, 0x00, 0x00, 0xbb},	{0x02, 0x00, 0x64, 0xbb},
	{0x05, 0x01, 0x78, 0xbb},	{0x06, 0x00, 0x11, 0xbb},
	{0x07, 0x01, 0x42, 0xbb},	{0x08, 0x00, 0x11, 0xbb},
	{0x20, 0x01, 0x00, 0xbb},	{0x21, 0x80, 0x00, 0xbb},
	{0x22, 0x0d, 0x0f, 0xbb},	{0x24, 0x80, 0x00, 0xbb},
	{0x59, 0x00, 0xff, 0xbb},	{0xf0, 0x00, 0x01, 0xbb},
	{0x9d, 0x3c, 0xa0, 0xbb},	{0x47, 0x30, 0x30, 0xbb},
	{0xf0, 0x00, 0x00, 0xbb},	{0x0a, 0x80, 0x11, 0xbb},
	{0x35, 0x00, 0x22, 0xbb},	{0xf0, 0x00, 0x02, 0xbb},
	{0x9d, 0xc5, 0x05, 0xbb},	{0xdc, 0x0f, 0xfc, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},	{0x06, 0x74, 0x0e, 0xbb},
	{0x80, 0x00, 0x06, 0xbb},	{0x81, 0x04, 0x00, 0xbb},
	{0x82, 0x01, 0x02, 0xbb},	{0x83, 0x03, 0x02, 0xbb},
	{0x84, 0x05, 0x00, 0xbb},	{0x85, 0x01, 0x00, 0xbb},
	{0x86, 0x03, 0x02, 0xbb},	{0x87, 0x05, 0x00, 0xbb},
	{0x88, 0x01, 0x00, 0xbb},	{0x89, 0x02, 0x02, 0xbb},
	{0x8a, 0xfd, 0x04, 0xbb},	{0x8b, 0xfc, 0xfd, 0xbb},
	{0x8c, 0xff, 0xfd, 0xbb},	{0x8d, 0x00, 0x00, 0xbb},
	{0x8e, 0xfe, 0x05, 0xbb},	{0x8f, 0xfc, 0xfd, 0xbb},
	{0x90, 0xfe, 0xfd, 0xbb},	{0x91, 0x00, 0x00, 0xbb},
	{0x92, 0xfe, 0x03, 0xbb},	{0x93, 0xfd, 0xfe, 0xbb},
	{0x94, 0xff, 0xfd, 0xbb},	{0x95, 0x00, 0x00, 0xbb},
	{0xb6, 0x07, 0x05, 0xbb},	{0xb7, 0x13, 0x06, 0xbb},
	{0xb8, 0x08, 0x06, 0xbb},	{0xb9, 0x14, 0x08, 0xbb},
	{0xba, 0x06, 0x05, 0xbb},	{0xbb, 0x13, 0x06, 0xbb},
	{0xbc, 0x03, 0x01, 0xbb},	{0xbd, 0x03, 0x04, 0xbb},
	{0xbe, 0x00, 0x02, 0xbb},	{0xbf, 0x03, 0x01, 0xbb},
	{0xc0, 0x02, 0x04, 0xbb},	{0xc1, 0x00, 0x04, 0xbb},
	{0xc2, 0x02, 0x01, 0xbb},	{0xc3, 0x01, 0x03, 0xbb},
	{0xc4, 0x00, 0x04, 0xbb},	{0xf0, 0x00, 0x02, 0xbb},
	{0xc8, 0x00, 0x00, 0xbb},	{0x2e, 0x00, 0x00, 0xbb},
	{0x2e, 0x0c, 0x5b, 0xbb},	{0x2f, 0xd1, 0x00, 0xbb},
	{0x39, 0x03, 0xca, 0xbb},	{0x3a, 0x06, 0x80, 0xbb},
	{0x3b, 0x01, 0x52, 0xbb},	{0x3c, 0x05, 0x40, 0xbb},
	{0x57, 0x01, 0x9c, 0xbb},	{0x58, 0x01, 0xee, 0xbb},
	{0x59, 0x00, 0xf0, 0xbb},	{0x5a, 0x01, 0x20, 0xbb},
	{0x5c, 0x1d, 0x17, 0xbb},	{0x5d, 0x22, 0x1c, 0xbb},
	{0x64, 0x1e, 0x1c, 0xbb},	{0x5b, 0x00, 0x01, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},	{0x36, 0x68, 0x10, 0xbb},
	{0x00, 0x00, 0x30, 0xdd},	{0x37, 0x81, 0x00, 0xbb},
	{0xbc, 0x02, 0x18, 0xcc},	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},	{0xbc, 0x0a, 0x10, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},	{0xbc, 0x0c, 0x00, 0xcc},
	{0xbf, 0xc0, 0x26, 0xcc},	{0xbf, 0xc1, 0x02, 0xcc},
	{0xbf, 0xcc, 0x04, 0xcc},	{0xb3, 0x5c, 0x01, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{}
};

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 1035 1036 1037 1038 1039 1040
static const u8 mi1320_soc_InitVGA[][4] = {
	{0xb3, 0x01, 0x01, 0xcc},
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
	{0x00, 0x00, 0x30, 0xdd},
	{0xb3, 0x00, 0x64, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xc8, 0xcc},
	{0xb3, 0x02, 0x00, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},
	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb8, 0x00, 0x00, 0xcc},
	{0xbc, 0x00, 0x71, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x00, 0x00, 0x10, 0xdd},
	{0xc8, 0x00, 0x00, 0xbb},
	{0x00, 0x00, 0x30, 0xdd},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x00, 0x00, 0x10, 0xdd},
	{0x07, 0x00, 0xe0, 0xbb},
	{0x08, 0x00, 0x0b, 0xbb},
	{0x21, 0x00, 0x0c, 0xbb},
1041
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1042 1043 1044 1045 1046 1047 1048 1049 1050
	{0xbf, 0xc0, 0x26, 0xcc},
	{0xbf, 0xc1, 0x02, 0xcc},
	{0xbf, 0xcc, 0x04, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x05, 0x01, 0x78, 0xbb},
	{0x06, 0x00, 0x11, 0xbb},
	{0x07, 0x01, 0x42, 0xbb},
	{0x08, 0x00, 0x11, 0xbb},
1051
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 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
	{0x21, 0x80, 0x00, 0xbb},
	{0x22, 0x0d, 0x0f, 0xbb},
	{0x24, 0x80, 0x00, 0xbb},
	{0x59, 0x00, 0xff, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x39, 0x03, 0xca, 0xbb},
	{0x3a, 0x06, 0x80, 0xbb},
	{0x3b, 0x01, 0x52, 0xbb},
	{0x3c, 0x05, 0x40, 0xbb},
	{0x57, 0x01, 0x9c, 0xbb},
	{0x58, 0x01, 0xee, 0xbb},
	{0x59, 0x00, 0xf0, 0xbb},
	{0x5a, 0x01, 0x20, 0xbb},
	{0x5c, 0x1d, 0x17, 0xbb},
	{0x5d, 0x22, 0x1c, 0xbb},
	{0x64, 0x1e, 0x1c, 0xbb},
	{0x5b, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x22, 0xa0, 0x78, 0xbb},
	{0x23, 0xa0, 0x78, 0xbb},
	{0x24, 0x7f, 0x00, 0xbb},
	{0x28, 0xea, 0x02, 0xbb},
	{0x29, 0x86, 0x7a, 0xbb},
	{0x5e, 0x52, 0x4c, 0xbb},
	{0x5f, 0x20, 0x24, 0xbb},
	{0x60, 0x00, 0x02, 0xbb},
	{0x02, 0x00, 0xee, 0xbb},
	{0x03, 0x39, 0x23, 0xbb},
	{0x04, 0x07, 0x24, 0xbb},
	{0x09, 0x00, 0xc0, 0xbb},
	{0x0a, 0x00, 0x79, 0xbb},
	{0x0b, 0x00, 0x04, 0xbb},
	{0x0c, 0x00, 0x5c, 0xbb},
	{0x0d, 0x00, 0xd9, 0xbb},
	{0x0e, 0x00, 0x53, 0xbb},
	{0x0f, 0x00, 0x21, 0xbb},
	{0x10, 0x00, 0xa4, 0xbb},
	{0x11, 0x00, 0xe5, 0xbb},
	{0x15, 0x00, 0x00, 0xbb},
	{0x16, 0x00, 0x00, 0xbb},
	{0x17, 0x00, 0x00, 0xbb},
	{0x18, 0x00, 0x00, 0xbb},
	{0x19, 0x00, 0x00, 0xbb},
	{0x1a, 0x00, 0x00, 0xbb},
	{0x1b, 0x00, 0x00, 0xbb},
	{0x1c, 0x00, 0x00, 0xbb},
	{0x1d, 0x00, 0x00, 0xbb},
	{0x1e, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x06, 0xe0, 0x0e, 0xbb},
	{0x06, 0x60, 0x0e, 0xbb},
	{0xb3, 0x5c, 0x01, 0xcc},
	{}
};
static const u8 mi1320_soc_InitQVGA[][4] = {
	{0xb3, 0x01, 0x01, 0xcc},
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
	{0x00, 0x00, 0x30, 0xdd},
	{0xb3, 0x00, 0x64, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xc8, 0xcc},
	{0xb3, 0x02, 0x00, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},
	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb8, 0x00, 0x00, 0xcc},
	{0xbc, 0x00, 0xd1, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x00, 0x00, 0x10, 0xdd},
	{0xc8, 0x00, 0x00, 0xbb},
	{0x00, 0x00, 0x30, 0xdd},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x00, 0x00, 0x10, 0xdd},
	{0x07, 0x00, 0xe0, 0xbb},
	{0x08, 0x00, 0x0b, 0xbb},
	{0x21, 0x00, 0x0c, 0xbb},
1144
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
	{0xbf, 0xc0, 0x26, 0xcc},
	{0xbf, 0xc1, 0x02, 0xcc},
	{0xbf, 0xcc, 0x04, 0xcc},
	{0xbc, 0x02, 0x18, 0xcc},
	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},
	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},
	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},
	{0xbc, 0x0a, 0x10, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},
	{0xbc, 0x0c, 0x00, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x05, 0x01, 0x78, 0xbb},
	{0x06, 0x00, 0x11, 0xbb},
	{0x07, 0x01, 0x42, 0xbb},
	{0x08, 0x00, 0x11, 0xbb},
1164
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
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 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
	{0x21, 0x80, 0x00, 0xbb},
	{0x22, 0x0d, 0x0f, 0xbb},
	{0x24, 0x80, 0x00, 0xbb},
	{0x59, 0x00, 0xff, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x39, 0x03, 0xca, 0xbb},
	{0x3a, 0x06, 0x80, 0xbb},
	{0x3b, 0x01, 0x52, 0xbb},
	{0x3c, 0x05, 0x40, 0xbb},
	{0x57, 0x01, 0x9c, 0xbb},
	{0x58, 0x01, 0xee, 0xbb},
	{0x59, 0x00, 0xf0, 0xbb},
	{0x5a, 0x01, 0x20, 0xbb},
	{0x5c, 0x1d, 0x17, 0xbb},
	{0x5d, 0x22, 0x1c, 0xbb},
	{0x64, 0x1e, 0x1c, 0xbb},
	{0x5b, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x22, 0xa0, 0x78, 0xbb},
	{0x23, 0xa0, 0x78, 0xbb},
	{0x24, 0x7f, 0x00, 0xbb},
	{0x28, 0xea, 0x02, 0xbb},
	{0x29, 0x86, 0x7a, 0xbb},
	{0x5e, 0x52, 0x4c, 0xbb},
	{0x5f, 0x20, 0x24, 0xbb},
	{0x60, 0x00, 0x02, 0xbb},
	{0x02, 0x00, 0xee, 0xbb},
	{0x03, 0x39, 0x23, 0xbb},
	{0x04, 0x07, 0x24, 0xbb},
	{0x09, 0x00, 0xc0, 0xbb},
	{0x0a, 0x00, 0x79, 0xbb},
	{0x0b, 0x00, 0x04, 0xbb},
	{0x0c, 0x00, 0x5c, 0xbb},
	{0x0d, 0x00, 0xd9, 0xbb},
	{0x0e, 0x00, 0x53, 0xbb},
	{0x0f, 0x00, 0x21, 0xbb},
	{0x10, 0x00, 0xa4, 0xbb},
	{0x11, 0x00, 0xe5, 0xbb},
	{0x15, 0x00, 0x00, 0xbb},
	{0x16, 0x00, 0x00, 0xbb},
	{0x17, 0x00, 0x00, 0xbb},
	{0x18, 0x00, 0x00, 0xbb},
	{0x19, 0x00, 0x00, 0xbb},
	{0x1a, 0x00, 0x00, 0xbb},
	{0x1b, 0x00, 0x00, 0xbb},
	{0x1c, 0x00, 0x00, 0xbb},
	{0x1d, 0x00, 0x00, 0xbb},
	{0x1e, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x06, 0xe0, 0x0e, 0xbb},
	{0x06, 0x60, 0x0e, 0xbb},
	{0xb3, 0x5c, 0x01, 0xcc},
	{}
};
static const u8 mi1320_soc_InitSXGA[][4] = {
	{0xb3, 0x01, 0x01, 0xcc},
	{0xb0, 0x03, 0x19, 0xcc},
	{0x00, 0x00, 0x30, 0xdd},
	{0xb3, 0x00, 0x64, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x34, 0x02, 0xcc},
	{0xb3, 0x35, 0xc8, 0xcc},
	{0xb3, 0x02, 0x00, 0xcc},
	{0xb3, 0x03, 0x0a, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x04, 0xcc},
	{0xb3, 0x23, 0x00, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x04, 0xcc},
	{0xb3, 0x17, 0xff, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xbc, 0x00, 0x71, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x00, 0x00, 0x30, 0xdd},
	{0xc8, 0x9f, 0x0b, 0xbb},
	{0x00, 0x00, 0x20, 0xdd},
	{0x5b, 0x00, 0x01, 0xbb},
	{0x00, 0x00, 0x20, 0xdd},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x00, 0x00, 0x30, 0xdd},
1254
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
	{0x00, 0x00, 0x20, 0xdd},
	{0xbf, 0xc0, 0x26, 0xcc},
	{0xbf, 0xc1, 0x02, 0xcc},
	{0xbf, 0xcc, 0x04, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x05, 0x01, 0x78, 0xbb},
	{0x06, 0x00, 0x11, 0xbb},
	{0x07, 0x01, 0x42, 0xbb},
	{0x08, 0x00, 0x11, 0xbb},
1265
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
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 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
	{0x21, 0x80, 0x00, 0xbb},
	{0x22, 0x0d, 0x0f, 0xbb},
	{0x24, 0x80, 0x00, 0xbb},
	{0x59, 0x00, 0xff, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x39, 0x03, 0xca, 0xbb},
	{0x3a, 0x06, 0x80, 0xbb},
	{0x3b, 0x01, 0x52, 0xbb},
	{0x3c, 0x05, 0x40, 0xbb},
	{0x57, 0x01, 0x9c, 0xbb},
	{0x58, 0x01, 0xee, 0xbb},
	{0x59, 0x00, 0xf0, 0xbb},
	{0x5a, 0x01, 0x20, 0xbb},
	{0x5c, 0x1d, 0x17, 0xbb},
	{0x5d, 0x22, 0x1c, 0xbb},
	{0x64, 0x1e, 0x1c, 0xbb},
	{0x5b, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x22, 0xa0, 0x78, 0xbb},
	{0x23, 0xa0, 0x78, 0xbb},
	{0x24, 0x7f, 0x00, 0xbb},
	{0x28, 0xea, 0x02, 0xbb},
	{0x29, 0x86, 0x7a, 0xbb},
	{0x5e, 0x52, 0x4c, 0xbb},
	{0x5f, 0x20, 0x24, 0xbb},
	{0x60, 0x00, 0x02, 0xbb},
	{0x02, 0x00, 0xee, 0xbb},
	{0x03, 0x39, 0x23, 0xbb},
	{0x04, 0x07, 0x24, 0xbb},
	{0x09, 0x00, 0xc0, 0xbb},
	{0x0a, 0x00, 0x79, 0xbb},
	{0x0b, 0x00, 0x04, 0xbb},
	{0x0c, 0x00, 0x5c, 0xbb},
	{0x0d, 0x00, 0xd9, 0xbb},
	{0x0e, 0x00, 0x53, 0xbb},
	{0x0f, 0x00, 0x21, 0xbb},
	{0x10, 0x00, 0xa4, 0xbb},
	{0x11, 0x00, 0xe5, 0xbb},
	{0x15, 0x00, 0x00, 0xbb},
	{0x16, 0x00, 0x00, 0xbb},
	{0x17, 0x00, 0x00, 0xbb},
	{0x18, 0x00, 0x00, 0xbb},
	{0x19, 0x00, 0x00, 0xbb},
	{0x1a, 0x00, 0x00, 0xbb},
	{0x1b, 0x00, 0x00, 0xbb},
	{0x1c, 0x00, 0x00, 0xbb},
	{0x1d, 0x00, 0x00, 0xbb},
	{0x1e, 0x00, 0x00, 0xbb},
	{0xf0, 0x00, 0x01, 0xbb},
	{0x06, 0xe0, 0x0e, 0xbb},
	{0x06, 0x60, 0x0e, 0xbb},
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xf0, 0x00, 0x00, 0xbb},
	{0x05, 0x01, 0x13, 0xbb},
	{0x06, 0x00, 0x11, 0xbb},
	{0x07, 0x00, 0x85, 0xbb},
	{0x08, 0x00, 0x27, 0xbb},
1323
	{0x20, 0x01, 0x03, 0xbb},	/* h/v flip */
1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341
	{0x21, 0x80, 0x00, 0xbb},
	{0x22, 0x0d, 0x0f, 0xbb},
	{0x24, 0x80, 0x00, 0xbb},
	{0x59, 0x00, 0xff, 0xbb},
	{0xf0, 0x00, 0x02, 0xbb},
	{0x39, 0x03, 0x0d, 0xbb},
	{0x3a, 0x06, 0x1b, 0xbb},
	{0x3b, 0x00, 0x95, 0xbb},
	{0x3c, 0x04, 0xdb, 0xbb},
	{0x57, 0x02, 0x00, 0xbb},
	{0x58, 0x02, 0x66, 0xbb},
	{0x59, 0x00, 0xff, 0xbb},
	{0x5a, 0x01, 0x33, 0xbb},
	{0x5c, 0x12, 0x0d, 0xbb},
	{0x5d, 0x16, 0x11, 0xbb},
	{0x64, 0x5e, 0x1c, 0xbb},
	{}
};
1342
static const u8 po3130_gamma[17] = {
1343 1344 1345
	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
1346
static const u8 po3130_matrix[9] = {
1347 1348 1349
	0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
};

1350
static const u8 po3130_initVGA_data[][4] = {
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 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432
	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
	{0x00, 0x00, 0x50, 0xdd},	{0xb0, 0x03, 0x01, 0xcc},
	{0xb3, 0x00, 0x04, 0xcc},	{0xb3, 0x00, 0x24, 0xcc},
	{0xb3, 0x00, 0x25, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x05, 0x00, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},	{0xb3, 0x03, 0x1a, 0xcc},
	{0xb3, 0x04, 0x15, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe8, 0xcc},	{0xb8, 0x08, 0xe8, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x34, 0x01, 0xcc},	{0xb3, 0x35, 0xf6, 0xcc},
	{0xb3, 0x00, 0x27, 0xcc},	{0xbc, 0x00, 0x71, 0xcc},
	{0xb8, 0x00, 0x21, 0xcc},	{0xb8, 0x27, 0x20, 0xcc},
	{0xb8, 0x01, 0x79, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
	{0xb8, 0x2c, 0x50, 0xcc},	{0xb8, 0x2d, 0xf8, 0xcc},
	{0xb8, 0x2e, 0xf8, 0xcc},	{0xb8, 0x2f, 0xf8, 0xcc},
	{0xb8, 0x30, 0x50, 0xcc},	{0xb8, 0x31, 0xf8, 0xcc},
	{0xb8, 0x32, 0xf8, 0xcc},	{0xb8, 0x33, 0xf8, 0xcc},
	{0xb8, 0x34, 0x50, 0xcc},	{0xb8, 0x35, 0x00, 0xcc},
	{0xb8, 0x36, 0x00, 0xcc},	{0xb8, 0x37, 0x00, 0xcc},
	{0x00, 0x1e, 0xc6, 0xaa},	{0x00, 0x20, 0x44, 0xaa},
	{0x00, 0xad, 0x02, 0xaa},	{0x00, 0xae, 0x2c, 0xaa},
	{0x00, 0x12, 0x08, 0xaa},	{0x00, 0x17, 0x41, 0xaa},
	{0x00, 0x19, 0x41, 0xaa},	{0x00, 0x1e, 0x06, 0xaa},
	{0x00, 0x21, 0x00, 0xaa},	{0x00, 0x36, 0xc0, 0xaa},
	{0x00, 0x37, 0xc8, 0xaa},	{0x00, 0x3b, 0x36, 0xaa},
	{0x00, 0x4b, 0xfe, 0xaa},	{0x00, 0x51, 0x1c, 0xaa},
	{0x00, 0x52, 0x01, 0xaa},	{0x00, 0x55, 0x0a, 0xaa},
	{0x00, 0x59, 0x02, 0xaa},	{0x00, 0x5a, 0x04, 0xaa},
	{0x00, 0x5c, 0x10, 0xaa},	{0x00, 0x5d, 0x10, 0xaa},
	{0x00, 0x5e, 0x10, 0xaa},	{0x00, 0x5f, 0x10, 0xaa},
	{0x00, 0x61, 0x00, 0xaa},	{0x00, 0x62, 0x18, 0xaa},
	{0x00, 0x63, 0x30, 0xaa},	{0x00, 0x70, 0x68, 0xaa},
	{0x00, 0x80, 0x71, 0xaa},	{0x00, 0x81, 0x08, 0xaa},
	{0x00, 0x82, 0x00, 0xaa},	{0x00, 0x83, 0x55, 0xaa},
	{0x00, 0x84, 0x06, 0xaa},	{0x00, 0x85, 0x06, 0xaa},
	{0x00, 0x86, 0x13, 0xaa},	{0x00, 0x87, 0x18, 0xaa},
	{0x00, 0xaa, 0x3f, 0xaa},	{0x00, 0xab, 0x44, 0xaa},
	{0x00, 0xb0, 0x68, 0xaa},	{0x00, 0xb5, 0x10, 0xaa},
	{0x00, 0xb8, 0x20, 0xaa},	{0x00, 0xb9, 0xa0, 0xaa},
	{0x00, 0xbc, 0x04, 0xaa},	{0x00, 0x8b, 0x40, 0xaa},
	{0x00, 0x8c, 0x91, 0xaa},	{0x00, 0x8d, 0x8f, 0xaa},
	{0x00, 0x8e, 0x91, 0xaa},	{0x00, 0x8f, 0x43, 0xaa},
	{0x00, 0x90, 0x92, 0xaa},	{0x00, 0x91, 0x89, 0xaa},
	{0x00, 0x92, 0x9d, 0xaa},	{0x00, 0x93, 0x46, 0xaa},
	{0x00, 0xd6, 0x22, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
	{0x00, 0x7e, 0xea, 0xaa},	{0x00, 0xd6, 0x62, 0xaa},
	{0x00, 0x73, 0x00, 0xaa},	{0x00, 0x74, 0x10, 0xaa},
	{0x00, 0x75, 0x20, 0xaa},	{0x00, 0x76, 0x2b, 0xaa},
	{0x00, 0x77, 0x36, 0xaa},	{0x00, 0x78, 0x49, 0xaa},
	{0x00, 0x79, 0x5a, 0xaa},	{0x00, 0x7a, 0x7f, 0xaa},
	{0x00, 0x7b, 0x9b, 0xaa},	{0x00, 0x7c, 0xba, 0xaa},
	{0x00, 0x7d, 0xd4, 0xaa},	{0x00, 0x7e, 0xea, 0xaa},
	{0x00, 0xd6, 0xa2, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
	{0x00, 0x7e, 0xea, 0xaa},
	{0x00, 0x4c, 0x07, 0xaa},
	{0x00, 0x4b, 0xe0, 0xaa},	{0x00, 0x4e, 0x77, 0xaa},
	{0x00, 0x59, 0x02, 0xaa},	{0x00, 0x4d, 0x0a, 0xaa},
/*	{0x00, 0xd1, 0x00, 0xaa},	{0x00, 0x20, 0xc4, 0xaa},
	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc}, */
	{0x00, 0xd1, 0x3c, 0xaa},	{0x00, 0x20, 0xc4, 0xaa},
	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc},
	{0xb8, 0xfe, 0x00, 0xcc},	{0xb8, 0xff, 0x28, 0xcc},
	{0xb9, 0x00, 0x28, 0xcc},	{0xb9, 0x01, 0x28, 0xcc},
	{0xb9, 0x02, 0x28, 0xcc},	{0xb9, 0x03, 0x00, 0xcc},
	{0xb9, 0x04, 0x00, 0xcc},	{0xb9, 0x05, 0x3c, 0xcc},
	{0xb9, 0x06, 0x3c, 0xcc},	{0xb9, 0x07, 0x3c, 0xcc},
	{0xb9, 0x08, 0x3c, 0xcc},	{0x00, 0x05, 0x00, 0xaa},
	{0xb3, 0x5c, 0x00, 0xcc},	{0xb3, 0x01, 0x41, 0xcc},
	{}
};
1433
static const u8 po3130_rundata[][4] = {
1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
	{0x00, 0x47, 0x45, 0xaa},	{0x00, 0x48, 0x9b, 0xaa},
	{0x00, 0x49, 0x3a, 0xaa},	{0x00, 0x4a, 0x01, 0xaa},
	{0x00, 0x44, 0x40, 0xaa},
/*	{0x00, 0xd5, 0x7c, 0xaa}, */
	{0x00, 0xad, 0x04, 0xaa},	{0x00, 0xae, 0x00, 0xaa},
	{0x00, 0xb0, 0x78, 0xaa},	{0x00, 0x98, 0x02, 0xaa},
	{0x00, 0x94, 0x25, 0xaa},	{0x00, 0x95, 0x25, 0xaa},
	{0x00, 0x59, 0x68, 0xaa},	{0x00, 0x44, 0x20, 0xaa},
	{0x00, 0x17, 0x50, 0xaa},	{0x00, 0x19, 0x50, 0xaa},
	{0x00, 0xd1, 0x3c, 0xaa},	{0x00, 0xd1, 0x3c, 0xaa},
	{0x00, 0x1e, 0x06, 0xaa},	{0x00, 0x1e, 0x06, 0xaa},
	{}
};

1448
static const u8 po3130_initQVGA_data[][4] = {
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 1533
	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
	{0x00, 0x00, 0x50, 0xdd},	{0xb0, 0x03, 0x09, 0xcc},
	{0xb3, 0x00, 0x04, 0xcc},	{0xb3, 0x00, 0x24, 0xcc},
	{0xb3, 0x00, 0x25, 0xcc},	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},	{0xb3, 0x05, 0x00, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},	{0xb3, 0x03, 0x1a, 0xcc},
	{0xb3, 0x04, 0x15, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},	{0xb8, 0x08, 0xe0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x34, 0x01, 0xcc},	{0xb3, 0x35, 0xf6, 0xcc},
	{0xb3, 0x00, 0x27, 0xcc},	{0xbc, 0x00, 0xd1, 0xcc},
	{0xb8, 0x00, 0x21, 0xcc},	{0xb8, 0x27, 0x20, 0xcc},
	{0xb8, 0x01, 0x79, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
	{0xb8, 0x2c, 0x50, 0xcc},	{0xb8, 0x2d, 0xf8, 0xcc},
	{0xb8, 0x2e, 0xf8, 0xcc},	{0xb8, 0x2f, 0xf8, 0xcc},
	{0xb8, 0x30, 0x50, 0xcc},	{0xb8, 0x31, 0xf8, 0xcc},
	{0xb8, 0x32, 0xf8, 0xcc},	{0xb8, 0x33, 0xf8, 0xcc},
	{0xb8, 0x34, 0x50, 0xcc},	{0xb8, 0x35, 0x00, 0xcc},
	{0xb8, 0x36, 0x00, 0xcc},	{0xb8, 0x37, 0x00, 0xcc},
	{0x00, 0x1e, 0xc6, 0xaa},	{0x00, 0x20, 0x44, 0xaa},
	{0x00, 0xad, 0x02, 0xaa},	{0x00, 0xae, 0x2c, 0xaa},
	{0x00, 0x12, 0x08, 0xaa},	{0x00, 0x17, 0x41, 0xaa},
	{0x00, 0x19, 0x41, 0xaa},	{0x00, 0x1e, 0x06, 0xaa},
	{0x00, 0x21, 0x00, 0xaa},	{0x00, 0x36, 0xc0, 0xaa},
	{0x00, 0x37, 0xc8, 0xaa},	{0x00, 0x3b, 0x36, 0xaa},
	{0x00, 0x4b, 0xfe, 0xaa},	{0x00, 0x51, 0x1c, 0xaa},
	{0x00, 0x52, 0x01, 0xaa},	{0x00, 0x55, 0x0a, 0xaa},
	{0x00, 0x59, 0x6f, 0xaa},	{0x00, 0x5a, 0x04, 0xaa},
	{0x00, 0x5c, 0x10, 0xaa},	{0x00, 0x5d, 0x10, 0xaa},
	{0x00, 0x5e, 0x10, 0xaa},	{0x00, 0x5f, 0x10, 0xaa},
	{0x00, 0x61, 0x00, 0xaa},	{0x00, 0x62, 0x18, 0xaa},
	{0x00, 0x63, 0x30, 0xaa},	{0x00, 0x70, 0x68, 0xaa},
	{0x00, 0x80, 0x71, 0xaa},	{0x00, 0x81, 0x08, 0xaa},
	{0x00, 0x82, 0x00, 0xaa},	{0x00, 0x83, 0x55, 0xaa},
	{0x00, 0x84, 0x06, 0xaa},	{0x00, 0x85, 0x06, 0xaa},
	{0x00, 0x86, 0x13, 0xaa},	{0x00, 0x87, 0x18, 0xaa},
	{0x00, 0xaa, 0x3f, 0xaa},	{0x00, 0xab, 0x44, 0xaa},
	{0x00, 0xb0, 0x68, 0xaa},	{0x00, 0xb5, 0x10, 0xaa},
	{0x00, 0xb8, 0x20, 0xaa},	{0x00, 0xb9, 0xa0, 0xaa},
	{0x00, 0xbc, 0x04, 0xaa},	{0x00, 0x8b, 0x40, 0xaa},
	{0x00, 0x8c, 0x91, 0xaa},	{0x00, 0x8d, 0x8f, 0xaa},
	{0x00, 0x8e, 0x91, 0xaa},	{0x00, 0x8f, 0x43, 0xaa},
	{0x00, 0x90, 0x92, 0xaa},	{0x00, 0x91, 0x89, 0xaa},
	{0x00, 0x92, 0x9d, 0xaa},	{0x00, 0x93, 0x46, 0xaa},
	{0x00, 0xd6, 0x22, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
	{0x00, 0x7e, 0xea, 0xaa},	{0x00, 0xd6, 0x62, 0xaa},
	{0x00, 0x73, 0x00, 0xaa},	{0x00, 0x74, 0x10, 0xaa},
	{0x00, 0x75, 0x20, 0xaa},	{0x00, 0x76, 0x2b, 0xaa},
	{0x00, 0x77, 0x36, 0xaa},	{0x00, 0x78, 0x49, 0xaa},
	{0x00, 0x79, 0x5a, 0xaa},	{0x00, 0x7a, 0x7f, 0xaa},
	{0x00, 0x7b, 0x9b, 0xaa},	{0x00, 0x7c, 0xba, 0xaa},
	{0x00, 0x7d, 0xd4, 0xaa},	{0x00, 0x7e, 0xea, 0xaa},
	{0x00, 0xd6, 0xa2, 0xaa},	{0x00, 0x73, 0x00, 0xaa},
	{0x00, 0x74, 0x10, 0xaa},	{0x00, 0x75, 0x20, 0xaa},
	{0x00, 0x76, 0x2b, 0xaa},	{0x00, 0x77, 0x36, 0xaa},
	{0x00, 0x78, 0x49, 0xaa},	{0x00, 0x79, 0x5a, 0xaa},
	{0x00, 0x7a, 0x7f, 0xaa},	{0x00, 0x7b, 0x9b, 0xaa},
	{0x00, 0x7c, 0xba, 0xaa},	{0x00, 0x7d, 0xd4, 0xaa},
	{0x00, 0x7e, 0xea, 0xaa},	{0x00, 0x4c, 0x07, 0xaa},
	{0x00, 0x4b, 0xe0, 0xaa},	{0x00, 0x4e, 0x77, 0xaa},
	{0x00, 0x59, 0x66, 0xaa},	{0x00, 0x4d, 0x0a, 0xaa},
	{0x00, 0xd1, 0x00, 0xaa},	{0x00, 0x20, 0xc4, 0xaa},
	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc},
	{0xb8, 0xfe, 0x00, 0xcc},	{0xb8, 0xff, 0x28, 0xcc},
	{0xb9, 0x00, 0x28, 0xcc},	{0xb9, 0x01, 0x28, 0xcc},
	{0xb9, 0x02, 0x28, 0xcc},	{0xb9, 0x03, 0x00, 0xcc},
	{0xb9, 0x04, 0x00, 0xcc},	{0xb9, 0x05, 0x3c, 0xcc},
	{0xb9, 0x06, 0x3c, 0xcc},	{0xb9, 0x07, 0x3c, 0xcc},
	{0xb9, 0x08, 0x3c, 0xcc},	{0xbc, 0x02, 0x18, 0xcc},
	{0xbc, 0x03, 0x50, 0xcc},	{0xbc, 0x04, 0x18, 0xcc},
	{0xbc, 0x05, 0x00, 0xcc},	{0xbc, 0x06, 0x00, 0xcc},
	{0xbc, 0x08, 0x30, 0xcc},	{0xbc, 0x09, 0x40, 0xcc},
	{0xbc, 0x0a, 0x10, 0xcc},	{0xbc, 0x0b, 0x00, 0xcc},
	{0xbc, 0x0c, 0x00, 0xcc},	{0x00, 0x05, 0x00, 0xaa},
	{0xb3, 0x5c, 0x00, 0xcc},	{0xb3, 0x01, 0x41, 0xcc},
	{}
};

1534
static const u8 hv7131r_gamma[17] = {
1535 1536
	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
1537
};
1538
static const u8 hv7131r_matrix[9] = {
1539 1540
	0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
};
1541
static const u8 hv7131r_initVGA_data[][4] = {
1542 1543 1544 1545
	{0xb3, 0x01, 0x01, 0xcc},
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
	{0x00, 0x00, 0x20, 0xdd},
1546
	{0xb3, 0x00, 0x24, 0xcc},
1547 1548 1549 1550 1551 1552 1553 1554 1555
	{0xb3, 0x00, 0x25, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x03, 0xcc},
	{0xb3, 0x01, 0x45, 0xcc},
	{0xb3, 0x03, 0x0b, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
1556
	{0xb3, 0x21, 0x00, 0xcc},
1557 1558 1559 1560
	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x02, 0xcc},
1561
	{0xb3, 0x16, 0x02, 0xcc},
1562 1563 1564 1565
	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x35, 0x91, 0xcc},
	{0xb3, 0x00, 0x27, 0xcc},
1566
	{0xbc, 0x00, 0x73, 0xcc},
1567 1568 1569 1570 1571
	{0xb8, 0x00, 0x23, 0xcc},
	{0xb8, 0x2c, 0x50, 0xcc},
	{0xb8, 0x2d, 0xf8, 0xcc},
	{0xb8, 0x2e, 0xf8, 0xcc},
	{0xb8, 0x2f, 0xf8, 0xcc},
1572
	{0xb8, 0x30, 0x50, 0xcc},
1573 1574 1575 1576
	{0xb8, 0x31, 0xf8, 0xcc},
	{0xb8, 0x32, 0xf8, 0xcc},
	{0xb8, 0x33, 0xf8, 0xcc},
	{0xb8, 0x34, 0x58, 0xcc},
1577
	{0xb8, 0x35, 0x00, 0xcc},
1578 1579 1580 1581
	{0xb8, 0x36, 0x00, 0xcc},
	{0xb8, 0x37, 0x00, 0xcc},
	{0xb8, 0x27, 0x20, 0xcc},
	{0xb8, 0x01, 0x7d, 0xcc},
1582
	{0xb8, 0x81, 0x09, 0xcc},
1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594
	{0xb3, 0x01, 0x41, 0xcc},
	{0xb8, 0x8e, 0x00, 0xcc},
	{0xb8, 0x8f, 0xff, 0xcc},
	{0x00, 0x01, 0x0c, 0xaa},
	{0x00, 0x14, 0x01, 0xaa},
	{0x00, 0x15, 0xe6, 0xaa},
	{0x00, 0x16, 0x02, 0xaa},
	{0x00, 0x17, 0x86, 0xaa},
	{0x00, 0x23, 0x00, 0xaa},
	{0x00, 0x25, 0x03, 0xaa},
	{0x00, 0x26, 0xa9, 0xaa},
	{0x00, 0x27, 0x80, 0xaa},
1595
	{0x00, 0x30, 0x18, 0xaa},
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
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x02, 0xcc},
	{0xb6, 0x02, 0x80, 0xcc},
	{0xb6, 0x05, 0x01, 0xcc},
	{0xb6, 0x04, 0xe0, 0xcc},
	{0xb6, 0x12, 0x78, 0xcc},
	{0xb6, 0x18, 0x02, 0xcc},
	{0xb6, 0x17, 0x58, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xb3, 0x02, 0x02, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
	{0xbf, 0xcc, 0x10, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb6, 0x13, 0x13, 0xcc},
	{0xb9, 0x12, 0x00, 0xcc},
	{0xb9, 0x13, 0x0a, 0xcc},
	{0xb9, 0x14, 0x0a, 0xcc},
	{0xb9, 0x15, 0x0a, 0xcc},
	{0xb9, 0x16, 0x0a, 0xcc},
	{0xb8, 0x0c, 0x20, 0xcc},
	{0xb8, 0x0d, 0x70, 0xcc},
	{0xb9, 0x18, 0x00, 0xcc},
	{0xb9, 0x19, 0x0f, 0xcc},
	{0xb9, 0x1a, 0x0f, 0xcc},
	{0xb9, 0x1b, 0x0f, 0xcc},
	{0xb9, 0x1c, 0x0f, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},
1626 1627 1628
	{}
};

1629
static const u8 hv7131r_initQVGA_data[][4] = {
1630 1631 1632 1633
	{0xb3, 0x01, 0x01, 0xcc},
	{0xb0, 0x03, 0x19, 0xcc},
	{0xb0, 0x04, 0x02, 0xcc},
	{0x00, 0x00, 0x20, 0xdd},
1634
	{0xb3, 0x00, 0x24, 0xcc},
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644
	{0xb3, 0x00, 0x25, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x03, 0xcc},
	{0xb3, 0x01, 0x45, 0xcc},
	{0xb3, 0x03, 0x0b, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
1645
	{0xb3, 0x22, 0x01, 0xcc},
1646 1647 1648 1649
	{0xb3, 0x23, 0xe0, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x02, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},
1650
	{0xb3, 0x17, 0x7f, 0xcc},
1651 1652 1653 1654 1655 1656 1657 1658 1659
	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x35, 0x91, 0xcc},
	{0xb3, 0x00, 0x27, 0xcc},
	{0xbc, 0x00, 0xd3, 0xcc},
	{0xb8, 0x00, 0x23, 0xcc},
	{0xb8, 0x2c, 0x50, 0xcc},
	{0xb8, 0x2d, 0xf8, 0xcc},
	{0xb8, 0x2e, 0xf8, 0xcc},
	{0xb8, 0x2f, 0xf8, 0xcc},
1660
	{0xb8, 0x30, 0x50, 0xcc},
1661 1662
	{0xb8, 0x31, 0xf8, 0xcc},
	{0xb8, 0x32, 0xf8, 0xcc},
1663
	{0xb8, 0x33, 0xf8, 0xcc},
1664 1665 1666 1667
	{0xb8, 0x34, 0x58, 0xcc},
	{0xb8, 0x35, 0x00, 0xcc},
	{0xb8, 0x36, 0x00, 0xcc},
	{0xb8, 0x37, 0x00, 0xcc},
1668
	{0xb8, 0x27, 0x20, 0xcc},
1669 1670 1671
	{0xb8, 0x01, 0x7d, 0xcc},
	{0xb8, 0x81, 0x09, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
1672
	{0xb8, 0x8e, 0x00, 0xcc},
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723
	{0xb8, 0x8f, 0xff, 0xcc},
	{0x00, 0x01, 0x0c, 0xaa},
	{0x00, 0x14, 0x01, 0xaa},
	{0x00, 0x15, 0xe6, 0xaa},
	{0x00, 0x16, 0x02, 0xaa},
	{0x00, 0x17, 0x86, 0xaa},
	{0x00, 0x23, 0x00, 0xaa},
	{0x00, 0x25, 0x03, 0xaa},
	{0x00, 0x26, 0xa9, 0xaa},
	{0x00, 0x27, 0x80, 0xaa},
	{0x00, 0x30, 0x18, 0xaa},
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x01, 0xcc},
	{0xb6, 0x02, 0x40, 0xcc},
	{0xb6, 0x05, 0x00, 0xcc},
	{0xb6, 0x04, 0xf0, 0xcc},
	{0xb6, 0x12, 0x78, 0xcc},
	{0xb6, 0x18, 0x00, 0xcc},
	{0xb6, 0x17, 0x96, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xb3, 0x02, 0x02, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
	{0xbf, 0xcc, 0x10, 0xcc},
	{0xbc, 0x02, 0x18, 0xcc},
	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},
	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},
	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},
	{0xbc, 0x0a, 0x10, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},
	{0xbc, 0x0c, 0x00, 0xcc},
	{0xb9, 0x12, 0x00, 0xcc},
	{0xb9, 0x13, 0x0a, 0xcc},
	{0xb9, 0x14, 0x0a, 0xcc},
	{0xb9, 0x15, 0x0a, 0xcc},
	{0xb9, 0x16, 0x0a, 0xcc},
	{0xb9, 0x18, 0x00, 0xcc},
	{0xb9, 0x19, 0x0f, 0xcc},
	{0xb8, 0x0c, 0x20, 0xcc},
	{0xb8, 0x0d, 0x70, 0xcc},
	{0xb9, 0x1a, 0x0f, 0xcc},
	{0xb9, 0x1b, 0x0f, 0xcc},
	{0xb9, 0x1c, 0x0f, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb6, 0x13, 0x13, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},
1724 1725 1726
	{}
};

1727
static const u8 ov7660_gamma[17] = {
1728 1729 1730
	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
1731
static const u8 ov7660_matrix[9] = {
1732 1733
	0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
};
1734
static const u8 ov7660_initVGA_data[][4] = {
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758
	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
	{0x00, 0x00, 0x50, 0xdd},
	{0xb0, 0x03, 0x01, 0xcc},
	{0xb3, 0x00, 0x21, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x03, 0xcc},
	{0xb3, 0x03, 0x1f, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x05, 0x00, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},	{0xb3, 0x1d, 0x01, 0xcc},
	{0xb3, 0x1f, 0x02, 0xcc},
	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x35, 0xa1, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
	{0xb8, 0x00, 0x33, 0xcc}, /* 13 */
	{0xb8, 0x01, 0x7d, 0xcc},
	{0xbc, 0x00, 0x73, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
	{0xb8, 0x27, 0x20, 0xcc},
	{0xb8, 0x8f, 0x50, 0xcc},
	{0x00, 0x01, 0x80, 0xaa},	{0x00, 0x02, 0x80, 0xaa},
	{0x00, 0x12, 0x80, 0xaa},
	{0x00, 0x12, 0x05, 0xaa},
1759
	{0x00, 0x1e, 0x01, 0xaa},	/* MVFP */
1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791
	{0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
	{0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
	{0x00, 0x0d, 0x48, 0xaa},	{0x00, 0x0e, 0x04, 0xaa},
	{0x00, 0x13, 0xa7, 0xaa},
	{0x00, 0x40, 0xc1, 0xaa},	{0x00, 0x35, 0x00, 0xaa},
	{0x00, 0x36, 0x00, 0xaa},
	{0x00, 0x3c, 0x68, 0xaa},	{0x00, 0x1b, 0x05, 0xaa},
	{0x00, 0x39, 0x43, 0xaa},
	{0x00, 0x8d, 0xcf, 0xaa},
	{0x00, 0x8b, 0xcc, 0xaa},	{0x00, 0x8c, 0xcc, 0xaa},
	{0x00, 0x0f, 0x62, 0xaa},
	{0x00, 0x35, 0x84, 0xaa},
	{0x00, 0x3b, 0x08, 0xaa}, /* 0 * Nightframe 1/4 + 50Hz -> 0xC8 */
	{0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
	{0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
	{0x00, 0x9e, 0x40, 0xaa},	{0xb8, 0x8f, 0x50, 0xcc},
	{0x00, 0x01, 0x80, 0xaa},
	{0x00, 0x02, 0x80, 0xaa},
	{0xb8, 0xfe, 0x00, 0xcc},	{0xb8, 0xff, 0x28, 0xcc},
	{0xb9, 0x00, 0x28, 0xcc},
	{0xb9, 0x01, 0x28, 0xcc},	{0xb9, 0x02, 0x28, 0xcc},
	{0xb9, 0x03, 0x00, 0xcc},
	{0xb9, 0x04, 0x00, 0xcc},
	{0xb9, 0x05, 0x3c, 0xcc},	{0xb9, 0x06, 0x3c, 0xcc},
	{0xb9, 0x07, 0x3c, 0xcc},
	{0xb9, 0x08, 0x3c, 0xcc},

	{0xb8, 0x8e, 0x00, 0xcc},	{0xb8, 0x8f, 0xff, 0xcc},

	{0x00, 0x29, 0x3c, 0xaa},	{0xb3, 0x01, 0x45, 0xcc},
	{}
};
1792
static const u8 ov7660_initQVGA_data[][4] = {
1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812
	{0xb0, 0x4d, 0x00, 0xcc},	{0xb3, 0x01, 0x01, 0xcc},
	{0x00, 0x00, 0x50, 0xdd},	{0xb0, 0x03, 0x01, 0xcc},
	{0xb3, 0x00, 0x21, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},	{0xb3, 0x06, 0x03, 0xcc},
	{0xb3, 0x03, 0x1f, 0xcc},	{0xb3, 0x04, 0x05, 0xcc},
	{0xb3, 0x05, 0x00, 0xcc},	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},/* 0xb315  <-0 href startl */
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},	{0xb3, 0x1d, 0x01, 0xcc},
	{0xb3, 0x1f, 0x02, 0xcc},	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x35, 0xa1, 0xcc},	{0xb3, 0x00, 0x26, 0xcc},
	{0xb8, 0x00, 0x33, 0xcc}, /* 13 */
	{0xb8, 0x01, 0x7d, 0xcc},
/* sizer */
	{0xbc, 0x00, 0xd3, 0xcc},
	{0xb8, 0x81, 0x09, 0xcc},	{0xb8, 0x81, 0x09, 0xcc},
	{0xb8, 0x27, 0x20, 0xcc},	{0xb8, 0x8f, 0x50, 0xcc},
	{0x00, 0x01, 0x80, 0xaa},	{0x00, 0x02, 0x80, 0xaa},
	{0x00, 0x12, 0x80, 0xaa},	{0x00, 0x12, 0x05, 0xaa},
1813
	{0x00, 0x1e, 0x01, 0xaa},	/* MVFP */
1814 1815 1816 1817 1818 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 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857
	{0x00, 0x3d, 0x40, 0xaa}, /* 0x3d <-40 gamma 01 */
	{0x00, 0x41, 0x00, 0xaa}, /* edge 00 */
	{0x00, 0x0d, 0x48, 0xaa},	{0x00, 0x0e, 0x04, 0xaa},
	{0x00, 0x13, 0xa7, 0xaa},
	{0x00, 0x40, 0xc1, 0xaa},	{0x00, 0x35, 0x00, 0xaa},
	{0x00, 0x36, 0x00, 0xaa},
	{0x00, 0x3c, 0x68, 0xaa},	{0x00, 0x1b, 0x05, 0xaa},
	{0x00, 0x39, 0x43, 0xaa},	{0x00, 0x8d, 0xcf, 0xaa},
	{0x00, 0x8b, 0xcc, 0xaa},	{0x00, 0x8c, 0xcc, 0xaa},
	{0x00, 0x0f, 0x62, 0xaa},	{0x00, 0x35, 0x84, 0xaa},
	{0x00, 0x3b, 0x08, 0xaa}, /* 0  * Nightframe 1/4 + 50Hz -> 0xC8 */
	{0x00, 0x3a, 0x00, 0xaa}, /* mx change yuyv format 00, 04, 01; 08, 0c*/
	{0x00, 0x14, 0x2a, 0xaa}, /* agc ampli */
	{0x00, 0x9e, 0x40, 0xaa},	{0xb8, 0x8f, 0x50, 0xcc},
	{0x00, 0x01, 0x80, 0xaa},
	{0x00, 0x02, 0x80, 0xaa},
/* sizer filters */
	{0xbc, 0x02, 0x08, 0xcc},
	{0xbc, 0x03, 0x70, 0xcc},
	{0xb8, 0x35, 0x00, 0xcc},
	{0xb8, 0x36, 0x00, 0xcc},
	{0xb8, 0x37, 0x00, 0xcc},
	{0xbc, 0x04, 0x08, 0xcc},
	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},
	{0xbc, 0x08, 0x3c, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},
	{0xbc, 0x0a, 0x04, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},
	{0xbc, 0x0c, 0x00, 0xcc},
/* */
	{0xb8, 0xfe, 0x00, 0xcc},
	{0xb8, 0xff, 0x28, 0xcc},
/* */
	{0xb9, 0x00, 0x28, 0xcc},	{0xb9, 0x01, 0x28, 0xcc},
	{0xb9, 0x02, 0x28, 0xcc},	{0xb9, 0x03, 0x00, 0xcc},
	{0xb9, 0x04, 0x00, 0xcc},	{0xb9, 0x05, 0x3c, 0xcc},
	{0xb9, 0x06, 0x3c, 0xcc},	{0xb9, 0x07, 0x3c, 0xcc},
	{0xb9, 0x08, 0x3c, 0xcc},
/* */
	{0xb8, 0x8e, 0x00, 0xcc},
	{0xb8, 0x8f, 0xff, 0xcc}, /* ff */
	{0x00, 0x29, 0x3c, 0xaa},
	{0xb3, 0x01, 0x45, 0xcc}, /* 45 */
1858
	{}
1859 1860
};

1861
static const u8 ov7660_50HZ[][4] = {
1862 1863 1864
	{0x00, 0x3b, 0x08, 0xaa},
	{0x00, 0x9d, 0x40, 0xaa},
	{0x00, 0x13, 0xa7, 0xaa},
1865
	{}
1866 1867
};

1868
static const u8 ov7660_60HZ[][4] = {
1869 1870 1871 1872 1873 1874
	{0x00, 0x3b, 0x00, 0xaa},
	{0x00, 0x9e, 0x40, 0xaa},
	{0x00, 0x13, 0xa7, 0xaa},
	{}
};

1875
static const u8 ov7660_NoFliker[][4] = {
1876 1877 1878 1879
	{0x00, 0x13, 0x87, 0xaa},
	{}
};

1880
static const u8 ov7670_initVGA_JPG[][4] = {
1881 1882 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
	{0xb3, 0x01, 0x05, 0xcc},
	{0x00, 0x00, 0x30, 0xdd},	{0xb0, 0x03, 0x19, 0xcc},
	{0x00, 0x00, 0x10, 0xdd},
	{0xb0, 0x04, 0x02, 0xcc},	{0x00, 0x00, 0x10, 0xdd},
	{0xb3, 0x00, 0x66, 0xcc},	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x35, 0xa1, 0xcc},	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x02, 0x02, 0xcc},	{0xb3, 0x03, 0x1f, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},	{0xbc, 0x00, 0x41, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},	{0x00, 0x12, 0x80, 0xaa},
	{0x00, 0x00, 0x20, 0xdd},	{0x00, 0x12, 0x00, 0xaa},
	{0x00, 0x11, 0x40, 0xaa},	{0x00, 0x6b, 0x0a, 0xaa},
	{0x00, 0x3a, 0x04, 0xaa},	{0x00, 0x40, 0xc0, 0xaa},
	{0x00, 0x8c, 0x00, 0xaa},	{0x00, 0x7a, 0x29, 0xaa},
	{0x00, 0x7b, 0x0e, 0xaa},	{0x00, 0x7c, 0x1a, 0xaa},
	{0x00, 0x7d, 0x31, 0xaa},	{0x00, 0x7e, 0x53, 0xaa},
	{0x00, 0x7f, 0x60, 0xaa},	{0x00, 0x80, 0x6b, 0xaa},
	{0x00, 0x81, 0x73, 0xaa},	{0x00, 0x82, 0x7b, 0xaa},
	{0x00, 0x83, 0x82, 0xaa},	{0x00, 0x84, 0x89, 0xaa},
	{0x00, 0x85, 0x96, 0xaa},	{0x00, 0x86, 0xa1, 0xaa},
	{0x00, 0x87, 0xb7, 0xaa},	{0x00, 0x88, 0xcc, 0xaa},
	{0x00, 0x89, 0xe1, 0xaa},	{0x00, 0x13, 0xe0, 0xaa},
	{0x00, 0x00, 0x00, 0xaa},	{0x00, 0x10, 0x00, 0xaa},
	{0x00, 0x0d, 0x40, 0xaa},	{0x00, 0x14, 0x28, 0xaa},
	{0x00, 0xa5, 0x05, 0xaa},	{0x00, 0xab, 0x07, 0xaa},
	{0x00, 0x24, 0x95, 0xaa},	{0x00, 0x25, 0x33, 0xaa},
	{0x00, 0x26, 0xe3, 0xaa},	{0x00, 0x9f, 0x88, 0xaa},
	{0x00, 0xa0, 0x78, 0xaa},	{0x00, 0x55, 0x90, 0xaa},
	{0x00, 0xa1, 0x03, 0xaa},	{0x00, 0xa6, 0xe0, 0xaa},
	{0x00, 0xa7, 0xd8, 0xaa},	{0x00, 0xa8, 0xf0, 0xaa},
	{0x00, 0xa9, 0x90, 0xaa},	{0x00, 0xaa, 0x14, 0xaa},
	{0x00, 0x13, 0xe5, 0xaa},	{0x00, 0x0e, 0x61, 0xaa},
	{0x00, 0x0f, 0x4b, 0xaa},	{0x00, 0x16, 0x02, 0xaa},
1919 1920
	{0x00, 0x1e, 0x07, 0xaa},	/* MVFP */
	{0x00, 0x21, 0x02, 0xaa},
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 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
	{0x00, 0x22, 0x91, 0xaa},	{0x00, 0x29, 0x07, 0xaa},
	{0x00, 0x33, 0x0b, 0xaa},	{0x00, 0x35, 0x0b, 0xaa},
	{0x00, 0x37, 0x1d, 0xaa},	{0x00, 0x38, 0x71, 0xaa},
	{0x00, 0x39, 0x2a, 0xaa},	{0x00, 0x3c, 0x78, 0xaa},
	{0x00, 0x4d, 0x40, 0xaa},	{0x00, 0x4e, 0x20, 0xaa},
	{0x00, 0x74, 0x19, 0xaa},	{0x00, 0x8d, 0x4f, 0xaa},
	{0x00, 0x8e, 0x00, 0xaa},	{0x00, 0x8f, 0x00, 0xaa},
	{0x00, 0x90, 0x00, 0xaa},	{0x00, 0x91, 0x00, 0xaa},
	{0x00, 0x96, 0x00, 0xaa},	{0x00, 0x9a, 0x80, 0xaa},
	{0x00, 0xb0, 0x84, 0xaa},	{0x00, 0xb1, 0x0c, 0xaa},
	{0x00, 0xb2, 0x0e, 0xaa},	{0x00, 0xb3, 0x82, 0xaa},
	{0x00, 0xb8, 0x0a, 0xaa},	{0x00, 0x43, 0x14, 0xaa},
	{0x00, 0x44, 0xf0, 0xaa},	{0x00, 0x45, 0x45, 0xaa},
	{0x00, 0x46, 0x63, 0xaa},	{0x00, 0x47, 0x2d, 0xaa},
	{0x00, 0x48, 0x46, 0xaa},	{0x00, 0x59, 0x88, 0xaa},
	{0x00, 0x5a, 0xa0, 0xaa},	{0x00, 0x5b, 0xc6, 0xaa},
	{0x00, 0x5c, 0x7d, 0xaa},	{0x00, 0x5d, 0x5f, 0xaa},
	{0x00, 0x5e, 0x19, 0xaa},	{0x00, 0x6c, 0x0a, 0xaa},
	{0x00, 0x6d, 0x55, 0xaa},	{0x00, 0x6e, 0x11, 0xaa},
	{0x00, 0x6f, 0x9e, 0xaa},	{0x00, 0x69, 0x00, 0xaa},
	{0x00, 0x6a, 0x40, 0xaa},	{0x00, 0x01, 0x40, 0xaa},
	{0x00, 0x02, 0x40, 0xaa},	{0x00, 0x13, 0xe7, 0xaa},
	{0x00, 0x5f, 0xf0, 0xaa},	{0x00, 0x60, 0xf0, 0xaa},
	{0x00, 0x61, 0xf0, 0xaa},	{0x00, 0x27, 0xa0, 0xaa},
	{0x00, 0x28, 0x80, 0xaa},	{0x00, 0x2c, 0x90, 0xaa},
	{0x00, 0x4f, 0x66, 0xaa},	{0x00, 0x50, 0x66, 0xaa},
	{0x00, 0x51, 0x00, 0xaa},	{0x00, 0x52, 0x22, 0xaa},
	{0x00, 0x53, 0x5e, 0xaa},	{0x00, 0x54, 0x80, 0xaa},
	{0x00, 0x58, 0x9e, 0xaa},	{0x00, 0x41, 0x08, 0xaa},
	{0x00, 0x3f, 0x00, 0xaa},	{0x00, 0x75, 0x85, 0xaa},
	{0x00, 0x76, 0xe1, 0xaa},	{0x00, 0x4c, 0x00, 0xaa},
	{0x00, 0x77, 0x0a, 0xaa},	{0x00, 0x3d, 0x88, 0xaa},
	{0x00, 0x4b, 0x09, 0xaa},	{0x00, 0xc9, 0x60, 0xaa},
	{0x00, 0x41, 0x38, 0xaa},	{0x00, 0x62, 0x30, 0xaa},
	{0x00, 0x63, 0x30, 0xaa},	{0x00, 0x64, 0x08, 0xaa},
	{0x00, 0x94, 0x07, 0xaa},	{0x00, 0x95, 0x0b, 0xaa},
	{0x00, 0x65, 0x00, 0xaa},	{0x00, 0x66, 0x05, 0xaa},
	{0x00, 0x56, 0x50, 0xaa},	{0x00, 0x34, 0x11, 0xaa},
	{0x00, 0xa4, 0x88, 0xaa},	{0x00, 0x96, 0x00, 0xaa},
	{0x00, 0x97, 0x30, 0xaa},	{0x00, 0x98, 0x20, 0xaa},
	{0x00, 0x99, 0x30, 0xaa},	{0x00, 0x9a, 0x84, 0xaa},
	{0x00, 0x9b, 0x29, 0xaa},	{0x00, 0x9c, 0x03, 0xaa},
	{0x00, 0x78, 0x04, 0xaa},	{0x00, 0x79, 0x01, 0xaa},
	{0x00, 0xc8, 0xf0, 0xaa},	{0x00, 0x79, 0x0f, 0xaa},
	{0x00, 0xc8, 0x00, 0xaa},	{0x00, 0x79, 0x10, 0xaa},
	{0x00, 0xc8, 0x7e, 0xaa},	{0x00, 0x79, 0x0a, 0xaa},
	{0x00, 0xc8, 0x80, 0xaa},	{0x00, 0x79, 0x0b, 0xaa},
	{0x00, 0xc8, 0x01, 0xaa},	{0x00, 0x79, 0x0c, 0xaa},
	{0x00, 0xc8, 0x0f, 0xaa},	{0x00, 0x79, 0x0d, 0xaa},
	{0x00, 0xc8, 0x20, 0xaa},	{0x00, 0x79, 0x09, 0xaa},
	{0x00, 0xc8, 0x80, 0xaa},	{0x00, 0x79, 0x02, 0xaa},
	{0x00, 0xc8, 0xc0, 0xaa},	{0x00, 0x79, 0x03, 0xaa},
	{0x00, 0xc8, 0x40, 0xaa},	{0x00, 0x79, 0x05, 0xaa},
	{0x00, 0xc8, 0x30, 0xaa},	{0x00, 0x79, 0x26, 0xaa},
	{0x00, 0x11, 0x40, 0xaa},	{0x00, 0x3a, 0x04, 0xaa},
	{0x00, 0x12, 0x00, 0xaa},	{0x00, 0x40, 0xc0, 0xaa},
	{0x00, 0x8c, 0x00, 0xaa},	{0x00, 0x17, 0x14, 0xaa},
	{0x00, 0x18, 0x02, 0xaa},	{0x00, 0x32, 0x92, 0xaa},
	{0x00, 0x19, 0x02, 0xaa},	{0x00, 0x1a, 0x7a, 0xaa},
	{0x00, 0x03, 0x0a, 0xaa},	{0x00, 0x0c, 0x00, 0xaa},
	{0x00, 0x3e, 0x00, 0xaa},	{0x00, 0x70, 0x3a, 0xaa},
	{0x00, 0x71, 0x35, 0xaa},	{0x00, 0x72, 0x11, 0xaa},
	{0x00, 0x73, 0xf0, 0xaa},	{0x00, 0xa2, 0x02, 0xaa},
	{0x00, 0xb1, 0x00, 0xaa},	{0x00, 0xb1, 0x0c, 0xaa},
1985 1986
	{0x00, 0x1e, 0x37, 0xaa},	/* MVFP */
	{0x00, 0xaa, 0x14, 0xaa},
1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
	{0x00, 0x24, 0x80, 0xaa},	{0x00, 0x25, 0x74, 0xaa},
	{0x00, 0x26, 0xd3, 0xaa},	{0x00, 0x0d, 0x00, 0xaa},
	{0x00, 0x14, 0x18, 0xaa},	{0x00, 0x9d, 0x99, 0xaa},
	{0x00, 0x9e, 0x7f, 0xaa},	{0x00, 0x64, 0x08, 0xaa},
	{0x00, 0x94, 0x07, 0xaa},	{0x00, 0x95, 0x06, 0xaa},
	{0x00, 0x66, 0x05, 0xaa},	{0x00, 0x41, 0x08, 0xaa},
	{0x00, 0x3f, 0x00, 0xaa},	{0x00, 0x75, 0x07, 0xaa},
	{0x00, 0x76, 0xe1, 0xaa},	{0x00, 0x4c, 0x00, 0xaa},
	{0x00, 0x77, 0x00, 0xaa},	{0x00, 0x3d, 0xc2, 0xaa},
	{0x00, 0x4b, 0x09, 0xaa},	{0x00, 0xc9, 0x60, 0xaa},
	{0x00, 0x41, 0x38, 0xaa},	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x02, 0xcc},	{0xb6, 0x02, 0x80, 0xcc},
	{0xb6, 0x05, 0x01, 0xcc},	{0xb6, 0x04, 0xe0, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},	{0xb6, 0x13, 0x13, 0xcc},
	{0xb6, 0x18, 0x02, 0xcc},	{0xb6, 0x17, 0x58, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},	{0xbf, 0xcc, 0x00, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},	{0xb3, 0x01, 0x45, 0xcc},
	{0x00, 0x77, 0x05, 0xaa},
	{},
};

2010
static const u8 ov7670_initQVGA_JPG[][4] = {
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 2047
	{0xb3, 0x01, 0x05, 0xcc},	{0x00, 0x00, 0x30, 0xdd},
	{0xb0, 0x03, 0x19, 0xcc},	{0x00, 0x00, 0x10, 0xdd},
	{0xb0, 0x04, 0x02, 0xcc},	{0x00, 0x00, 0x10, 0xdd},
	{0xb3, 0x00, 0x66, 0xcc},	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x35, 0xa1, 0xcc},	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x02, 0x02, 0xcc},	{0xb3, 0x03, 0x1f, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x02, 0xcc},	{0xb3, 0x17, 0x7f, 0xcc},
	{0xb3, 0x04, 0x05, 0xcc},	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},	{0xb3, 0x22, 0x01, 0xcc},
	{0xb3, 0x23, 0xe0, 0xcc},	{0xbc, 0x00, 0xd1, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},	{0x00, 0x12, 0x80, 0xaa},
	{0x00, 0x00, 0x20, 0xdd},	{0x00, 0x12, 0x00, 0xaa},
	{0x00, 0x11, 0x40, 0xaa},	{0x00, 0x6b, 0x0a, 0xaa},
	{0x00, 0x3a, 0x04, 0xaa},	{0x00, 0x40, 0xc0, 0xaa},
	{0x00, 0x8c, 0x00, 0xaa},	{0x00, 0x7a, 0x29, 0xaa},
	{0x00, 0x7b, 0x0e, 0xaa},	{0x00, 0x7c, 0x1a, 0xaa},
	{0x00, 0x7d, 0x31, 0xaa},	{0x00, 0x7e, 0x53, 0xaa},
	{0x00, 0x7f, 0x60, 0xaa},	{0x00, 0x80, 0x6b, 0xaa},
	{0x00, 0x81, 0x73, 0xaa},	{0x00, 0x82, 0x7b, 0xaa},
	{0x00, 0x83, 0x82, 0xaa},	{0x00, 0x84, 0x89, 0xaa},
	{0x00, 0x85, 0x96, 0xaa},	{0x00, 0x86, 0xa1, 0xaa},
	{0x00, 0x87, 0xb7, 0xaa},	{0x00, 0x88, 0xcc, 0xaa},
	{0x00, 0x89, 0xe1, 0xaa},	{0x00, 0x13, 0xe0, 0xaa},
	{0x00, 0x00, 0x00, 0xaa},	{0x00, 0x10, 0x00, 0xaa},
	{0x00, 0x0d, 0x40, 0xaa},	{0x00, 0x14, 0x28, 0xaa},
	{0x00, 0xa5, 0x05, 0xaa},	{0x00, 0xab, 0x07, 0xaa},
	{0x00, 0x24, 0x95, 0xaa},	{0x00, 0x25, 0x33, 0xaa},
	{0x00, 0x26, 0xe3, 0xaa},	{0x00, 0x9f, 0x88, 0xaa},
	{0x00, 0xa0, 0x78, 0xaa},	{0x00, 0x55, 0x90, 0xaa},
	{0x00, 0xa1, 0x03, 0xaa},	{0x00, 0xa6, 0xe0, 0xaa},
	{0x00, 0xa7, 0xd8, 0xaa},	{0x00, 0xa8, 0xf0, 0xaa},
	{0x00, 0xa9, 0x90, 0xaa},	{0x00, 0xaa, 0x14, 0xaa},
	{0x00, 0x13, 0xe5, 0xaa},	{0x00, 0x0e, 0x61, 0xaa},
	{0x00, 0x0f, 0x4b, 0xaa},	{0x00, 0x16, 0x02, 0xaa},
2048 2049
	{0x00, 0x1e, 0x07, 0xaa},	/* MVFP */
	{0x00, 0x21, 0x02, 0xaa},
2050 2051 2052 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 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113
	{0x00, 0x22, 0x91, 0xaa},	{0x00, 0x29, 0x07, 0xaa},
	{0x00, 0x33, 0x0b, 0xaa},	{0x00, 0x35, 0x0b, 0xaa},
	{0x00, 0x37, 0x1d, 0xaa},	{0x00, 0x38, 0x71, 0xaa},
	{0x00, 0x39, 0x2a, 0xaa},	{0x00, 0x3c, 0x78, 0xaa},
	{0x00, 0x4d, 0x40, 0xaa},	{0x00, 0x4e, 0x20, 0xaa},
	{0x00, 0x74, 0x19, 0xaa},	{0x00, 0x8d, 0x4f, 0xaa},
	{0x00, 0x8e, 0x00, 0xaa},	{0x00, 0x8f, 0x00, 0xaa},
	{0x00, 0x90, 0x00, 0xaa},	{0x00, 0x91, 0x00, 0xaa},
	{0x00, 0x96, 0x00, 0xaa},	{0x00, 0x9a, 0x80, 0xaa},
	{0x00, 0xb0, 0x84, 0xaa},	{0x00, 0xb1, 0x0c, 0xaa},
	{0x00, 0xb2, 0x0e, 0xaa},	{0x00, 0xb3, 0x82, 0xaa},
	{0x00, 0xb8, 0x0a, 0xaa},	{0x00, 0x43, 0x14, 0xaa},
	{0x00, 0x44, 0xf0, 0xaa},	{0x00, 0x45, 0x45, 0xaa},
	{0x00, 0x46, 0x63, 0xaa},	{0x00, 0x47, 0x2d, 0xaa},
	{0x00, 0x48, 0x46, 0xaa},	{0x00, 0x59, 0x88, 0xaa},
	{0x00, 0x5a, 0xa0, 0xaa},	{0x00, 0x5b, 0xc6, 0xaa},
	{0x00, 0x5c, 0x7d, 0xaa},	{0x00, 0x5d, 0x5f, 0xaa},
	{0x00, 0x5e, 0x19, 0xaa},	{0x00, 0x6c, 0x0a, 0xaa},
	{0x00, 0x6d, 0x55, 0xaa},	{0x00, 0x6e, 0x11, 0xaa},
	{0x00, 0x6f, 0x9e, 0xaa},	{0x00, 0x69, 0x00, 0xaa},
	{0x00, 0x6a, 0x40, 0xaa},	{0x00, 0x01, 0x40, 0xaa},
	{0x00, 0x02, 0x40, 0xaa},	{0x00, 0x13, 0xe7, 0xaa},
	{0x00, 0x5f, 0xf0, 0xaa},	{0x00, 0x60, 0xf0, 0xaa},
	{0x00, 0x61, 0xf0, 0xaa},	{0x00, 0x27, 0xa0, 0xaa},
	{0x00, 0x28, 0x80, 0xaa},	{0x00, 0x2c, 0x90, 0xaa},
	{0x00, 0x4f, 0x66, 0xaa},	{0x00, 0x50, 0x66, 0xaa},
	{0x00, 0x51, 0x00, 0xaa},	{0x00, 0x52, 0x22, 0xaa},
	{0x00, 0x53, 0x5e, 0xaa},	{0x00, 0x54, 0x80, 0xaa},
	{0x00, 0x58, 0x9e, 0xaa},	{0x00, 0x41, 0x08, 0xaa},
	{0x00, 0x3f, 0x00, 0xaa},	{0x00, 0x75, 0x85, 0xaa},
	{0x00, 0x76, 0xe1, 0xaa},	{0x00, 0x4c, 0x00, 0xaa},
	{0x00, 0x77, 0x0a, 0xaa},	{0x00, 0x3d, 0x88, 0xaa},
	{0x00, 0x4b, 0x09, 0xaa},	{0x00, 0xc9, 0x60, 0xaa},
	{0x00, 0x41, 0x38, 0xaa},	{0x00, 0x62, 0x30, 0xaa},
	{0x00, 0x63, 0x30, 0xaa},	{0x00, 0x64, 0x08, 0xaa},
	{0x00, 0x94, 0x07, 0xaa},	{0x00, 0x95, 0x0b, 0xaa},
	{0x00, 0x65, 0x00, 0xaa},	{0x00, 0x66, 0x05, 0xaa},
	{0x00, 0x56, 0x50, 0xaa},	{0x00, 0x34, 0x11, 0xaa},
	{0x00, 0xa4, 0x88, 0xaa},	{0x00, 0x96, 0x00, 0xaa},
	{0x00, 0x97, 0x30, 0xaa},	{0x00, 0x98, 0x20, 0xaa},
	{0x00, 0x99, 0x30, 0xaa},	{0x00, 0x9a, 0x84, 0xaa},
	{0x00, 0x9b, 0x29, 0xaa},	{0x00, 0x9c, 0x03, 0xaa},
	{0x00, 0x78, 0x04, 0xaa},	{0x00, 0x79, 0x01, 0xaa},
	{0x00, 0xc8, 0xf0, 0xaa},	{0x00, 0x79, 0x0f, 0xaa},
	{0x00, 0xc8, 0x00, 0xaa},	{0x00, 0x79, 0x10, 0xaa},
	{0x00, 0xc8, 0x7e, 0xaa},	{0x00, 0x79, 0x0a, 0xaa},
	{0x00, 0xc8, 0x80, 0xaa},	{0x00, 0x79, 0x0b, 0xaa},
	{0x00, 0xc8, 0x01, 0xaa},	{0x00, 0x79, 0x0c, 0xaa},
	{0x00, 0xc8, 0x0f, 0xaa},	{0x00, 0x79, 0x0d, 0xaa},
	{0x00, 0xc8, 0x20, 0xaa},	{0x00, 0x79, 0x09, 0xaa},
	{0x00, 0xc8, 0x80, 0xaa},	{0x00, 0x79, 0x02, 0xaa},
	{0x00, 0xc8, 0xc0, 0xaa},	{0x00, 0x79, 0x03, 0xaa},
	{0x00, 0xc8, 0x40, 0xaa},	{0x00, 0x79, 0x05, 0xaa},
	{0x00, 0xc8, 0x30, 0xaa},	{0x00, 0x79, 0x26, 0xaa},
	{0x00, 0x11, 0x40, 0xaa},	{0x00, 0x3a, 0x04, 0xaa},
	{0x00, 0x12, 0x00, 0xaa},	{0x00, 0x40, 0xc0, 0xaa},
	{0x00, 0x8c, 0x00, 0xaa},	{0x00, 0x17, 0x14, 0xaa},
	{0x00, 0x18, 0x02, 0xaa},	{0x00, 0x32, 0x92, 0xaa},
	{0x00, 0x19, 0x02, 0xaa},	{0x00, 0x1a, 0x7a, 0xaa},
	{0x00, 0x03, 0x0a, 0xaa},	{0x00, 0x0c, 0x00, 0xaa},
	{0x00, 0x3e, 0x00, 0xaa},	{0x00, 0x70, 0x3a, 0xaa},
	{0x00, 0x71, 0x35, 0xaa},	{0x00, 0x72, 0x11, 0xaa},
	{0x00, 0x73, 0xf0, 0xaa},	{0x00, 0xa2, 0x02, 0xaa},
	{0x00, 0xb1, 0x00, 0xaa},	{0x00, 0xb1, 0x0c, 0xaa},
2114 2115
	{0x00, 0x1e, 0x37, 0xaa},	/* MVFP */
	{0x00, 0xaa, 0x14, 0xaa},
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
	{0x00, 0x24, 0x80, 0xaa},	{0x00, 0x25, 0x74, 0xaa},
	{0x00, 0x26, 0xd3, 0xaa},	{0x00, 0x0d, 0x00, 0xaa},
	{0x00, 0x14, 0x18, 0xaa},	{0x00, 0x9d, 0x99, 0xaa},
	{0x00, 0x9e, 0x7f, 0xaa},	{0x00, 0x64, 0x08, 0xaa},
	{0x00, 0x94, 0x07, 0xaa},	{0x00, 0x95, 0x06, 0xaa},
	{0x00, 0x66, 0x05, 0xaa},	{0x00, 0x41, 0x08, 0xaa},
	{0x00, 0x3f, 0x00, 0xaa},	{0x00, 0x75, 0x07, 0xaa},
	{0x00, 0x76, 0xe1, 0xaa},	{0x00, 0x4c, 0x00, 0xaa},
	{0x00, 0x77, 0x00, 0xaa},	{0x00, 0x3d, 0xc2, 0xaa},
	{0x00, 0x4b, 0x09, 0xaa},	{0x00, 0xc9, 0x60, 0xaa},
	{0x00, 0x41, 0x38, 0xaa},	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x01, 0xcc},	{0xb6, 0x02, 0x40, 0xcc},
	{0xb6, 0x05, 0x00, 0xcc},	{0xb6, 0x04, 0xf0, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},	{0xb6, 0x13, 0x21, 0xcc},
	{0xb6, 0x18, 0x00, 0xcc},	{0xb6, 0x17, 0x96, 0xcc},
	{0xb6, 0x16, 0x00, 0xcc},	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},	{0xbf, 0xcc, 0x00, 0xcc},
	{0xbc, 0x02, 0x18, 0xcc},	{0xbc, 0x03, 0x50, 0xcc},
	{0xbc, 0x04, 0x18, 0xcc},	{0xbc, 0x05, 0x00, 0xcc},
	{0xbc, 0x06, 0x00, 0xcc},	{0xbc, 0x08, 0x30, 0xcc},
	{0xbc, 0x09, 0x40, 0xcc},	{0xbc, 0x0a, 0x10, 0xcc},
	{0xbc, 0x0b, 0x00, 0xcc},	{0xbc, 0x0c, 0x00, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},	{0xb3, 0x01, 0x45, 0xcc},
	{0x00, 0x77, 0x05, 0xaa },
	{},
};
2143 2144

/* PO1200 - values from usbvm326.inf and ms-win trace */
2145
static const u8 po1200_gamma[17] = {
2146 2147 2148
	0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
	0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
2149
static const u8 po1200_matrix[9] = {
2150 2151
	0x60, 0xf9, 0xe5, 0xe7, 0x50, 0x05, 0xf3, 0xe6, 0x5e
};
2152
static const u8 po1200_initVGA_data[][4] = {
2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187
	{0xb0, 0x03, 0x19, 0xcc},	/* reset? */
	{0xb0, 0x03, 0x19, 0xcc},
/*	{0x00, 0x00, 0x33, 0xdd}, */
	{0xb0, 0x04, 0x02, 0xcc},
	{0xb0, 0x02, 0x02, 0xcc},
	{0xb3, 0x5d, 0x00, 0xcc},
	{0xb3, 0x01, 0x01, 0xcc},
	{0xb3, 0x00, 0x64, 0xcc},
	{0xb3, 0x00, 0x65, 0xcc},
	{0xb3, 0x05, 0x01, 0xcc},
	{0xb3, 0x06, 0x01, 0xcc},
	{0xb3, 0x5c, 0x01, 0xcc},
	{0xb3, 0x08, 0x01, 0xcc},
	{0xb3, 0x09, 0x0c, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x02, 0xb2, 0xcc},
	{0xb3, 0x03, 0x18, 0xcc},
	{0xb3, 0x04, 0x15, 0xcc},
	{0xb3, 0x20, 0x00, 0xcc},
	{0xb3, 0x21, 0x00, 0xcc},
	{0xb3, 0x22, 0x02, 0xcc},
	{0xb3, 0x23, 0x58, 0xcc},
	{0xb3, 0x14, 0x00, 0xcc},
	{0xb3, 0x15, 0x00, 0xcc},
	{0xb3, 0x16, 0x03, 0xcc},
	{0xb3, 0x17, 0x1f, 0xcc},
	{0xbc, 0x00, 0x71, 0xcc},
	{0xbc, 0x01, 0x01, 0xcc},
	{0xb0, 0x54, 0x13, 0xcc},
	{0xb3, 0x00, 0x67, 0xcc},
	{0xb3, 0x34, 0x01, 0xcc},
	{0xb3, 0x35, 0xdc, 0xcc},
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x12, 0x05, 0xaa},
	{0x00, 0x13, 0x02, 0xaa},
2188
	{0x00, 0x1e, 0xc6, 0xaa},	/* h/v flip */
2189 2190 2191 2192 2193 2194 2195 2196 2197
	{0x00, 0x21, 0x00, 0xaa},
	{0x00, 0x25, 0x02, 0xaa},
	{0x00, 0x3c, 0x4f, 0xaa},
	{0x00, 0x3f, 0xe0, 0xaa},
	{0x00, 0x42, 0xff, 0xaa},
	{0x00, 0x45, 0x34, 0xaa},
	{0x00, 0x55, 0xfe, 0xaa},
	{0x00, 0x59, 0xd3, 0xaa},
	{0x00, 0x5e, 0x04, 0xaa},
2198
	{0x00, 0x61, 0xb8, 0xaa},	/* sharpness */
2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293
	{0x00, 0x62, 0x02, 0xaa},
	{0x00, 0xa7, 0x31, 0xaa},
	{0x00, 0xa9, 0x66, 0xaa},
	{0x00, 0xb0, 0x00, 0xaa},
	{0x00, 0xb1, 0x00, 0xaa},
	{0x00, 0xb3, 0x11, 0xaa},
	{0x00, 0xb6, 0x26, 0xaa},
	{0x00, 0xb7, 0x20, 0xaa},
	{0x00, 0xba, 0x04, 0xaa},
	{0x00, 0x88, 0x42, 0xaa},
	{0x00, 0x89, 0x9a, 0xaa},
	{0x00, 0x8a, 0x88, 0xaa},
	{0x00, 0x8b, 0x8e, 0xaa},
	{0x00, 0x8c, 0x3e, 0xaa},
	{0x00, 0x8d, 0x90, 0xaa},
	{0x00, 0x8e, 0x87, 0xaa},
	{0x00, 0x8f, 0x96, 0xaa},
	{0x00, 0x90, 0x3d, 0xaa},
	{0x00, 0x64, 0x00, 0xaa},
	{0x00, 0x65, 0x10, 0xaa},
	{0x00, 0x66, 0x20, 0xaa},
	{0x00, 0x67, 0x2b, 0xaa},
	{0x00, 0x68, 0x36, 0xaa},
	{0x00, 0x69, 0x49, 0xaa},
	{0x00, 0x6a, 0x5a, 0xaa},
	{0x00, 0x6b, 0x7f, 0xaa},
	{0x00, 0x6c, 0x9b, 0xaa},
	{0x00, 0x6d, 0xba, 0xaa},
	{0x00, 0x6e, 0xd4, 0xaa},
	{0x00, 0x6f, 0xea, 0xaa},
	{0x00, 0x70, 0x00, 0xaa},
	{0x00, 0x71, 0x10, 0xaa},
	{0x00, 0x72, 0x20, 0xaa},
	{0x00, 0x73, 0x2b, 0xaa},
	{0x00, 0x74, 0x36, 0xaa},
	{0x00, 0x75, 0x49, 0xaa},
	{0x00, 0x76, 0x5a, 0xaa},
	{0x00, 0x77, 0x7f, 0xaa},
	{0x00, 0x78, 0x9b, 0xaa},
	{0x00, 0x79, 0xba, 0xaa},
	{0x00, 0x7a, 0xd4, 0xaa},
	{0x00, 0x7b, 0xea, 0xaa},
	{0x00, 0x7c, 0x00, 0xaa},
	{0x00, 0x7d, 0x10, 0xaa},
	{0x00, 0x7e, 0x20, 0xaa},
	{0x00, 0x7f, 0x2b, 0xaa},
	{0x00, 0x80, 0x36, 0xaa},
	{0x00, 0x81, 0x49, 0xaa},
	{0x00, 0x82, 0x5a, 0xaa},
	{0x00, 0x83, 0x7f, 0xaa},
	{0x00, 0x84, 0x9b, 0xaa},
	{0x00, 0x85, 0xba, 0xaa},
	{0x00, 0x86, 0xd4, 0xaa},
	{0x00, 0x87, 0xea, 0xaa},
	{0x00, 0x57, 0x2a, 0xaa},
	{0x00, 0x03, 0x01, 0xaa},
	{0x00, 0x04, 0x10, 0xaa},
	{0x00, 0x05, 0x10, 0xaa},
	{0x00, 0x06, 0x10, 0xaa},
	{0x00, 0x07, 0x10, 0xaa},
	{0x00, 0x08, 0x13, 0xaa},
	{0x00, 0x0a, 0x00, 0xaa},
	{0x00, 0x0b, 0x10, 0xaa},
	{0x00, 0x0c, 0x20, 0xaa},
	{0x00, 0x0d, 0x18, 0xaa},
	{0x00, 0x22, 0x01, 0xaa},
	{0x00, 0x23, 0x60, 0xaa},
	{0x00, 0x25, 0x08, 0xaa},
	{0x00, 0x26, 0x82, 0xaa},
	{0x00, 0x2e, 0x0f, 0xaa},
	{0x00, 0x2f, 0x1e, 0xaa},
	{0x00, 0x30, 0x2d, 0xaa},
	{0x00, 0x31, 0x3c, 0xaa},
	{0x00, 0x32, 0x4b, 0xaa},
	{0x00, 0x33, 0x5a, 0xaa},
	{0x00, 0x34, 0x69, 0xaa},
	{0x00, 0x35, 0x78, 0xaa},
	{0x00, 0x36, 0x87, 0xaa},
	{0x00, 0x37, 0x96, 0xaa},
	{0x00, 0x38, 0xa5, 0xaa},
	{0x00, 0x39, 0xb4, 0xaa},
	{0x00, 0x3a, 0xc3, 0xaa},
	{0x00, 0x3b, 0xd2, 0xaa},
	{0x00, 0x3c, 0xe1, 0xaa},
	{0x00, 0x3e, 0xff, 0xaa},
	{0x00, 0x3f, 0xff, 0xaa},
	{0x00, 0x40, 0xff, 0xaa},
	{0x00, 0x41, 0xff, 0xaa},
	{0x00, 0x42, 0xff, 0xaa},
	{0x00, 0x43, 0xff, 0xaa},
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x20, 0xc4, 0xaa},
	{0x00, 0x13, 0x03, 0xaa},
	{0x00, 0x3c, 0x50, 0xaa},
2294
	{0x00, 0x61, 0x6a, 0xaa},	/* sharpness? */
2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348
	{0x00, 0x51, 0x5b, 0xaa},
	{0x00, 0x52, 0x91, 0xaa},
	{0x00, 0x53, 0x4c, 0xaa},
	{0x00, 0x54, 0x50, 0xaa},
	{0x00, 0x56, 0x02, 0xaa},
	{0xb6, 0x00, 0x00, 0xcc},
	{0xb6, 0x03, 0x03, 0xcc},
	{0xb6, 0x02, 0x20, 0xcc},
	{0xb6, 0x05, 0x02, 0xcc},
	{0xb6, 0x04, 0x58, 0xcc},
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb6, 0x13, 0x21, 0xcc},
	{0xb6, 0x18, 0x03, 0xcc},
	{0xb6, 0x17, 0xa9, 0xcc},
	{0xb6, 0x16, 0x80, 0xcc},
	{0xb6, 0x22, 0x12, 0xcc},
	{0xb6, 0x23, 0x0b, 0xcc},
	{0xbf, 0xc0, 0x39, 0xcc},
	{0xbf, 0xc1, 0x04, 0xcc},
	{0xbf, 0xcc, 0x00, 0xcc},
	{0xb8, 0x06, 0x20, 0xcc},
	{0xb8, 0x07, 0x03, 0xcc},
	{0xb8, 0x08, 0x58, 0xcc},
	{0xb8, 0x09, 0x02, 0xcc},
	{0xb3, 0x01, 0x41, 0xcc},
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0xd9, 0x0f, 0xaa},
	{0x00, 0xda, 0xaa, 0xaa},
	{0x00, 0xd9, 0x10, 0xaa},
	{0x00, 0xda, 0xaa, 0xaa},
	{0x00, 0xd9, 0x11, 0xaa},
	{0x00, 0xda, 0x00, 0xaa},
	{0x00, 0xd9, 0x12, 0xaa},
	{0x00, 0xda, 0xff, 0xaa},
	{0x00, 0xd9, 0x13, 0xaa},
	{0x00, 0xda, 0xff, 0xaa},
	{0x00, 0xe8, 0x11, 0xaa},
	{0x00, 0xe9, 0x12, 0xaa},
	{0x00, 0xea, 0x5c, 0xaa},
	{0x00, 0xeb, 0xff, 0xaa},
	{0x00, 0xd8, 0x80, 0xaa},
	{0x00, 0xe6, 0x02, 0xaa},
	{0x00, 0xd6, 0x40, 0xaa},
	{0x00, 0xe3, 0x05, 0xaa},
	{0x00, 0xe0, 0x40, 0xaa},
	{0x00, 0xde, 0x03, 0xaa},
	{0x00, 0xdf, 0x03, 0xaa},
	{0x00, 0xdb, 0x02, 0xaa},
	{0x00, 0xdc, 0x00, 0xaa},
	{0x00, 0xdd, 0x03, 0xaa},
	{0x00, 0xe1, 0x08, 0xaa},
	{0x00, 0xe2, 0x01, 0xaa},
	{0x00, 0xd6, 0x40, 0xaa},
	{0x00, 0xe4, 0x40, 0xaa},
2349
	{0x00, 0xa8, 0x8f, 0xaa},
2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412
	{0x00, 0xb4, 0x16, 0xaa},
	{0xb0, 0x02, 0x06, 0xcc},
	{0xb0, 0x18, 0x06, 0xcc},
	{0xb0, 0x19, 0x06, 0xcc},
	{0xb3, 0x5d, 0x18, 0xcc},
	{0xb3, 0x05, 0x00, 0xcc},
	{0xb3, 0x06, 0x00, 0xcc},
	{0x00, 0xb4, 0x0e, 0xaa},
	{0x00, 0xb5, 0x49, 0xaa},
	{0x00, 0xb6, 0x1c, 0xaa},
	{0x00, 0xb7, 0x96, 0xaa},
/* end of usbvm326.inf - start of ms-win trace */
	{0xb6, 0x12, 0xf8, 0xcc},
	{0xb6, 0x13, 0x3d, 0xcc},
/*read b306*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x1a, 0x09, 0xaa},
	{0x00, 0x1b, 0x8a, 0xaa},
/*read b827*/
	{0xb8, 0x27, 0x00, 0xcc},
	{0xb8, 0x26, 0x60, 0xcc},
	{0xb8, 0x26, 0x60, 0xcc},
/*gamma - to do?*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0xae, 0x84, 0xaa},
/*gamma again*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x96, 0xa0, 0xaa},
/*matrix*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x91, 0x35, 0xaa},
	{0x00, 0x92, 0x22, 0xaa},
/*gamma*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x95, 0x85, 0xaa},
/*matrix*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x4d, 0x20, 0xaa},
	{0xb8, 0x22, 0x40, 0xcc},
	{0xb8, 0x23, 0x40, 0xcc},
	{0xb8, 0x24, 0x40, 0xcc},
	{0xb8, 0x81, 0x09, 0xcc},
	{0x00, 0x00, 0x64, 0xdd},
	{0x00, 0x03, 0x01, 0xaa},
/*read 46*/
	{0x00, 0x46, 0x3c, 0xaa},
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0x16, 0x40, 0xaa},
	{0x00, 0x17, 0x40, 0xaa},
	{0x00, 0x18, 0x40, 0xaa},
	{0x00, 0x19, 0x41, 0xaa},
	{0x00, 0x03, 0x01, 0xaa},
	{0x00, 0x46, 0x3c, 0xaa},
	{0x00, 0x00, 0x18, 0xdd},
/*read bfff*/
	{0x00, 0x03, 0x00, 0xaa},
	{0x00, 0xb4, 0x1c, 0xaa},
	{0x00, 0xb5, 0x92, 0xaa},
	{0x00, 0xb6, 0x39, 0xaa},
	{0x00, 0xb7, 0x24, 0xaa},
/*write 89 0400 1415*/
};

2413
struct sensor_info {
2414 2415 2416 2417 2418 2419 2420 2421
	s8 sensorId;
	u8 I2cAdd;
	u8 IdAdd;
	u16 VpId;
	u8 m1;
	u8 m2;
	u8 op;
};
2422

2423
static const struct sensor_info sensor_info_data[] = {
2424
/*      sensorId,         I2cAdd,	IdAdd,  VpId,  m1,    m2,  op */
2425 2426 2427 2428
	{-1,		    0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
	{-1,		    0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
/* (tested in vc032x_probe_sensor) */
/*	{-1,		    0x80 | 0x20, 0x83, 0x0000, 0x24, 0x25, 0x01}, */
2429 2430
	{SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01},
	{SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
2431
/* (tested in vc032x_probe_sensor) */
2432
/*	{SENSOR_MI0360,	    0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
2433 2434 2435 2436 2437 2438 2439 2440 2441
	{SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
	{-1,		    0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
	{-1,		    0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
	{SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
/*	{SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
	{-1,		    0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
/*	{SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
/*	{-1,		    0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05}, */
	{-1,		    0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
2442
	{SENSOR_PO1200,     0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
2443 2444 2445
	{-1,		    0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01},
	{-1,		    0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
	{-1,		    0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
2446 2447
	{SENSOR_MI1320_SOC, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x67, 0x01},
/*fixme: previously detected?*/
2448
	{SENSOR_MI1320,     0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
2449
/*fixme: not in the ms-win probe - may be found before?*/
2450
	{SENSOR_OV7670,     0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
2451 2452
};

2453 2454
/* read 'len' bytes in gspca_dev->usb_buf */
static void reg_r(struct gspca_dev *gspca_dev,
2455 2456 2457
		  u16 req,
		  u16 index,
		  u16 len)
2458
{
2459 2460
	usb_control_msg(gspca_dev->dev,
			usb_rcvctrlpipe(gspca_dev->dev, 0),
2461 2462 2463
			req,
			USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
			1,			/* value */
2464
			index, gspca_dev->usb_buf, len,
2465 2466 2467 2468
			500);
}

static void reg_w(struct usb_device *dev,
2469 2470 2471
			    u16 req,
			    u16 value,
			    u16 index)
2472 2473 2474 2475 2476 2477 2478 2479 2480
{
	usb_control_msg(dev,
			usb_sndctrlpipe(dev, 0),
			req,
			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
			value, index, NULL, 0,
			500);
}

2481 2482
static u16 read_sensor_register(struct gspca_dev *gspca_dev,
				u16 address)
2483
{
2484
	struct usb_device *dev = gspca_dev->dev;
2485
	u8 ldata, mdata, hdata;
2486
	int retry = 50;
2487 2488 2489

	reg_r(gspca_dev, 0xa1, 0xb33f, 1);
	if (!(gspca_dev->usb_buf[0] & 0x02)) {
2490 2491 2492
		PDEBUG(D_ERR, "I2c Bus Busy Wait %02x",
			gspca_dev->usb_buf[0]);
		return 0;
2493 2494 2495 2496
	}
	reg_w(dev, 0xa0, address, 0xb33a);
	reg_w(dev, 0xa0, 0x02, 0xb339);

2497
	do {
2498
		reg_r(gspca_dev, 0xa1, 0xb33b, 1);
2499 2500 2501 2502
		if (gspca_dev->usb_buf[0] == 0x00)
			break;
		msleep(40);
	} while (--retry >= 0);
2503

2504
	reg_r(gspca_dev, 0xa1, 0xb33e, 1);
2505
	ldata = gspca_dev->usb_buf[0];
2506 2507 2508
	reg_r(gspca_dev, 0xa1, 0xb33d, 1);
	mdata = gspca_dev->usb_buf[0];
	reg_r(gspca_dev, 0xa1, 0xb33c, 1);
2509
	hdata = gspca_dev->usb_buf[0];
2510 2511 2512
	if (hdata != 0 && mdata != 0 && ldata != 0)
		PDEBUG(D_PROBE, "Read Sensor %02x%02x %02x",
			hdata, mdata, ldata);
2513 2514
	reg_r(gspca_dev, 0xa1, 0xb334, 1);
	if (gspca_dev->usb_buf[0] == 0x02)
2515 2516
		return (hdata << 8) + mdata;
	return hdata;
2517
}
2518

2519 2520
static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
{
2521
	struct sd *sd = (struct sd *) gspca_dev;
2522 2523
	struct usb_device *dev = gspca_dev->dev;
	int i;
2524
	u16 value;
2525
	const struct sensor_info *ptsensor_info;
2526

2527
/*fixme: should also check the other sensor (back mi1320_soc, front mc501cb)*/
2528
	if (sd->flags & FL_SAMSUNG) {
2529 2530 2531 2532
		reg_w(dev, 0xa0, 0x01, 0xb301);
		reg_w(dev, 0x89, 0xf0ff, 0xffff); /* select the back sensor */
	}

2533
	reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
2534
	PDEBUG(D_PROBE, "check sensor header %02x", gspca_dev->usb_buf[0]);
2535 2536 2537 2538 2539 2540 2541 2542 2543
	for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) {
		ptsensor_info = &sensor_info_data[i];
		reg_w(dev, 0xa0, 0x02, 0xb334);
		reg_w(dev, 0xa0, ptsensor_info->m1, 0xb300);
		reg_w(dev, 0xa0, ptsensor_info->m2, 0xb300);
		reg_w(dev, 0xa0, 0x01, 0xb308);
		reg_w(dev, 0xa0, 0x0c, 0xb309);
		reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
		reg_w(dev, 0xa0, ptsensor_info->op, 0xb301);
2544
		value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd);
2545 2546 2547 2548 2549 2550 2551
		if (value == 0 && ptsensor_info->IdAdd == 0x82)
			value = read_sensor_register(gspca_dev, 0x83);
		if (value != 0) {
			PDEBUG(D_ERR|D_PROBE, "Sensor ID %04x (%d)",
				value, i);
			if (value == ptsensor_info->VpId)
				return ptsensor_info->sensorId;
2552

2553 2554 2555 2556 2557 2558 2559 2560
			switch (value) {
			case 0x7673:
				return SENSOR_OV7670;
			case 0x8243:
				return SENSOR_MI0360;
			}
/*fixme: should return here*/
		}
2561 2562 2563 2564
	}
	return -1;
}

2565
static void i2c_write(struct gspca_dev *gspca_dev,
2566 2567
			u8 reg, const u8 *val,
			u8 size)		/* 1 or 2 */
2568
{
2569
	struct usb_device *dev = gspca_dev->dev;
2570
	int retry;
2571

2572
	reg_r(gspca_dev, 0xa1, 0xb33f, 1);
2573
/*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/
2574 2575
	reg_w(dev, 0xa0, size, 0xb334);
	reg_w(dev, 0xa0, reg, 0xb33a);
2576 2577
	reg_w(dev, 0xa0, val[0], 0xb336);
	if (size > 1)
2578
		reg_w(dev, 0xa0, val[1], 0xb337);
2579
	reg_w(dev, 0xa0, 0x01, 0xb339);
2580 2581 2582 2583 2584 2585 2586 2587 2588
	retry = 4;
	do {
		reg_r(gspca_dev, 0xa1, 0xb33b, 1);
		if (gspca_dev->usb_buf[0] == 0)
			break;
		msleep(20);
	} while (--retry > 0);
	if (retry <= 0)
		PDEBUG(D_ERR, "i2c_write failed");
2589 2590 2591
}

static void put_tab_to_reg(struct gspca_dev *gspca_dev,
2592
			const u8 *tab, u8 tabsize, u16 addr)
2593 2594
{
	int j;
2595
	u16 ad = addr;
2596 2597 2598 2599 2600 2601

	for (j = 0; j < tabsize; j++)
		reg_w(gspca_dev->dev, 0xa0, tab[j], ad++);
}

static void usb_exchange(struct gspca_dev *gspca_dev,
2602
			const u8 data[][4])
2603 2604 2605 2606 2607 2608 2609 2610 2611 2612
{
	struct usb_device *dev = gspca_dev->dev;
	int i = 0;

	for (;;) {
		switch (data[i][3]) {
		default:
			return;
		case 0xcc:			/* normal write */
			reg_w(dev, 0xa0, data[i][2],
2613
					(data[i][0]) << 8 | data[i][1]);
2614 2615
			break;
		case 0xaa:			/* i2c op */
2616
			i2c_write(gspca_dev, data[i][1], &data[i][2], 1);
2617 2618
			break;
		case 0xbb:			/* i2c op */
2619
			i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638
			break;
		case 0xdd:
			msleep(data[i][2] + 10);
			break;
		}
		i++;
	}
	/*not reached*/
}


/* this function is called at probe time */
static int sd_config(struct gspca_dev *gspca_dev,
			const struct usb_device_id *id)
{
	struct sd *sd = (struct sd *) gspca_dev;
	struct usb_device *dev = gspca_dev->dev;
	struct cam *cam;
	int sensor;
2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649
	static u8 npkt[] = {	/* number of packets per ISOC message */
		64,		/* HV7131R 0 */
		32,		/* MI0360 1 */
		32,		/* MI1310_SOC 2 */
		64,		/* MI1320 3 */
		128,		/* MI1320_SOC 4 */
		32,		/* OV7660 5 */
		64,		/* OV7670 6 */
		128,		/* PO1200 7 */
		128,		/* PO3130NC 8 */
	};
2650 2651

	cam = &gspca_dev->cam;
2652
	sd->bridge = id->driver_info >> 8;
2653
	sd->flags = id->driver_info & 0xff;
2654 2655 2656 2657 2658 2659 2660
	sensor = vc032x_probe_sensor(gspca_dev);
	switch (sensor) {
	case -1:
		PDEBUG(D_PROBE, "Unknown sensor...");
		return -EINVAL;
	case SENSOR_HV7131R:
		PDEBUG(D_PROBE, "Find Sensor HV7131R");
2661 2662 2663 2664
		break;
	case SENSOR_MI0360:
		PDEBUG(D_PROBE, "Find Sensor MI0360");
		sd->bridge = BRIDGE_VC0323;
2665 2666 2667 2668 2669 2670 2671
		break;
	case SENSOR_MI1310_SOC:
		PDEBUG(D_PROBE, "Find Sensor MI1310_SOC");
		break;
	case SENSOR_MI1320:
		PDEBUG(D_PROBE, "Find Sensor MI1320");
		break;
2672 2673 2674
	case SENSOR_MI1320_SOC:
		PDEBUG(D_PROBE, "Find Sensor MI1320_SOC");
		break;
2675 2676 2677 2678 2679 2680
	case SENSOR_OV7660:
		PDEBUG(D_PROBE, "Find Sensor OV7660");
		break;
	case SENSOR_OV7670:
		PDEBUG(D_PROBE, "Find Sensor OV7670");
		break;
2681 2682 2683
	case SENSOR_PO1200:
		PDEBUG(D_PROBE, "Find Sensor PO1200");
		break;
2684 2685 2686 2687
	case SENSOR_PO3130NC:
		PDEBUG(D_PROBE, "Find Sensor PO3130NC");
		break;
	}
2688 2689 2690 2691 2692 2693
	sd->sensor = sensor;

	if (sd->bridge == BRIDGE_VC0321) {
		cam->cam_mode = vc0321_mode;
		cam->nmodes = ARRAY_SIZE(vc0321_mode);
	} else {
2694 2695
		switch (sensor) {
		case SENSOR_PO1200:
2696 2697
			cam->cam_mode = svga_mode;
			cam->nmodes = ARRAY_SIZE(svga_mode);
2698 2699 2700
			break;
		case SENSOR_MI1310_SOC:
			cam->cam_mode = vc0323_mode;
2701
			cam->nmodes = ARRAY_SIZE(vc0323_mode);
2702 2703 2704 2705 2706 2707 2708 2709 2710
			break;
		case SENSOR_MI1320_SOC:
			cam->cam_mode = bi_mode;
			cam->nmodes = ARRAY_SIZE(bi_mode);
			break;
		default:
			cam->cam_mode = vc0323_mode;
			cam->nmodes = ARRAY_SIZE(vc0323_mode) - 1;
			break;
2711
		}
2712
	}
2713
	cam->npkt = npkt[sd->sensor];
2714

2715 2716
	sd->hflip = HFLIP_DEF;
	sd->vflip = VFLIP_DEF;
2717 2718
	if (sd->sensor == SENSOR_OV7670)
		sd->flags |= FL_HFLIP | FL_VFLIP;
2719
	sd->lightfreq = FREQ_DEF;
2720 2721
	if (sd->sensor != SENSOR_OV7670)
		gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX);
2722
	switch (sd->sensor) {
2723 2724
	case SENSOR_MI1310_SOC:
	case SENSOR_MI1320_SOC:
2725 2726
	case SENSOR_OV7660:
	case SENSOR_OV7670:
2727
	case SENSOR_PO1200:
2728 2729 2730 2731 2732 2733
		break;
	default:
		gspca_dev->ctrl_dis = (1 << HFLIP_IDX)
					| (1 << VFLIP_IDX);
		break;
	}
2734

2735 2736
	sd->sharpness = SHARPNESS_DEF;

2737
	if (sd->bridge == BRIDGE_VC0321) {
2738
		reg_r(gspca_dev, 0x8a, 0, 3);
2739 2740
		reg_w(dev, 0x87, 0x00, 0x0f0f);

2741
		reg_r(gspca_dev, 0x8b, 0, 3);
2742 2743 2744 2745 2746
		reg_w(dev, 0x88, 0x00, 0x0202);
	}
	return 0;
}

2747
/* this function is called at probe and resume time */
2748
static int sd_init(struct gspca_dev *gspca_dev)
2749 2750 2751 2752
{
	return 0;
}

2753
/* some sensors only */
2754 2755 2756
static void sethvflip(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
2757 2758 2759 2760
	u8 data[2], hflip, vflip;

	hflip = sd->hflip;
	if (sd->flags & FL_HFLIP)
2761
		hflip = !hflip;
2762 2763
	vflip = sd->vflip;
	if (sd->flags & FL_VFLIP)
2764
		vflip = !vflip;
2765
	switch (sd->sensor) {
2766 2767 2768 2769 2770 2771 2772 2773
	case SENSOR_MI1310_SOC:
	case SENSOR_MI1320_SOC:
		data[0] = data[1] = 0;		/* select page 0 */
		i2c_write(gspca_dev, 0xf0, data, 2);
		data[0] = sd->sensor == SENSOR_MI1310_SOC ? 0x03 : 0x01;
		data[1] = 0x02 * hflip
			| 0x01 * vflip;
		i2c_write(gspca_dev, 0x20, data, 2);
2774
		break;
2775
	case SENSOR_OV7660:
2776
	case SENSOR_OV7670:
2777 2778 2779 2780
		data[0] = sd->sensor == SENSOR_OV7660 ? 0x01 : 0x07;
		data[0] |= OV7660_MVFP_MIRROR * hflip
			| OV7660_MVFP_VFLIP * vflip;
		i2c_write(gspca_dev, OV7660_REG_MVFP, data, 1);
2781
		break;
2782
	case SENSOR_PO1200:
2783 2784 2785 2786
		data[0] = 0;
		i2c_write(gspca_dev, 0x03, data, 1);
		data[0] = 0x80 * hflip
			| 0x40 * vflip
2787
			| 0x06;
2788 2789
		i2c_write(gspca_dev, 0x1e, data, 1);
		break;
2790 2791 2792
	}
}

2793 2794 2795
static void setlightfreq(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
2796
	static const u8 (*ov7660_freq_tb[3])[4] =
2797 2798 2799 2800 2801 2802 2803
		{ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};

	if (sd->sensor != SENSOR_OV7660)
		return;
	usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
}

2804 2805 2806 2807
/* po1200 only */
static void setsharpness(struct gspca_dev *gspca_dev)
{
	struct sd *sd = (struct sd *) gspca_dev;
2808
	u8 data;
2809 2810 2811 2812 2813 2814 2815 2816 2817

	if (sd->sensor != SENSOR_PO1200)
		return;
	data = 0;
	i2c_write(gspca_dev, 0x03, &data, 1);
	data = 0xb5 + sd->sharpness * 3;
	i2c_write(gspca_dev, 0x61, &data, 1);
}

2818
static int sd_start(struct gspca_dev *gspca_dev)
2819 2820
{
	struct sd *sd = (struct sd *) gspca_dev;
2821 2822 2823
	const u8 (*init)[4];
	const u8 *GammaT = NULL;
	const u8 *MatrixT = NULL;
2824
	int mode;
2825 2826 2827 2828 2829
	static const u8 (*mi1320_soc_init[])[4] = {
		mi1320_soc_InitSXGA,
		mi1320_soc_InitVGA,
		mi1320_soc_InitQVGA,
	};
2830

2831
/*fixme: back sensor only*/
2832
	if (sd->flags & FL_SAMSUNG) {
2833 2834 2835 2836 2837
		reg_w(gspca_dev->dev, 0x89, 0xf0ff, 0xffff);
		reg_w(gspca_dev->dev, 0xa9, 0x8348, 0x000e);
		reg_w(gspca_dev->dev, 0xa9, 0x0000, 0x001a);
	}

2838 2839 2840 2841 2842 2843
	/* Assume start use the good resolution from gspca_dev->mode */
	if (sd->bridge == BRIDGE_VC0321) {
		reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfec);
		reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfed);
		reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfee);
		reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef);
2844 2845 2846 2847 2848 2849 2850
		sd->image_offset = 46;
	} else {
		if (gspca_dev->cam.cam_mode[gspca_dev->curr_mode].pixelformat
				== V4L2_PIX_FMT_JPEG)
			sd->image_offset = 0;
		else
			sd->image_offset = 32;
2851 2852
	}

2853
	mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
2854 2855 2856 2857
	switch (sd->sensor) {
	case SENSOR_HV7131R:
		GammaT = hv7131r_gamma;
		MatrixT = hv7131r_matrix;
2858 2859 2860 2861
		if (mode)
			init = hv7131r_initQVGA_data;	/* 320x240 */
		else
			init = hv7131r_initVGA_data;	/* 640x480 */
2862 2863 2864 2865
		break;
	case SENSOR_OV7660:
		GammaT = ov7660_gamma;
		MatrixT = ov7660_matrix;
2866 2867 2868 2869
		if (mode)
			init = ov7660_initQVGA_data;	/* 320x240 */
		else
			init = ov7660_initVGA_data;	/* 640x480 */
2870 2871 2872 2873
		break;
	case SENSOR_OV7670:
		/*GammaT = ov7660_gamma; */
		/*MatrixT = ov7660_matrix; */
2874 2875 2876 2877
		if (mode)
			init = ov7670_initQVGA_JPG;	/* 320x240 */
		else
			init = ov7670_initVGA_JPG;	/* 640x480 */
2878
		break;
2879 2880 2881
	case SENSOR_MI0360:
		GammaT = mi1320_gamma;
		MatrixT = mi0360_matrix;
2882 2883 2884 2885
		if (mode)
			init = mi0360_initQVGA_JPG;	/* 320x240 */
		else
			init = mi0360_initVGA_JPG;	/* 640x480 */
2886
		break;
2887
	case SENSOR_MI1310_SOC:
2888
		GammaT = mi1320_gamma;
2889
		MatrixT = mi1320_matrix;
2890 2891 2892 2893 2894 2895 2896 2897
		switch (mode) {
		case 1:
			init = mi1310_socinitQVGA_JPG;	/* 320x240 */
			break;
		case 0:
			init = mi1310_socinitVGA_JPG;	/* 640x480 */
			break;
		default:
2898
			init = mi1310_soc_InitSXGA_JPG;	/* 1280x1024 */
2899
			break;
2900 2901 2902 2903 2904
		}
		break;
	case SENSOR_MI1320:
		GammaT = mi1320_gamma;
		MatrixT = mi1320_matrix;
2905 2906 2907 2908
		if (mode)
			init = mi1320_initQVGA_data;	/* 320x240 */
		else
			init = mi1320_initVGA_data;	/* 640x480 */
2909
		break;
2910 2911 2912
	case SENSOR_MI1320_SOC:
		GammaT = mi1320_gamma;
		MatrixT = mi1320_matrix;
2913
		init = mi1320_soc_init[mode];
2914
		break;
2915 2916 2917
	case SENSOR_PO3130NC:
		GammaT = po3130_gamma;
		MatrixT = po3130_matrix;
2918 2919 2920 2921 2922 2923
		if (mode)
			init = po3130_initQVGA_data;	/* 320x240 */
		else
			init = po3130_initVGA_data;	/* 640x480 */
		usb_exchange(gspca_dev, init);
		init = po3130_rundata;
2924
		break;
2925 2926
	default:
/*	case SENSOR_PO1200: */
2927 2928
		GammaT = po1200_gamma;
		MatrixT = po1200_matrix;
2929
		init = po1200_initVGA_data;
2930
		break;
2931
	}
2932
	usb_exchange(gspca_dev, init);
2933 2934 2935 2936 2937
	if (GammaT && MatrixT) {
		put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
		put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
		put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
		put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
2938

2939
		/* set the led on 0x0892 0x0896 */
2940 2941 2942
		switch (sd->sensor) {
		case SENSOR_PO1200:
		case SENSOR_HV7131R:
2943
			reg_w(gspca_dev->dev, 0x89, 0x0400, 0x1415);
2944 2945
			break;
		case SENSOR_MI1310_SOC:
2946
			reg_w(gspca_dev->dev, 0x89, 0x058c, 0x0000);
2947 2948
			break;
		default:
2949 2950
			if (!(sd->flags & FL_SAMSUNG))
				reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
2951
			break;
2952
		}
2953 2954 2955 2956
		msleep(100);
		setsharpness(gspca_dev);
		sethvflip(gspca_dev);
		setlightfreq(gspca_dev);
2957
	}
2958
	return 0;
2959 2960 2961 2962 2963
}

static void sd_stopN(struct gspca_dev *gspca_dev)
{
	struct usb_device *dev = gspca_dev->dev;
2964
	struct sd *sd = (struct sd *) gspca_dev;
2965

2966
	if (sd->sensor == SENSOR_MI1310_SOC)
2967
		reg_w(dev, 0x89, 0x058c, 0x00ff);
2968
	else if (!(sd->flags & FL_SAMSUNG))
2969
		reg_w(dev, 0x89, 0xffff, 0xffff);
2970 2971 2972 2973
	reg_w(dev, 0xa0, 0x01, 0xb301);
	reg_w(dev, 0xa0, 0x09, 0xb003);
}

2974
/* called on streamoff with alt 0 and on disconnect */
2975 2976 2977
static void sd_stop0(struct gspca_dev *gspca_dev)
{
	struct usb_device *dev = gspca_dev->dev;
2978
	struct sd *sd = (struct sd *) gspca_dev;
2979

2980 2981
	if (!gspca_dev->present)
		return;
2982 2983
/*fixme: is this useful?*/
	if (sd->sensor == SENSOR_MI1310_SOC)
2984
		reg_w(dev, 0x89, 0x058c, 0x00ff);
2985
	else if (!(sd->flags & FL_SAMSUNG))
2986
		reg_w(dev, 0x89, 0xffff, 0xffff);
2987 2988 2989
}

static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2990
			u8 *data,			/* isoc packet */
2991 2992 2993 2994 2995 2996 2997
			int len)			/* iso pkt length */
{
	struct sd *sd = (struct sd *) gspca_dev;

	if (data[0] == 0xff && data[1] == 0xd8) {
		PDEBUG(D_PACK,
			"vc032x header packet found len %d", len);
2998
		gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
2999 3000
		data += sd->image_offset;
		len -= sd->image_offset;
3001
		gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
3002 3003
		return;
	}
3004 3005 3006

	/* The vc0321 sends some additional data after sending the complete
	 * frame, we ignore this. */
3007 3008 3009 3010 3011
	if (sd->bridge == BRIDGE_VC0321) {
		struct gspca_frame *frame;
		int l;

		frame = gspca_get_i_frame(gspca_dev);
3012 3013 3014 3015
		if (frame == NULL) {
			gspca_dev->last_packet_type = DISCARD_PACKET;
			return;
		}
3016 3017 3018 3019 3020
		l = frame->data_end - frame->data;
		if (len > frame->v4l2_buf.length - l)
			len = frame->v4l2_buf.length - l;
	}
	gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
3021 3022
}

3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058
static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	sd->hflip = val;
	if (gspca_dev->streaming)
		sethvflip(gspca_dev);
	return 0;
}

static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	*val = sd->hflip;
	return 0;
}

static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	sd->vflip = val;
	if (gspca_dev->streaming)
		sethvflip(gspca_dev);
	return 0;
}

static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	*val = sd->vflip;
	return 0;
}

3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076
static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	sd->lightfreq = val;
	if (gspca_dev->streaming)
		setlightfreq(gspca_dev);
	return 0;
}

static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	*val = sd->lightfreq;
	return 0;
}

3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094
static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	sd->sharpness = val;
	if (gspca_dev->streaming)
		setsharpness(gspca_dev);
	return 0;
}

static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
{
	struct sd *sd = (struct sd *) gspca_dev;

	*val = sd->sharpness;
	return 0;
}

3095 3096 3097
static int sd_querymenu(struct gspca_dev *gspca_dev,
			struct v4l2_querymenu *menu)
{
3098 3099
	static const char *freq_nm[3] = {"NoFliker", "50 Hz", "60 Hz"};

3100 3101
	switch (menu->id) {
	case V4L2_CID_POWER_LINE_FREQUENCY:
3102 3103
		if (menu->index >= ARRAY_SIZE(freq_nm))
			break;
3104 3105
		strcpy((char *) menu->name, freq_nm[menu->index]);
		return 0;
3106 3107 3108 3109 3110
	}
	return -EINVAL;
}

/* sub-driver description */
3111
static const struct sd_desc sd_desc = {
3112 3113 3114 3115
	.name = MODULE_NAME,
	.ctrls = sd_ctrls,
	.nctrls = ARRAY_SIZE(sd_ctrls),
	.config = sd_config,
3116
	.init = sd_init,
3117 3118 3119 3120 3121 3122 3123 3124
	.start = sd_start,
	.stopN = sd_stopN,
	.stop0 = sd_stop0,
	.pkt_scan = sd_pkt_scan,
	.querymenu = sd_querymenu,
};

/* -- module initialisation -- */
3125 3126 3127
#define BF(bridge, flags) \
	.driver_info = (BRIDGE_ ## bridge << 8) \
		| (flags)
3128
static const __devinitdata struct usb_device_id device_table[] = {
3129
	{USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)},
3130 3131 3132 3133 3134 3135 3136 3137
	{USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)},
	{USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)},
	{USB_DEVICE(0x046d, 0x0897), BF(VC0321, 0)},
	{USB_DEVICE(0x0ac8, 0x0321), BF(VC0321, 0)},
	{USB_DEVICE(0x0ac8, 0x0323), BF(VC0323, 0)},
	{USB_DEVICE(0x0ac8, 0x0328), BF(VC0321, 0)},
	{USB_DEVICE(0x0ac8, 0xc001), BF(VC0321, 0)},
	{USB_DEVICE(0x0ac8, 0xc002), BF(VC0321, 0)},
3138
	{USB_DEVICE(0x0ac8, 0xc301), BF(VC0323, FL_SAMSUNG)},
3139 3140 3141
	{USB_DEVICE(0x15b8, 0x6001), BF(VC0323, 0)},
	{USB_DEVICE(0x15b8, 0x6002), BF(VC0323, 0)},
	{USB_DEVICE(0x17ef, 0x4802), BF(VC0323, 0)},
3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158
	{}
};
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,
3159 3160 3161 3162
#ifdef CONFIG_PM
	.suspend = gspca_suspend,
	.resume = gspca_resume,
#endif
3163 3164 3165 3166 3167
};

/* -- module insert / remove -- */
static int __init sd_mod_init(void)
{
3168
	int ret;
3169

3170 3171
	ret = usb_register(&sd_driver);
	if (ret < 0)
3172
		return ret;
3173
	PDEBUG(D_PROBE, "registered");
3174 3175 3176 3177 3178 3179 3180 3181 3182 3183
	return 0;
}
static void __exit sd_mod_exit(void)
{
	usb_deregister(&sd_driver);
	PDEBUG(D_PROBE, "deregistered");
}

module_init(sd_mod_init);
module_exit(sd_mod_exit);