PageRenderTime 70ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/media/video/gspca/spca501.c

https://bitbucket.org/ndreys/linux-sunxi
C | 2200 lines | 1988 code | 94 blank | 118 comment | 21 complexity | a030ff87c3d8c02f9019a5fc03a8403f MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*
  2. * SPCA501 chip based cameras initialization data
  3. *
  4. * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #define MODULE_NAME "spca501"
  22. #include "gspca.h"
  23. MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
  24. MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
  25. MODULE_LICENSE("GPL");
  26. /* specific webcam descriptor */
  27. struct sd {
  28. struct gspca_dev gspca_dev; /* !! must be the first item */
  29. unsigned short contrast;
  30. __u8 brightness;
  31. __u8 colors;
  32. __u8 blue_balance;
  33. __u8 red_balance;
  34. char subtype;
  35. #define Arowana300KCMOSCamera 0
  36. #define IntelCreateAndShare 1
  37. #define KodakDVC325 2
  38. #define MystFromOriUnknownCamera 3
  39. #define SmileIntlCamera 4
  40. #define ThreeComHomeConnectLite 5
  41. #define ViewQuestM318B 6
  42. };
  43. /* V4L2 controls supported by the driver */
  44. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
  45. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
  46. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
  47. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
  48. static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
  49. static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
  50. static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val);
  51. static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val);
  52. static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val);
  53. static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val);
  54. static const struct ctrl sd_ctrls[] = {
  55. #define MY_BRIGHTNESS 0
  56. {
  57. {
  58. .id = V4L2_CID_BRIGHTNESS,
  59. .type = V4L2_CTRL_TYPE_INTEGER,
  60. .name = "Brightness",
  61. .minimum = 0,
  62. .maximum = 127,
  63. .step = 1,
  64. .default_value = 0,
  65. },
  66. .set = sd_setbrightness,
  67. .get = sd_getbrightness,
  68. },
  69. #define MY_CONTRAST 1
  70. {
  71. {
  72. .id = V4L2_CID_CONTRAST,
  73. .type = V4L2_CTRL_TYPE_INTEGER,
  74. .name = "Contrast",
  75. .minimum = 0,
  76. .maximum = 64725,
  77. .step = 1,
  78. .default_value = 64725,
  79. },
  80. .set = sd_setcontrast,
  81. .get = sd_getcontrast,
  82. },
  83. #define MY_COLOR 2
  84. {
  85. {
  86. .id = V4L2_CID_SATURATION,
  87. .type = V4L2_CTRL_TYPE_INTEGER,
  88. .name = "Color",
  89. .minimum = 0,
  90. .maximum = 63,
  91. .step = 1,
  92. .default_value = 20,
  93. },
  94. .set = sd_setcolors,
  95. .get = sd_getcolors,
  96. },
  97. #define MY_BLUE_BALANCE 3
  98. {
  99. {
  100. .id = V4L2_CID_BLUE_BALANCE,
  101. .type = V4L2_CTRL_TYPE_INTEGER,
  102. .name = "Blue Balance",
  103. .minimum = 0,
  104. .maximum = 127,
  105. .step = 1,
  106. .default_value = 0,
  107. },
  108. .set = sd_setblue_balance,
  109. .get = sd_getblue_balance,
  110. },
  111. #define MY_RED_BALANCE 4
  112. {
  113. {
  114. .id = V4L2_CID_RED_BALANCE,
  115. .type = V4L2_CTRL_TYPE_INTEGER,
  116. .name = "Red Balance",
  117. .minimum = 0,
  118. .maximum = 127,
  119. .step = 1,
  120. .default_value = 0,
  121. },
  122. .set = sd_setred_balance,
  123. .get = sd_getred_balance,
  124. },
  125. };
  126. static const struct v4l2_pix_format vga_mode[] = {
  127. {160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
  128. .bytesperline = 160,
  129. .sizeimage = 160 * 120 * 3 / 2,
  130. .colorspace = V4L2_COLORSPACE_SRGB,
  131. .priv = 2},
  132. {320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
  133. .bytesperline = 320,
  134. .sizeimage = 320 * 240 * 3 / 2,
  135. .colorspace = V4L2_COLORSPACE_SRGB,
  136. .priv = 1},
  137. {640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
  138. .bytesperline = 640,
  139. .sizeimage = 640 * 480 * 3 / 2,
  140. .colorspace = V4L2_COLORSPACE_SRGB,
  141. .priv = 0},
  142. };
  143. #define SPCA50X_REG_USB 0x2 /* spca505 501 */
  144. /*
  145. * Data to initialize a SPCA501. From a capture file provided by Bill Roehl
  146. * With SPCA501 chip description
  147. */
  148. #define CCDSP_SET /* set CCDSP parameters */
  149. #define TG_SET /* set time generator set */
  150. #undef DSPWIN_SET /* set DSP windows parameters */
  151. #undef ALTER_GAMA /* Set alternate set to YUV transform coeffs. */
  152. #define SPCA501_SNAPBIT 0x80
  153. #define SPCA501_SNAPCTRL 0x10
  154. /* Frame packet header offsets for the spca501 */
  155. #define SPCA501_OFFSET_GPIO 1
  156. #define SPCA501_OFFSET_TYPE 2
  157. #define SPCA501_OFFSET_TURN3A 3
  158. #define SPCA501_OFFSET_FRAMSEQ 4
  159. #define SPCA501_OFFSET_COMPRESS 5
  160. #define SPCA501_OFFSET_QUANT 6
  161. #define SPCA501_OFFSET_QUANT2 7
  162. #define SPCA501_OFFSET_DATA 8
  163. #define SPCA501_PROP_COMP_ENABLE(d) ((d) & 1)
  164. #define SPCA501_PROP_SNAP(d) ((d) & 0x40)
  165. #define SPCA501_PROP_SNAP_CTRL(d) ((d) & 0x10)
  166. #define SPCA501_PROP_COMP_THRESH(d) (((d) & 0x0e) >> 1)
  167. #define SPCA501_PROP_COMP_QUANT(d) (((d) & 0x70) >> 4)
  168. /* SPCA501 CCDSP control */
  169. #define SPCA501_REG_CCDSP 0x01
  170. /* SPCA501 control/status registers */
  171. #define SPCA501_REG_CTLRL 0x02
  172. /* registers for color correction and YUV transformation */
  173. #define SPCA501_A11 0x08
  174. #define SPCA501_A12 0x09
  175. #define SPCA501_A13 0x0A
  176. #define SPCA501_A21 0x0B
  177. #define SPCA501_A22 0x0C
  178. #define SPCA501_A23 0x0D
  179. #define SPCA501_A31 0x0E
  180. #define SPCA501_A32 0x0F
  181. #define SPCA501_A33 0x10
  182. /* Data for video camera initialization before capturing */
  183. static const __u16 spca501_open_data[][3] = {
  184. /* bmRequest,value,index */
  185. {0x2, 0x50, 0x00}, /* C/S enable soft reset */
  186. {0x2, 0x40, 0x00}, /* C/S disable soft reset */
  187. {0x2, 0x02, 0x05}, /* C/S general purpose I/O data */
  188. {0x2, 0x03, 0x05}, /* C/S general purpose I/O data */
  189. #ifdef CCDSP_SET
  190. {0x1, 0x38, 0x01}, /* CCDSP options */
  191. {0x1, 0x05, 0x02}, /* CCDSP Optical black level for user settings */
  192. {0x1, 0xC0, 0x03}, /* CCDSP Optical black settings */
  193. {0x1, 0x67, 0x07},
  194. {0x1, 0x63, 0x3f}, /* CCDSP CCD gamma enable */
  195. {0x1, 0x03, 0x56}, /* Add gamma correction */
  196. {0x1, 0xFF, 0x15}, /* CCDSP High luminance for white balance */
  197. {0x1, 0x01, 0x16}, /* CCDSP Low luminance for white balance */
  198. /* Color correction and RGB-to-YUV transformation coefficients changing */
  199. #ifdef ALTER_GAMA
  200. {0x0, 0x00, 0x08}, /* A11 */
  201. {0x0, 0x00, 0x09}, /* A12 */
  202. {0x0, 0x90, 0x0A}, /* A13 */
  203. {0x0, 0x12, 0x0B}, /* A21 */
  204. {0x0, 0x00, 0x0C}, /* A22 */
  205. {0x0, 0x00, 0x0D}, /* A23 */
  206. {0x0, 0x00, 0x0E}, /* A31 */
  207. {0x0, 0x02, 0x0F}, /* A32 */
  208. {0x0, 0x00, 0x10}, /* A33 */
  209. #else
  210. {0x1, 0x2a, 0x08}, /* A11 0x31 */
  211. {0x1, 0xf8, 0x09}, /* A12 f8 */
  212. {0x1, 0xf8, 0x0A}, /* A13 f8 */
  213. {0x1, 0xf8, 0x0B}, /* A21 f8 */
  214. {0x1, 0x14, 0x0C}, /* A22 0x14 */
  215. {0x1, 0xf8, 0x0D}, /* A23 f8 */
  216. {0x1, 0xf8, 0x0E}, /* A31 f8 */
  217. {0x1, 0xf8, 0x0F}, /* A32 f8 */
  218. {0x1, 0x20, 0x10}, /* A33 0x20 */
  219. #endif
  220. {0x1, 0x00, 0x11}, /* R offset */
  221. {0x1, 0x00, 0x12}, /* G offset */
  222. {0x1, 0x00, 0x13}, /* B offset */
  223. {0x1, 0x00, 0x14}, /* GB offset */
  224. #endif
  225. #ifdef TG_SET
  226. /* Time generator manipulations */
  227. {0x0, 0xfc, 0x0}, /* Set up high bits of shutter speed */
  228. {0x0, 0x01, 0x1}, /* Set up low bits of shutter speed */
  229. {0x0, 0xe4, 0x04}, /* DCLK*2 clock phase adjustment */
  230. {0x0, 0x08, 0x05}, /* ADCK phase adjustment, inv. ext. VB */
  231. {0x0, 0x03, 0x06}, /* FR phase adjustment */
  232. {0x0, 0x01, 0x07}, /* FCDS phase adjustment */
  233. {0x0, 0x39, 0x08}, /* FS phase adjustment */
  234. {0x0, 0x88, 0x0a}, /* FH1 phase and delay adjustment */
  235. {0x0, 0x03, 0x0f}, /* pixel identification */
  236. {0x0, 0x00, 0x11}, /* clock source selection (default) */
  237. /*VERY strange manipulations with
  238. * select DMCLP or OBPX to be ADCLP output (0x0C)
  239. * OPB always toggle or not (0x0D) but they allow
  240. * us to set up brightness
  241. */
  242. {0x0, 0x01, 0x0c},
  243. {0x0, 0xe0, 0x0d},
  244. /* Done */
  245. #endif
  246. #ifdef DSPWIN_SET
  247. {0x1, 0xa0, 0x01}, /* Setting image processing parameters */
  248. {0x1, 0x1c, 0x17}, /* Changing Windows positions X1 */
  249. {0x1, 0xe2, 0x19}, /* X2 */
  250. {0x1, 0x1c, 0x1b}, /* X3 */
  251. {0x1, 0xe2, 0x1d}, /* X4 */
  252. {0x1, 0x5f, 0x1f}, /* X5 */
  253. {0x1, 0x32, 0x20}, /* Y5 */
  254. {0x1, 0x01, 0x10}, /* Changing A33 */
  255. #endif
  256. {0x2, 0x204a, 0x07},/* Setting video compression & resolution 160x120 */
  257. {0x2, 0x94, 0x06}, /* Setting video no compression */
  258. {}
  259. };
  260. /*
  261. The SPCAxxx docs from Sunplus document these values
  262. in tables, one table per register number. In the data
  263. below, dmRequest is the register number, index is the Addr,
  264. and value is a combination of Bit values.
  265. Bit Value (hex)
  266. 0 01
  267. 1 02
  268. 2 04
  269. 3 08
  270. 4 10
  271. 5 20
  272. 6 40
  273. 7 80
  274. */
  275. /* Data for chip initialization (set default values) */
  276. static const __u16 spca501_init_data[][3] = {
  277. /* Set all the values to powerup defaults */
  278. /* bmRequest,value,index */
  279. {0x0, 0xAA, 0x00},
  280. {0x0, 0x02, 0x01},
  281. {0x0, 0x01, 0x02},
  282. {0x0, 0x02, 0x03},
  283. {0x0, 0xCE, 0x04},
  284. {0x0, 0x00, 0x05},
  285. {0x0, 0x00, 0x06},
  286. {0x0, 0x00, 0x07},
  287. {0x0, 0x00, 0x08},
  288. {0x0, 0x00, 0x09},
  289. {0x0, 0x90, 0x0A},
  290. {0x0, 0x12, 0x0B},
  291. {0x0, 0x00, 0x0C},
  292. {0x0, 0x00, 0x0D},
  293. {0x0, 0x00, 0x0E},
  294. {0x0, 0x02, 0x0F},
  295. {0x0, 0x00, 0x10},
  296. {0x0, 0x00, 0x11},
  297. {0x0, 0x00, 0x12},
  298. {0x0, 0x00, 0x13},
  299. {0x0, 0x00, 0x14},
  300. {0x0, 0x00, 0x15},
  301. {0x0, 0x00, 0x16},
  302. {0x0, 0x00, 0x17},
  303. {0x0, 0x00, 0x18},
  304. {0x0, 0x00, 0x19},
  305. {0x0, 0x00, 0x1A},
  306. {0x0, 0x00, 0x1B},
  307. {0x0, 0x00, 0x1C},
  308. {0x0, 0x00, 0x1D},
  309. {0x0, 0x00, 0x1E},
  310. {0x0, 0x00, 0x1F},
  311. {0x0, 0x00, 0x20},
  312. {0x0, 0x00, 0x21},
  313. {0x0, 0x00, 0x22},
  314. {0x0, 0x00, 0x23},
  315. {0x0, 0x00, 0x24},
  316. {0x0, 0x00, 0x25},
  317. {0x0, 0x00, 0x26},
  318. {0x0, 0x00, 0x27},
  319. {0x0, 0x00, 0x28},
  320. {0x0, 0x00, 0x29},
  321. {0x0, 0x00, 0x2A},
  322. {0x0, 0x00, 0x2B},
  323. {0x0, 0x00, 0x2C},
  324. {0x0, 0x00, 0x2D},
  325. {0x0, 0x00, 0x2E},
  326. {0x0, 0x00, 0x2F},
  327. {0x0, 0x00, 0x30},
  328. {0x0, 0x00, 0x31},
  329. {0x0, 0x00, 0x32},
  330. {0x0, 0x00, 0x33},
  331. {0x0, 0x00, 0x34},
  332. {0x0, 0x00, 0x35},
  333. {0x0, 0x00, 0x36},
  334. {0x0, 0x00, 0x37},
  335. {0x0, 0x00, 0x38},
  336. {0x0, 0x00, 0x39},
  337. {0x0, 0x00, 0x3A},
  338. {0x0, 0x00, 0x3B},
  339. {0x0, 0x00, 0x3C},
  340. {0x0, 0x00, 0x3D},
  341. {0x0, 0x00, 0x3E},
  342. {0x0, 0x00, 0x3F},
  343. {0x0, 0x00, 0x40},
  344. {0x0, 0x00, 0x41},
  345. {0x0, 0x00, 0x42},
  346. {0x0, 0x00, 0x43},
  347. {0x0, 0x00, 0x44},
  348. {0x0, 0x00, 0x45},
  349. {0x0, 0x00, 0x46},
  350. {0x0, 0x00, 0x47},
  351. {0x0, 0x00, 0x48},
  352. {0x0, 0x00, 0x49},
  353. {0x0, 0x00, 0x4A},
  354. {0x0, 0x00, 0x4B},
  355. {0x0, 0x00, 0x4C},
  356. {0x0, 0x00, 0x4D},
  357. {0x0, 0x00, 0x4E},
  358. {0x0, 0x00, 0x4F},
  359. {0x0, 0x00, 0x50},
  360. {0x0, 0x00, 0x51},
  361. {0x0, 0x00, 0x52},
  362. {0x0, 0x00, 0x53},
  363. {0x0, 0x00, 0x54},
  364. {0x0, 0x00, 0x55},
  365. {0x0, 0x00, 0x56},
  366. {0x0, 0x00, 0x57},
  367. {0x0, 0x00, 0x58},
  368. {0x0, 0x00, 0x59},
  369. {0x0, 0x00, 0x5A},
  370. {0x0, 0x00, 0x5B},
  371. {0x0, 0x00, 0x5C},
  372. {0x0, 0x00, 0x5D},
  373. {0x0, 0x00, 0x5E},
  374. {0x0, 0x00, 0x5F},
  375. {0x0, 0x00, 0x60},
  376. {0x0, 0x00, 0x61},
  377. {0x0, 0x00, 0x62},
  378. {0x0, 0x00, 0x63},
  379. {0x0, 0x00, 0x64},
  380. {0x0, 0x00, 0x65},
  381. {0x0, 0x00, 0x66},
  382. {0x0, 0x00, 0x67},
  383. {0x0, 0x00, 0x68},
  384. {0x0, 0x00, 0x69},
  385. {0x0, 0x00, 0x6A},
  386. {0x0, 0x00, 0x6B},
  387. {0x0, 0x00, 0x6C},
  388. {0x0, 0x00, 0x6D},
  389. {0x0, 0x00, 0x6E},
  390. {0x0, 0x00, 0x6F},
  391. {0x0, 0x00, 0x70},
  392. {0x0, 0x00, 0x71},
  393. {0x0, 0x00, 0x72},
  394. {0x0, 0x00, 0x73},
  395. {0x0, 0x00, 0x74},
  396. {0x0, 0x00, 0x75},
  397. {0x0, 0x00, 0x76},
  398. {0x0, 0x00, 0x77},
  399. {0x0, 0x00, 0x78},
  400. {0x0, 0x00, 0x79},
  401. {0x0, 0x00, 0x7A},
  402. {0x0, 0x00, 0x7B},
  403. {0x0, 0x00, 0x7C},
  404. {0x0, 0x00, 0x7D},
  405. {0x0, 0x00, 0x7E},
  406. {0x0, 0x00, 0x7F},
  407. {0x0, 0x00, 0x80},
  408. {0x0, 0x00, 0x81},
  409. {0x0, 0x00, 0x82},
  410. {0x0, 0x00, 0x83},
  411. {0x0, 0x00, 0x84},
  412. {0x0, 0x00, 0x85},
  413. {0x0, 0x00, 0x86},
  414. {0x0, 0x00, 0x87},
  415. {0x0, 0x00, 0x88},
  416. {0x0, 0x00, 0x89},
  417. {0x0, 0x00, 0x8A},
  418. {0x0, 0x00, 0x8B},
  419. {0x0, 0x00, 0x8C},
  420. {0x0, 0x00, 0x8D},
  421. {0x0, 0x00, 0x8E},
  422. {0x0, 0x00, 0x8F},
  423. {0x0, 0x00, 0x90},
  424. {0x0, 0x00, 0x91},
  425. {0x0, 0x00, 0x92},
  426. {0x0, 0x00, 0x93},
  427. {0x0, 0x00, 0x94},
  428. {0x0, 0x00, 0x95},
  429. {0x0, 0x00, 0x96},
  430. {0x0, 0x00, 0x97},
  431. {0x0, 0x00, 0x98},
  432. {0x0, 0x00, 0x99},
  433. {0x0, 0x00, 0x9A},
  434. {0x0, 0x00, 0x9B},
  435. {0x0, 0x00, 0x9C},
  436. {0x0, 0x00, 0x9D},
  437. {0x0, 0x00, 0x9E},
  438. {0x0, 0x00, 0x9F},
  439. {0x0, 0x00, 0xA0},
  440. {0x0, 0x00, 0xA1},
  441. {0x0, 0x00, 0xA2},
  442. {0x0, 0x00, 0xA3},
  443. {0x0, 0x00, 0xA4},
  444. {0x0, 0x00, 0xA5},
  445. {0x0, 0x00, 0xA6},
  446. {0x0, 0x00, 0xA7},
  447. {0x0, 0x00, 0xA8},
  448. {0x0, 0x00, 0xA9},
  449. {0x0, 0x00, 0xAA},
  450. {0x0, 0x00, 0xAB},
  451. {0x0, 0x00, 0xAC},
  452. {0x0, 0x00, 0xAD},
  453. {0x0, 0x00, 0xAE},
  454. {0x0, 0x00, 0xAF},
  455. {0x0, 0x00, 0xB0},
  456. {0x0, 0x00, 0xB1},
  457. {0x0, 0x00, 0xB2},
  458. {0x0, 0x00, 0xB3},
  459. {0x0, 0x00, 0xB4},
  460. {0x0, 0x00, 0xB5},
  461. {0x0, 0x00, 0xB6},
  462. {0x0, 0x00, 0xB7},
  463. {0x0, 0x00, 0xB8},
  464. {0x0, 0x00, 0xB9},
  465. {0x0, 0x00, 0xBA},
  466. {0x0, 0x00, 0xBB},
  467. {0x0, 0x00, 0xBC},
  468. {0x0, 0x00, 0xBD},
  469. {0x0, 0x00, 0xBE},
  470. {0x0, 0x00, 0xBF},
  471. {0x0, 0x00, 0xC0},
  472. {0x0, 0x00, 0xC1},
  473. {0x0, 0x00, 0xC2},
  474. {0x0, 0x00, 0xC3},
  475. {0x0, 0x00, 0xC4},
  476. {0x0, 0x00, 0xC5},
  477. {0x0, 0x00, 0xC6},
  478. {0x0, 0x00, 0xC7},
  479. {0x0, 0x00, 0xC8},
  480. {0x0, 0x00, 0xC9},
  481. {0x0, 0x00, 0xCA},
  482. {0x0, 0x00, 0xCB},
  483. {0x0, 0x00, 0xCC},
  484. {0x1, 0xF4, 0x00},
  485. {0x1, 0x38, 0x01},
  486. {0x1, 0x40, 0x02},
  487. {0x1, 0x0A, 0x03},
  488. {0x1, 0x40, 0x04},
  489. {0x1, 0x40, 0x05},
  490. {0x1, 0x40, 0x06},
  491. {0x1, 0x67, 0x07},
  492. {0x1, 0x31, 0x08},
  493. {0x1, 0x00, 0x09},
  494. {0x1, 0x00, 0x0A},
  495. {0x1, 0x00, 0x0B},
  496. {0x1, 0x14, 0x0C},
  497. {0x1, 0x00, 0x0D},
  498. {0x1, 0x00, 0x0E},
  499. {0x1, 0x00, 0x0F},
  500. {0x1, 0x1E, 0x10},
  501. {0x1, 0x00, 0x11},
  502. {0x1, 0x00, 0x12},
  503. {0x1, 0x00, 0x13},
  504. {0x1, 0x00, 0x14},
  505. {0x1, 0xFF, 0x15},
  506. {0x1, 0x01, 0x16},
  507. {0x1, 0x32, 0x17},
  508. {0x1, 0x23, 0x18},
  509. {0x1, 0xCE, 0x19},
  510. {0x1, 0x23, 0x1A},
  511. {0x1, 0x32, 0x1B},
  512. {0x1, 0x8D, 0x1C},
  513. {0x1, 0xCE, 0x1D},
  514. {0x1, 0x8D, 0x1E},
  515. {0x1, 0x00, 0x1F},
  516. {0x1, 0x00, 0x20},
  517. {0x1, 0xFF, 0x3E},
  518. {0x1, 0x02, 0x3F},
  519. {0x1, 0x00, 0x40},
  520. {0x1, 0x00, 0x41},
  521. {0x1, 0x00, 0x42},
  522. {0x1, 0x00, 0x43},
  523. {0x1, 0x00, 0x44},
  524. {0x1, 0x00, 0x45},
  525. {0x1, 0x00, 0x46},
  526. {0x1, 0x00, 0x47},
  527. {0x1, 0x00, 0x48},
  528. {0x1, 0x00, 0x49},
  529. {0x1, 0x00, 0x4A},
  530. {0x1, 0x00, 0x4B},
  531. {0x1, 0x00, 0x4C},
  532. {0x1, 0x00, 0x4D},
  533. {0x1, 0x00, 0x4E},
  534. {0x1, 0x00, 0x4F},
  535. {0x1, 0x00, 0x50},
  536. {0x1, 0x00, 0x51},
  537. {0x1, 0x00, 0x52},
  538. {0x1, 0x00, 0x53},
  539. {0x1, 0x00, 0x54},
  540. {0x1, 0x00, 0x55},
  541. {0x1, 0x00, 0x56},
  542. {0x1, 0x00, 0x57},
  543. {0x1, 0x00, 0x58},
  544. {0x1, 0x00, 0x59},
  545. {0x1, 0x00, 0x5A},
  546. {0x2, 0x03, 0x00},
  547. {0x2, 0x00, 0x01},
  548. {0x2, 0x00, 0x05},
  549. {0x2, 0x00, 0x06},
  550. {0x2, 0x00, 0x07},
  551. {0x2, 0x00, 0x10},
  552. {0x2, 0x00, 0x11},
  553. /* Strange - looks like the 501 driver doesn't do anything
  554. * at insert time except read the EEPROM
  555. */
  556. {}
  557. };
  558. /* Data for video camera init before capture.
  559. * Capture and decoding by Colin Peart.
  560. * This is is for the 3com HomeConnect Lite which is spca501a based.
  561. */
  562. static const __u16 spca501_3com_open_data[][3] = {
  563. /* bmRequest,value,index */
  564. {0x2, 0x0050, 0x0000}, /* C/S Enable TG soft reset, timing mode=010 */
  565. {0x2, 0x0043, 0x0000}, /* C/S Disable TG soft reset, timing mode=010 */
  566. {0x2, 0x0002, 0x0005}, /* C/S GPIO */
  567. {0x2, 0x0003, 0x0005}, /* C/S GPIO */
  568. #ifdef CCDSP_SET
  569. {0x1, 0x0020, 0x0001}, /* CCDSP Options */
  570. {0x1, 0x0020, 0x0002}, /* CCDSP Black Level */
  571. {0x1, 0x006e, 0x0007}, /* CCDSP Gamma options */
  572. {0x1, 0x0090, 0x0015}, /* CCDSP Luminance Low */
  573. {0x1, 0x00ff, 0x0016}, /* CCDSP Luminance High */
  574. {0x1, 0x0003, 0x003F}, /* CCDSP Gamma correction toggle */
  575. #ifdef ALTER_GAMMA
  576. {0x1, 0x0010, 0x0008}, /* CCDSP YUV A11 */
  577. {0x1, 0x0000, 0x0009}, /* CCDSP YUV A12 */
  578. {0x1, 0x0000, 0x000a}, /* CCDSP YUV A13 */
  579. {0x1, 0x0000, 0x000b}, /* CCDSP YUV A21 */
  580. {0x1, 0x0010, 0x000c}, /* CCDSP YUV A22 */
  581. {0x1, 0x0000, 0x000d}, /* CCDSP YUV A23 */
  582. {0x1, 0x0000, 0x000e}, /* CCDSP YUV A31 */
  583. {0x1, 0x0000, 0x000f}, /* CCDSP YUV A32 */
  584. {0x1, 0x0010, 0x0010}, /* CCDSP YUV A33 */
  585. {0x1, 0x0000, 0x0011}, /* CCDSP R Offset */
  586. {0x1, 0x0000, 0x0012}, /* CCDSP G Offset */
  587. {0x1, 0x0001, 0x0013}, /* CCDSP B Offset */
  588. {0x1, 0x0001, 0x0014}, /* CCDSP BG Offset */
  589. {0x1, 0x003f, 0x00C1}, /* CCDSP Gamma Correction Enable */
  590. #endif
  591. #endif
  592. #ifdef TG_SET
  593. {0x0, 0x00fc, 0x0000}, /* TG Shutter Speed High Bits */
  594. {0x0, 0x0000, 0x0001}, /* TG Shutter Speed Low Bits */
  595. {0x0, 0x00e4, 0x0004}, /* TG DCLK*2 Adjust */
  596. {0x0, 0x0008, 0x0005}, /* TG ADCK Adjust */
  597. {0x0, 0x0003, 0x0006}, /* TG FR Phase Adjust */
  598. {0x0, 0x0001, 0x0007}, /* TG FCDS Phase Adjust */
  599. {0x0, 0x0039, 0x0008}, /* TG FS Phase Adjust */
  600. {0x0, 0x0088, 0x000a}, /* TG MH1 */
  601. {0x0, 0x0003, 0x000f}, /* TG Pixel ID */
  602. /* Like below, unexplained toglleing */
  603. {0x0, 0x0080, 0x000c},
  604. {0x0, 0x0000, 0x000d},
  605. {0x0, 0x0080, 0x000c},
  606. {0x0, 0x0004, 0x000d},
  607. {0x0, 0x0000, 0x000c},
  608. {0x0, 0x0000, 0x000d},
  609. {0x0, 0x0040, 0x000c},
  610. {0x0, 0x0017, 0x000d},
  611. {0x0, 0x00c0, 0x000c},
  612. {0x0, 0x0000, 0x000d},
  613. {0x0, 0x0080, 0x000c},
  614. {0x0, 0x0006, 0x000d},
  615. {0x0, 0x0080, 0x000c},
  616. {0x0, 0x0004, 0x000d},
  617. {0x0, 0x0002, 0x0003},
  618. #endif
  619. #ifdef DSPWIN_SET
  620. {0x1, 0x001c, 0x0017}, /* CCDSP W1 Start X */
  621. {0x1, 0x00e2, 0x0019}, /* CCDSP W2 Start X */
  622. {0x1, 0x001c, 0x001b}, /* CCDSP W3 Start X */
  623. {0x1, 0x00e2, 0x001d}, /* CCDSP W4 Start X */
  624. {0x1, 0x00aa, 0x001f}, /* CCDSP W5 Start X */
  625. {0x1, 0x0070, 0x0020}, /* CCDSP W5 Start Y */
  626. #endif
  627. {0x0, 0x0001, 0x0010}, /* TG Start Clock */
  628. /* {0x2, 0x006a, 0x0001}, * C/S Enable ISOSYNCH Packet Engine */
  629. {0x2, 0x0068, 0x0001}, /* C/S Diable ISOSYNCH Packet Engine */
  630. {0x2, 0x0000, 0x0005},
  631. {0x2, 0x0043, 0x0000}, /* C/S Set Timing Mode, Disable TG soft reset */
  632. {0x2, 0x0043, 0x0000}, /* C/S Set Timing Mode, Disable TG soft reset */
  633. {0x2, 0x0002, 0x0005}, /* C/S GPIO */
  634. {0x2, 0x0003, 0x0005}, /* C/S GPIO */
  635. {0x2, 0x006a, 0x0001}, /* C/S Enable ISOSYNCH Packet Engine */
  636. {}
  637. };
  638. /*
  639. * Data used to initialize a SPCA501C with HV7131B sensor.
  640. * From a capture file taken with USBSnoop v 1.5
  641. * I have a "SPCA501C pc camera chipset" manual by sunplus, but some
  642. * of the value meanings are obscure or simply "reserved".
  643. * to do list:
  644. * 1) Understand what every value means
  645. * 2) Understand why some values seem to appear more than once
  646. * 3) Write a small comment for each line of the following arrays.
  647. */
  648. static const __u16 spca501c_arowana_open_data[][3] = {
  649. /* bmRequest,value,index */
  650. {0x02, 0x0007, 0x0005},
  651. {0x02, 0xa048, 0x0000},
  652. {0x05, 0x0022, 0x0004},
  653. {0x01, 0x0006, 0x0011},
  654. {0x01, 0x00ff, 0x0012},
  655. {0x01, 0x0014, 0x0013},
  656. {0x01, 0x0000, 0x0014},
  657. {0x01, 0x0042, 0x0051},
  658. {0x01, 0x0040, 0x0052},
  659. {0x01, 0x0051, 0x0053},
  660. {0x01, 0x0040, 0x0054},
  661. {0x01, 0x0000, 0x0055},
  662. {0x00, 0x0025, 0x0000},
  663. {0x00, 0x0026, 0x0000},
  664. {0x00, 0x0001, 0x0000},
  665. {0x00, 0x0027, 0x0000},
  666. {0x00, 0x008a, 0x0000},
  667. {}
  668. };
  669. static const __u16 spca501c_arowana_init_data[][3] = {
  670. /* bmRequest,value,index */
  671. {0x02, 0x0007, 0x0005},
  672. {0x02, 0xa048, 0x0000},
  673. {0x05, 0x0022, 0x0004},
  674. {0x01, 0x0006, 0x0011},
  675. {0x01, 0x00ff, 0x0012},
  676. {0x01, 0x0014, 0x0013},
  677. {0x01, 0x0000, 0x0014},
  678. {0x01, 0x0042, 0x0051},
  679. {0x01, 0x0040, 0x0052},
  680. {0x01, 0x0051, 0x0053},
  681. {0x01, 0x0040, 0x0054},
  682. {0x01, 0x0000, 0x0055},
  683. {0x00, 0x0025, 0x0000},
  684. {0x00, 0x0026, 0x0000},
  685. {0x00, 0x0001, 0x0000},
  686. {0x00, 0x0027, 0x0000},
  687. {0x00, 0x008a, 0x0000},
  688. {0x02, 0x0000, 0x0005},
  689. {0x02, 0x0007, 0x0005},
  690. {0x02, 0x2000, 0x0000},
  691. {0x05, 0x0022, 0x0004},
  692. {0x05, 0x0015, 0x0001},
  693. {0x05, 0x00ea, 0x0000},
  694. {0x05, 0x0021, 0x0001},
  695. {0x05, 0x00d2, 0x0000},
  696. {0x05, 0x0023, 0x0001},
  697. {0x05, 0x0003, 0x0000},
  698. {0x05, 0x0030, 0x0001},
  699. {0x05, 0x002b, 0x0000},
  700. {0x05, 0x0031, 0x0001},
  701. {0x05, 0x0023, 0x0000},
  702. {0x05, 0x0032, 0x0001},
  703. {0x05, 0x0023, 0x0000},
  704. {0x05, 0x0033, 0x0001},
  705. {0x05, 0x0023, 0x0000},
  706. {0x05, 0x0034, 0x0001},
  707. {0x05, 0x0002, 0x0000},
  708. {0x05, 0x0050, 0x0001},
  709. {0x05, 0x0000, 0x0000},
  710. {0x05, 0x0051, 0x0001},
  711. {0x05, 0x0000, 0x0000},
  712. {0x05, 0x0052, 0x0001},
  713. {0x05, 0x0000, 0x0000},
  714. {0x05, 0x0054, 0x0001},
  715. {0x05, 0x0001, 0x0000},
  716. {0x00, 0x0000, 0x0001},
  717. {0x00, 0x0000, 0x0002},
  718. {0x00, 0x000c, 0x0003},
  719. {0x00, 0x0000, 0x0004},
  720. {0x00, 0x0090, 0x0005},
  721. {0x00, 0x0000, 0x0006},
  722. {0x00, 0x0040, 0x0007},
  723. {0x00, 0x00c0, 0x0008},
  724. {0x00, 0x004a, 0x0009},
  725. {0x00, 0x0000, 0x000a},
  726. {0x00, 0x0000, 0x000b},
  727. {0x00, 0x0001, 0x000c},
  728. {0x00, 0x0001, 0x000d},
  729. {0x00, 0x0000, 0x000e},
  730. {0x00, 0x0002, 0x000f},
  731. {0x00, 0x0001, 0x0010},
  732. {0x00, 0x0000, 0x0011},
  733. {0x00, 0x0000, 0x0012},
  734. {0x00, 0x0002, 0x0020},
  735. {0x00, 0x0080, 0x0021},
  736. {0x00, 0x0001, 0x0022},
  737. {0x00, 0x00e0, 0x0023},
  738. {0x00, 0x0000, 0x0024},
  739. {0x00, 0x00d5, 0x0025},
  740. {0x00, 0x0000, 0x0026},
  741. {0x00, 0x000b, 0x0027},
  742. {0x00, 0x0000, 0x0046},
  743. {0x00, 0x0000, 0x0047},
  744. {0x00, 0x0000, 0x0048},
  745. {0x00, 0x0000, 0x0049},
  746. {0x00, 0x0008, 0x004a},
  747. {0xff, 0x0000, 0x00d0},
  748. {0xff, 0x00d8, 0x00d1},
  749. {0xff, 0x0000, 0x00d4},
  750. {0xff, 0x0000, 0x00d5},
  751. {0x01, 0x00a6, 0x0000},
  752. {0x01, 0x0028, 0x0001},
  753. {0x01, 0x0000, 0x0002},
  754. {0x01, 0x000a, 0x0003},
  755. {0x01, 0x0040, 0x0004},
  756. {0x01, 0x0066, 0x0007},
  757. {0x01, 0x0011, 0x0008},
  758. {0x01, 0x0032, 0x0009},
  759. {0x01, 0x00fd, 0x000a},
  760. {0x01, 0x0038, 0x000b},
  761. {0x01, 0x00d1, 0x000c},
  762. {0x01, 0x00f7, 0x000d},
  763. {0x01, 0x00ed, 0x000e},
  764. {0x01, 0x00d8, 0x000f},
  765. {0x01, 0x0038, 0x0010},
  766. {0x01, 0x00ff, 0x0015},
  767. {0x01, 0x0001, 0x0016},
  768. {0x01, 0x0032, 0x0017},
  769. {0x01, 0x0023, 0x0018},
  770. {0x01, 0x00ce, 0x0019},
  771. {0x01, 0x0023, 0x001a},
  772. {0x01, 0x0032, 0x001b},
  773. {0x01, 0x008d, 0x001c},
  774. {0x01, 0x00ce, 0x001d},
  775. {0x01, 0x008d, 0x001e},
  776. {0x01, 0x0000, 0x001f},
  777. {0x01, 0x0000, 0x0020},
  778. {0x01, 0x00ff, 0x003e},
  779. {0x01, 0x0003, 0x003f},
  780. {0x01, 0x0000, 0x0040},
  781. {0x01, 0x0035, 0x0041},
  782. {0x01, 0x0053, 0x0042},
  783. {0x01, 0x0069, 0x0043},
  784. {0x01, 0x007c, 0x0044},
  785. {0x01, 0x008c, 0x0045},
  786. {0x01, 0x009a, 0x0046},
  787. {0x01, 0x00a8, 0x0047},
  788. {0x01, 0x00b4, 0x0048},
  789. {0x01, 0x00bf, 0x0049},
  790. {0x01, 0x00ca, 0x004a},
  791. {0x01, 0x00d4, 0x004b},
  792. {0x01, 0x00dd, 0x004c},
  793. {0x01, 0x00e7, 0x004d},
  794. {0x01, 0x00ef, 0x004e},
  795. {0x01, 0x00f8, 0x004f},
  796. {0x01, 0x00ff, 0x0050},
  797. {0x01, 0x0001, 0x0056},
  798. {0x01, 0x0060, 0x0057},
  799. {0x01, 0x0040, 0x0058},
  800. {0x01, 0x0011, 0x0059},
  801. {0x01, 0x0001, 0x005a},
  802. {0x02, 0x0007, 0x0005},
  803. {0x02, 0xa048, 0x0000},
  804. {0x02, 0x0007, 0x0005},
  805. {0x02, 0x0015, 0x0006},
  806. {0x02, 0x100a, 0x0007},
  807. {0x02, 0xa048, 0x0000},
  808. {0x02, 0xc002, 0x0001},
  809. {0x02, 0x000f, 0x0005},
  810. {0x02, 0xa048, 0x0000},
  811. {0x05, 0x0022, 0x0004},
  812. {0x05, 0x0025, 0x0001},
  813. {0x05, 0x0000, 0x0000},
  814. {0x05, 0x0026, 0x0001},
  815. {0x05, 0x0001, 0x0000},
  816. {0x05, 0x0027, 0x0001},
  817. {0x05, 0x0000, 0x0000},
  818. {0x05, 0x0001, 0x0001},
  819. {0x05, 0x0000, 0x0000},
  820. {0x05, 0x0021, 0x0001},
  821. {0x05, 0x00d2, 0x0000},
  822. {0x05, 0x0020, 0x0001},
  823. {0x05, 0x0000, 0x0000},
  824. {0x00, 0x0090, 0x0005},
  825. {0x01, 0x00a6, 0x0000},
  826. {0x02, 0x0007, 0x0005},
  827. {0x02, 0x2000, 0x0000},
  828. {0x05, 0x0022, 0x0004},
  829. {0x05, 0x0015, 0x0001},
  830. {0x05, 0x00ea, 0x0000},
  831. {0x05, 0x0021, 0x0001},
  832. {0x05, 0x00d2, 0x0000},
  833. {0x05, 0x0023, 0x0001},
  834. {0x05, 0x0003, 0x0000},
  835. {0x05, 0x0030, 0x0001},
  836. {0x05, 0x002b, 0x0000},
  837. {0x05, 0x0031, 0x0001},
  838. {0x05, 0x0023, 0x0000},
  839. {0x05, 0x0032, 0x0001},
  840. {0x05, 0x0023, 0x0000},
  841. {0x05, 0x0033, 0x0001},
  842. {0x05, 0x0023, 0x0000},
  843. {0x05, 0x0034, 0x0001},
  844. {0x05, 0x0002, 0x0000},
  845. {0x05, 0x0050, 0x0001},
  846. {0x05, 0x0000, 0x0000},
  847. {0x05, 0x0051, 0x0001},
  848. {0x05, 0x0000, 0x0000},
  849. {0x05, 0x0052, 0x0001},
  850. {0x05, 0x0000, 0x0000},
  851. {0x05, 0x0054, 0x0001},
  852. {0x05, 0x0001, 0x0000},
  853. {0x00, 0x0000, 0x0001},
  854. {0x00, 0x0000, 0x0002},
  855. {0x00, 0x000c, 0x0003},
  856. {0x00, 0x0000, 0x0004},
  857. {0x00, 0x0090, 0x0005},
  858. {0x00, 0x0000, 0x0006},
  859. {0x00, 0x0040, 0x0007},
  860. {0x00, 0x00c0, 0x0008},
  861. {0x00, 0x004a, 0x0009},
  862. {0x00, 0x0000, 0x000a},
  863. {0x00, 0x0000, 0x000b},
  864. {0x00, 0x0001, 0x000c},
  865. {0x00, 0x0001, 0x000d},
  866. {0x00, 0x0000, 0x000e},
  867. {0x00, 0x0002, 0x000f},
  868. {0x00, 0x0001, 0x0010},
  869. {0x00, 0x0000, 0x0011},
  870. {0x00, 0x0000, 0x0012},
  871. {0x00, 0x0002, 0x0020},
  872. {0x00, 0x0080, 0x0021},
  873. {0x00, 0x0001, 0x0022},
  874. {0x00, 0x00e0, 0x0023},
  875. {0x00, 0x0000, 0x0024},
  876. {0x00, 0x00d5, 0x0025},
  877. {0x00, 0x0000, 0x0026},
  878. {0x00, 0x000b, 0x0027},
  879. {0x00, 0x0000, 0x0046},
  880. {0x00, 0x0000, 0x0047},
  881. {0x00, 0x0000, 0x0048},
  882. {0x00, 0x0000, 0x0049},
  883. {0x00, 0x0008, 0x004a},
  884. {0xff, 0x0000, 0x00d0},
  885. {0xff, 0x00d8, 0x00d1},
  886. {0xff, 0x0000, 0x00d4},
  887. {0xff, 0x0000, 0x00d5},
  888. {0x01, 0x00a6, 0x0000},
  889. {0x01, 0x0028, 0x0001},
  890. {0x01, 0x0000, 0x0002},
  891. {0x01, 0x000a, 0x0003},
  892. {0x01, 0x0040, 0x0004},
  893. {0x01, 0x0066, 0x0007},
  894. {0x01, 0x0011, 0x0008},
  895. {0x01, 0x0032, 0x0009},
  896. {0x01, 0x00fd, 0x000a},
  897. {0x01, 0x0038, 0x000b},
  898. {0x01, 0x00d1, 0x000c},
  899. {0x01, 0x00f7, 0x000d},
  900. {0x01, 0x00ed, 0x000e},
  901. {0x01, 0x00d8, 0x000f},
  902. {0x01, 0x0038, 0x0010},
  903. {0x01, 0x00ff, 0x0015},
  904. {0x01, 0x0001, 0x0016},
  905. {0x01, 0x0032, 0x0017},
  906. {0x01, 0x0023, 0x0018},
  907. {0x01, 0x00ce, 0x0019},
  908. {0x01, 0x0023, 0x001a},
  909. {0x01, 0x0032, 0x001b},
  910. {0x01, 0x008d, 0x001c},
  911. {0x01, 0x00ce, 0x001d},
  912. {0x01, 0x008d, 0x001e},
  913. {0x01, 0x0000, 0x001f},
  914. {0x01, 0x0000, 0x0020},
  915. {0x01, 0x00ff, 0x003e},
  916. {0x01, 0x0003, 0x003f},
  917. {0x01, 0x0000, 0x0040},
  918. {0x01, 0x0035, 0x0041},
  919. {0x01, 0x0053, 0x0042},
  920. {0x01, 0x0069, 0x0043},
  921. {0x01, 0x007c, 0x0044},
  922. {0x01, 0x008c, 0x0045},
  923. {0x01, 0x009a, 0x0046},
  924. {0x01, 0x00a8, 0x0047},
  925. {0x01, 0x00b4, 0x0048},
  926. {0x01, 0x00bf, 0x0049},
  927. {0x01, 0x00ca, 0x004a},
  928. {0x01, 0x00d4, 0x004b},
  929. {0x01, 0x00dd, 0x004c},
  930. {0x01, 0x00e7, 0x004d},
  931. {0x01, 0x00ef, 0x004e},
  932. {0x01, 0x00f8, 0x004f},
  933. {0x01, 0x00ff, 0x0050},
  934. {0x01, 0x0001, 0x0056},
  935. {0x01, 0x0060, 0x0057},
  936. {0x01, 0x0040, 0x0058},
  937. {0x01, 0x0011, 0x0059},
  938. {0x01, 0x0001, 0x005a},
  939. {0x02, 0x0007, 0x0005},
  940. {0x02, 0xa048, 0x0000},
  941. {0x02, 0x0007, 0x0005},
  942. {0x02, 0x0015, 0x0006},
  943. {0x02, 0x100a, 0x0007},
  944. {0x02, 0xa048, 0x0000},
  945. {0x02, 0xc002, 0x0001},
  946. {0x02, 0x000f, 0x0005},
  947. {0x02, 0xa048, 0x0000},
  948. {0x05, 0x0022, 0x0004},
  949. {0x05, 0x0025, 0x0001},
  950. {0x05, 0x0000, 0x0000},
  951. {0x05, 0x0026, 0x0001},
  952. {0x05, 0x0001, 0x0000},
  953. {0x05, 0x0027, 0x0001},
  954. {0x05, 0x0000, 0x0000},
  955. {0x05, 0x0001, 0x0001},
  956. {0x05, 0x0000, 0x0000},
  957. {0x05, 0x0021, 0x0001},
  958. {0x05, 0x00d2, 0x0000},
  959. {0x05, 0x0020, 0x0001},
  960. {0x05, 0x0000, 0x0000},
  961. {0x00, 0x0090, 0x0005},
  962. {0x01, 0x00a6, 0x0000},
  963. {0x01, 0x0003, 0x003f},
  964. {0x01, 0x0001, 0x0056},
  965. {0x01, 0x0011, 0x0008},
  966. {0x01, 0x0032, 0x0009},
  967. {0x01, 0xfffd, 0x000a},
  968. {0x01, 0x0023, 0x000b},
  969. {0x01, 0xffea, 0x000c},
  970. {0x01, 0xfff4, 0x000d},
  971. {0x01, 0xfffc, 0x000e},
  972. {0x01, 0xffe3, 0x000f},
  973. {0x01, 0x001f, 0x0010},
  974. {0x01, 0x00a8, 0x0001},
  975. {0x01, 0x0067, 0x0007},
  976. {0x01, 0x0032, 0x0017},
  977. {0x01, 0x0023, 0x0018},
  978. {0x01, 0x00ce, 0x0019},
  979. {0x01, 0x0023, 0x001a},
  980. {0x01, 0x0032, 0x001b},
  981. {0x01, 0x008d, 0x001c},
  982. {0x01, 0x00ce, 0x001d},
  983. {0x01, 0x008d, 0x001e},
  984. {0x01, 0x00c8, 0x0015},
  985. {0x01, 0x0032, 0x0016},
  986. {0x01, 0x0000, 0x0011},
  987. {0x01, 0x0000, 0x0012},
  988. {0x01, 0x0000, 0x0013},
  989. {0x01, 0x000a, 0x0003},
  990. {0x02, 0xc002, 0x0001},
  991. {0x02, 0x0007, 0x0005},
  992. {0x02, 0xc000, 0x0001},
  993. {0x02, 0x0000, 0x0005},
  994. {0x02, 0x0007, 0x0005},
  995. {0x02, 0x2000, 0x0000},
  996. {0x05, 0x0022, 0x0004},
  997. {0x05, 0x0015, 0x0001},
  998. {0x05, 0x00ea, 0x0000},
  999. {0x05, 0x0021, 0x0001},
  1000. {0x05, 0x00d2, 0x0000},
  1001. {0x05, 0x0023, 0x0001},
  1002. {0x05, 0x0003, 0x0000},
  1003. {0x05, 0x0030, 0x0001},
  1004. {0x05, 0x002b, 0x0000},
  1005. {0x05, 0x0031, 0x0001},
  1006. {0x05, 0x0023, 0x0000},
  1007. {0x05, 0x0032, 0x0001},
  1008. {0x05, 0x0023, 0x0000},
  1009. {0x05, 0x0033, 0x0001},
  1010. {0x05, 0x0023, 0x0000},
  1011. {0x05, 0x0034, 0x0001},
  1012. {0x05, 0x0002, 0x0000},
  1013. {0x05, 0x0050, 0x0001},
  1014. {0x05, 0x0000, 0x0000},
  1015. {0x05, 0x0051, 0x0001},
  1016. {0x05, 0x0000, 0x0000},
  1017. {0x05, 0x0052, 0x0001},
  1018. {0x05, 0x0000, 0x0000},
  1019. {0x05, 0x0054, 0x0001},
  1020. {0x05, 0x0001, 0x0000},
  1021. {0x00, 0x0000, 0x0001},
  1022. {0x00, 0x0000, 0x0002},
  1023. {0x00, 0x000c, 0x0003},
  1024. {0x00, 0x0000, 0x0004},
  1025. {0x00, 0x0090, 0x0005},
  1026. {0x00, 0x0000, 0x0006},
  1027. {0x00, 0x0040, 0x0007},
  1028. {0x00, 0x00c0, 0x0008},
  1029. {0x00, 0x004a, 0x0009},
  1030. {0x00, 0x0000, 0x000a},
  1031. {0x00, 0x0000, 0x000b},
  1032. {0x00, 0x0001, 0x000c},
  1033. {0x00, 0x0001, 0x000d},
  1034. {0x00, 0x0000, 0x000e},
  1035. {0x00, 0x0002, 0x000f},
  1036. {0x00, 0x0001, 0x0010},
  1037. {0x00, 0x0000, 0x0011},
  1038. {0x00, 0x0000, 0x0012},
  1039. {0x00, 0x0002, 0x0020},
  1040. {0x00, 0x0080, 0x0021},
  1041. {0x00, 0x0001, 0x0022},
  1042. {0x00, 0x00e0, 0x0023},
  1043. {0x00, 0x0000, 0x0024},
  1044. {0x00, 0x00d5, 0x0025},
  1045. {0x00, 0x0000, 0x0026},
  1046. {0x00, 0x000b, 0x0027},
  1047. {0x00, 0x0000, 0x0046},
  1048. {0x00, 0x0000, 0x0047},
  1049. {0x00, 0x0000, 0x0048},
  1050. {0x00, 0x0000, 0x0049},
  1051. {0x00, 0x0008, 0x004a},
  1052. {0xff, 0x0000, 0x00d0},
  1053. {0xff, 0x00d8, 0x00d1},
  1054. {0xff, 0x0000, 0x00d4},
  1055. {0xff, 0x0000, 0x00d5},
  1056. {0x01, 0x00a6, 0x0000},
  1057. {0x01, 0x0028, 0x0001},
  1058. {0x01, 0x0000, 0x0002},
  1059. {0x01, 0x000a, 0x0003},
  1060. {0x01, 0x0040, 0x0004},
  1061. {0x01, 0x0066, 0x0007},
  1062. {0x01, 0x0011, 0x0008},
  1063. {0x01, 0x0032, 0x0009},
  1064. {0x01, 0x00fd, 0x000a},
  1065. {0x01, 0x0038, 0x000b},
  1066. {0x01, 0x00d1, 0x000c},
  1067. {0x01, 0x00f7, 0x000d},
  1068. {0x01, 0x00ed, 0x000e},
  1069. {0x01, 0x00d8, 0x000f},
  1070. {0x01, 0x0038, 0x0010},
  1071. {0x01, 0x00ff, 0x0015},
  1072. {0x01, 0x0001, 0x0016},
  1073. {0x01, 0x0032, 0x0017},
  1074. {0x01, 0x0023, 0x0018},
  1075. {0x01, 0x00ce, 0x0019},
  1076. {0x01, 0x0023, 0x001a},
  1077. {0x01, 0x0032, 0x001b},
  1078. {0x01, 0x008d, 0x001c},
  1079. {0x01, 0x00ce, 0x001d},
  1080. {0x01, 0x008d, 0x001e},
  1081. {0x01, 0x0000, 0x001f},
  1082. {0x01, 0x0000, 0x0020},
  1083. {0x01, 0x00ff, 0x003e},
  1084. {0x01, 0x0003, 0x003f},
  1085. {0x01, 0x0000, 0x0040},
  1086. {0x01, 0x0035, 0x0041},
  1087. {0x01, 0x0053, 0x0042},
  1088. {0x01, 0x0069, 0x0043},
  1089. {0x01, 0x007c, 0x0044},
  1090. {0x01, 0x008c, 0x0045},
  1091. {0x01, 0x009a, 0x0046},
  1092. {0x01, 0x00a8, 0x0047},
  1093. {0x01, 0x00b4, 0x0048},
  1094. {0x01, 0x00bf, 0x0049},
  1095. {0x01, 0x00ca, 0x004a},
  1096. {0x01, 0x00d4, 0x004b},
  1097. {0x01, 0x00dd, 0x004c},
  1098. {0x01, 0x00e7, 0x004d},
  1099. {0x01, 0x00ef, 0x004e},
  1100. {0x01, 0x00f8, 0x004f},
  1101. {0x01, 0x00ff, 0x0050},
  1102. {0x01, 0x0001, 0x0056},
  1103. {0x01, 0x0060, 0x0057},
  1104. {0x01, 0x0040, 0x0058},
  1105. {0x01, 0x0011, 0x0059},
  1106. {0x01, 0x0001, 0x005a},
  1107. {0x02, 0x0007, 0x0005},
  1108. {0x02, 0xa048, 0x0000},
  1109. {0x02, 0x0007, 0x0005},
  1110. {0x02, 0x0015, 0x0006},
  1111. {0x02, 0x100a, 0x0007},
  1112. {0x02, 0xa048, 0x0000},
  1113. {0x02, 0xc002, 0x0001},
  1114. {0x02, 0x000f, 0x0005},
  1115. {0x02, 0xa048, 0x0000},
  1116. {0x05, 0x0022, 0x0004},
  1117. {0x05, 0x0025, 0x0001},
  1118. {0x05, 0x0000, 0x0000},
  1119. {0x05, 0x0026, 0x0001},
  1120. {0x05, 0x0001, 0x0000},
  1121. {0x05, 0x0027, 0x0001},
  1122. {0x05, 0x0000, 0x0000},
  1123. {0x05, 0x0001, 0x0001},
  1124. {0x05, 0x0000, 0x0000},
  1125. {0x05, 0x0021, 0x0001},
  1126. {0x05, 0x00d2, 0x0000},
  1127. {0x05, 0x0020, 0x0001},
  1128. {0x05, 0x0000, 0x0000},
  1129. {0x00, 0x0090, 0x0005},
  1130. {0x01, 0x00a6, 0x0000},
  1131. {0x02, 0x0007, 0x0005},
  1132. {0x02, 0x2000, 0x0000},
  1133. {0x05, 0x0022, 0x0004},
  1134. {0x05, 0x0015, 0x0001},
  1135. {0x05, 0x00ea, 0x0000},
  1136. {0x05, 0x0021, 0x0001},
  1137. {0x05, 0x00d2, 0x0000},
  1138. {0x05, 0x0023, 0x0001},
  1139. {0x05, 0x0003, 0x0000},
  1140. {0x05, 0x0030, 0x0001},
  1141. {0x05, 0x002b, 0x0000},
  1142. {0x05, 0x0031, 0x0001},
  1143. {0x05, 0x0023, 0x0000},
  1144. {0x05, 0x0032, 0x0001},
  1145. {0x05, 0x0023, 0x0000},
  1146. {0x05, 0x0033, 0x0001},
  1147. {0x05, 0x0023, 0x0000},
  1148. {0x05, 0x0034, 0x0001},
  1149. {0x05, 0x0002, 0x0000},
  1150. {0x05, 0x0050, 0x0001},
  1151. {0x05, 0x0000, 0x0000},
  1152. {0x05, 0x0051, 0x0001},
  1153. {0x05, 0x0000, 0x0000},
  1154. {0x05, 0x0052, 0x0001},
  1155. {0x05, 0x0000, 0x0000},
  1156. {0x05, 0x0054, 0x0001},
  1157. {0x05, 0x0001, 0x0000},
  1158. {0x00, 0x0000, 0x0001},
  1159. {0x00, 0x0000, 0x0002},
  1160. {0x00, 0x000c, 0x0003},
  1161. {0x00, 0x0000, 0x0004},
  1162. {0x00, 0x0090, 0x0005},
  1163. {0x00, 0x0000, 0x0006},
  1164. {0x00, 0x0040, 0x0007},
  1165. {0x00, 0x00c0, 0x0008},
  1166. {0x00, 0x004a, 0x0009},
  1167. {0x00, 0x0000, 0x000a},
  1168. {0x00, 0x0000, 0x000b},
  1169. {0x00, 0x0001, 0x000c},
  1170. {0x00, 0x0001, 0x000d},
  1171. {0x00, 0x0000, 0x000e},
  1172. {0x00, 0x0002, 0x000f},
  1173. {0x00, 0x0001, 0x0010},
  1174. {0x00, 0x0000, 0x0011},
  1175. {0x00, 0x0000, 0x0012},
  1176. {0x00, 0x0002, 0x0020},
  1177. {0x00, 0x0080, 0x0021},
  1178. {0x00, 0x0001, 0x0022},
  1179. {0x00, 0x00e0, 0x0023},
  1180. {0x00, 0x0000, 0x0024},
  1181. {0x00, 0x00d5, 0x0025},
  1182. {0x00, 0x0000, 0x0026},
  1183. {0x00, 0x000b, 0x0027},
  1184. {0x00, 0x0000, 0x0046},
  1185. {0x00, 0x0000, 0x0047},
  1186. {0x00, 0x0000, 0x0048},
  1187. {0x00, 0x0000, 0x0049},
  1188. {0x00, 0x0008, 0x004a},
  1189. {0xff, 0x0000, 0x00d0},
  1190. {0xff, 0x00d8, 0x00d1},
  1191. {0xff, 0x0000, 0x00d4},
  1192. {0xff, 0x0000, 0x00d5},
  1193. {0x01, 0x00a6, 0x0000},
  1194. {0x01, 0x0028, 0x0001},
  1195. {0x01, 0x0000, 0x0002},
  1196. {0x01, 0x000a, 0x0003},
  1197. {0x01, 0x0040, 0x0004},
  1198. {0x01, 0x0066, 0x0007},
  1199. {0x01, 0x0011, 0x0008},
  1200. {0x01, 0x0032, 0x0009},
  1201. {0x01, 0x00fd, 0x000a},
  1202. {0x01, 0x0038, 0x000b},
  1203. {0x01, 0x00d1, 0x000c},
  1204. {0x01, 0x00f7, 0x000d},
  1205. {0x01, 0x00ed, 0x000e},
  1206. {0x01, 0x00d8, 0x000f},
  1207. {0x01, 0x0038, 0x0010},
  1208. {0x01, 0x00ff, 0x0015},
  1209. {0x01, 0x0001, 0x0016},
  1210. {0x01, 0x0032, 0x0017},
  1211. {0x01, 0x0023, 0x0018},
  1212. {0x01, 0x00ce, 0x0019},
  1213. {0x01, 0x0023, 0x001a},
  1214. {0x01, 0x0032, 0x001b},
  1215. {0x01, 0x008d, 0x001c},
  1216. {0x01, 0x00ce, 0x001d},
  1217. {0x01, 0x008d, 0x001e},
  1218. {0x01, 0x0000, 0x001f},
  1219. {0x01, 0x0000, 0x0020},
  1220. {0x01, 0x00ff, 0x003e},
  1221. {0x01, 0x0003, 0x003f},
  1222. {0x01, 0x0000, 0x0040},
  1223. {0x01, 0x0035, 0x0041},
  1224. {0x01, 0x0053, 0x0042},
  1225. {0x01, 0x0069, 0x0043},
  1226. {0x01, 0x007c, 0x0044},
  1227. {0x01, 0x008c, 0x0045},
  1228. {0x01, 0x009a, 0x0046},
  1229. {0x01, 0x00a8, 0x0047},
  1230. {0x01, 0x00b4, 0x0048},
  1231. {0x01, 0x00bf, 0x0049},
  1232. {0x01, 0x00ca, 0x004a},
  1233. {0x01, 0x00d4, 0x004b},
  1234. {0x01, 0x00dd, 0x004c},
  1235. {0x01, 0x00e7, 0x004d},
  1236. {0x01, 0x00ef, 0x004e},
  1237. {0x01, 0x00f8, 0x004f},
  1238. {0x01, 0x00ff, 0x0050},
  1239. {0x01, 0x0001, 0x0056},
  1240. {0x01, 0x0060, 0x0057},
  1241. {0x01, 0x0040, 0x0058},
  1242. {0x01, 0x0011, 0x0059},
  1243. {0x01, 0x0001, 0x005a},
  1244. {0x02, 0x0007, 0x0005},
  1245. {0x02, 0xa048, 0x0000},
  1246. {0x02, 0x0007, 0x0005},
  1247. {0x02, 0x0015, 0x0006},
  1248. {0x02, 0x100a, 0x0007},
  1249. {0x02, 0xa048, 0x0000},
  1250. {0x02, 0xc002, 0x0001},
  1251. {0x02, 0x000f, 0x0005},
  1252. {0x02, 0xa048, 0x0000},
  1253. {0x05, 0x0022, 0x0004},
  1254. {0x05, 0x0025, 0x0001},
  1255. {0x05, 0x0000, 0x0000},
  1256. {0x05, 0x0026, 0x0001},
  1257. {0x05, 0x0001, 0x0000},
  1258. {0x05, 0x0027, 0x0001},
  1259. {0x05, 0x0000, 0x0000},
  1260. {0x05, 0x0001, 0x0001},
  1261. {0x05, 0x0000, 0x0000},
  1262. {0x05, 0x0021, 0x0001},
  1263. {0x05, 0x00d2, 0x0000},
  1264. {0x05, 0x0020, 0x0001},
  1265. {0x05, 0x0000, 0x0000},
  1266. {0x00, 0x0090, 0x0005},
  1267. {0x01, 0x00a6, 0x0000},
  1268. {0x05, 0x0026, 0x0001},
  1269. {0x05, 0x0001, 0x0000},
  1270. {0x05, 0x0027, 0x0001},
  1271. {0x05, 0x000f, 0x0000},
  1272. {0x01, 0x0003, 0x003f},
  1273. {0x01, 0x0001, 0x0056},
  1274. {0x01, 0x0011, 0x0008},
  1275. {0x01, 0x0032, 0x0009},
  1276. {0x01, 0xfffd, 0x000a},
  1277. {0x01, 0x0023, 0x000b},
  1278. {0x01, 0xffea, 0x000c},
  1279. {0x01, 0xfff4, 0x000d},
  1280. {0x01, 0xfffc, 0x000e},
  1281. {0x01, 0xffe3, 0x000f},
  1282. {0x01, 0x001f, 0x0010},
  1283. {0x01, 0x00a8, 0x0001},
  1284. {0x01, 0x0067, 0x0007},
  1285. {0x01, 0x0042, 0x0051},
  1286. {0x01, 0x0051, 0x0053},
  1287. {0x01, 0x000a, 0x0003},
  1288. {0x02, 0xc002, 0x0001},
  1289. {0x02, 0x0007, 0x0005},
  1290. {0x02, 0xc000, 0x0001},
  1291. {0x02, 0x0000, 0x0005},
  1292. {0x02, 0x0007, 0x0005},
  1293. {0x02, 0x2000, 0x0000},
  1294. {0x05, 0x0022, 0x0004},
  1295. {0x05, 0x0015, 0x0001},
  1296. {0x05, 0x00ea, 0x0000},
  1297. {0x05, 0x0021, 0x0001},
  1298. {0x05, 0x00d2, 0x0000},
  1299. {0x05, 0x0023, 0x0001},
  1300. {0x05, 0x0003, 0x0000},
  1301. {0x05, 0x0030, 0x0001},
  1302. {0x05, 0x002b, 0x0000},
  1303. {0x05, 0x0031, 0x0001},
  1304. {0x05, 0x0023, 0x0000},
  1305. {0x05, 0x0032, 0x0001},
  1306. {0x05, 0x0023, 0x0000},
  1307. {0x05, 0x0033, 0x0001},
  1308. {0x05, 0x0023, 0x0000},
  1309. {0x05, 0x0034, 0x0001},
  1310. {0x05, 0x0002, 0x0000},
  1311. {0x05, 0x0050, 0x0001},
  1312. {0x05, 0x0000, 0x0000},
  1313. {0x05, 0x0051, 0x0001},
  1314. {0x05, 0x0000, 0x0000},
  1315. {0x05, 0x0052, 0x0001},
  1316. {0x05, 0x0000, 0x0000},
  1317. {0x05, 0x0054, 0x0001},
  1318. {0x05, 0x0001, 0x0000},
  1319. {0x00, 0x0000, 0x0001},
  1320. {0x00, 0x0000, 0x0002},
  1321. {0x00, 0x000c, 0x0003},
  1322. {0x00, 0x0000, 0x0004},
  1323. {0x00, 0x0090, 0x0005},
  1324. {0x00, 0x0000, 0x0006},
  1325. {0x00, 0x0040, 0x0007},
  1326. {0x00, 0x00c0, 0x0008},
  1327. {0x00, 0x004a, 0x0009},
  1328. {0x00, 0x0000, 0x000a},
  1329. {0x00, 0x0000, 0x000b},
  1330. {0x00, 0x0001, 0x000c},
  1331. {0x00, 0x0001, 0x000d},
  1332. {0x00, 0x0000, 0x000e},
  1333. {0x00, 0x0002, 0x000f},
  1334. {0x00, 0x0001, 0x0010},
  1335. {0x00, 0x0000, 0x0011},
  1336. {0x00, 0x0000, 0x0012},
  1337. {0x00, 0x0002, 0x0020},
  1338. {0x00, 0x0080, 0x0021},
  1339. {0x00, 0x0001, 0x0022},
  1340. {0x00, 0x00e0, 0x0023},
  1341. {0x00, 0x0000, 0x0024},
  1342. {0x00, 0x00d5, 0x0025},
  1343. {0x00, 0x0000, 0x0026},
  1344. {0x00, 0x000b, 0x0027},
  1345. {0x00, 0x0000, 0x0046},
  1346. {0x00, 0x0000, 0x0047},
  1347. {0x00, 0x0000, 0x0048},
  1348. {0x00, 0x0000, 0x0049},
  1349. {0x00, 0x0008, 0x004a},
  1350. {0xff, 0x0000, 0x00d0},
  1351. {0xff, 0x00d8, 0x00d1},
  1352. {0xff, 0x0000, 0x00d4},
  1353. {0xff, 0x0000, 0x00d5},
  1354. {0x01, 0x00a6, 0x0000},
  1355. {0x01, 0x0028, 0x0001},
  1356. {0x01, 0x0000, 0x0002},
  1357. {0x01, 0x000a, 0x0003},
  1358. {0x01, 0x0040, 0x0004},
  1359. {0x01, 0x0066, 0x0007},
  1360. {0x01, 0x0011, 0x0008},
  1361. {0x01, 0x0032, 0x0009},
  1362. {0x01, 0x00fd, 0x000a},
  1363. {0x01, 0x0038, 0x000b},
  1364. {0x01, 0x00d1, 0x000c},
  1365. {0x01, 0x00f7, 0x000d},
  1366. {0x01, 0x00ed, 0x000e},
  1367. {0x01, 0x00d8, 0x000f},
  1368. {0x01, 0x0038, 0x0010},
  1369. {0x01, 0x00ff, 0x0015},
  1370. {0x01, 0x0001, 0x0016},
  1371. {0x01, 0x0032, 0x0017},
  1372. {0x01, 0x0023, 0x0018},
  1373. {0x01, 0x00ce, 0x0019},
  1374. {0x01, 0x0023, 0x001a},
  1375. {0x01, 0x0032, 0x001b},
  1376. {0x01, 0x008d, 0x001c},
  1377. {0x01, 0x00ce, 0x001d},
  1378. {0x01, 0x008d, 0x001e},
  1379. {0x01, 0x0000, 0x001f},
  1380. {0x01, 0x0000, 0x0020},
  1381. {0x01, 0x00ff, 0x003e},
  1382. {0x01, 0x0003, 0x003f},
  1383. {0x01, 0x0000, 0x0040},
  1384. {0x01, 0x0035, 0x0041},
  1385. {0x01, 0x0053, 0x0042},
  1386. {0x01, 0x0069, 0x0043},
  1387. {0x01, 0x007c, 0x0044},
  1388. {0x01, 0x008c, 0x0045},
  1389. {0x01, 0x009a, 0x0046},
  1390. {0x01, 0x00a8, 0x0047},
  1391. {0x01, 0x00b4, 0x0048},
  1392. {0x01, 0x00bf, 0x0049},
  1393. {0x01, 0x00ca, 0x004a},
  1394. {0x01, 0x00d4, 0x004b},
  1395. {0x01, 0x00dd, 0x004c},
  1396. {0x01, 0x00e7, 0x004d},
  1397. {0x01, 0x00ef, 0x004e},
  1398. {0x01, 0x00f8, 0x004f},
  1399. {0x01, 0x00ff, 0x0050},
  1400. {0x01, 0x0001, 0x0056},
  1401. {0x01, 0x0060, 0x0057},
  1402. {0x01, 0x0040, 0x0058},
  1403. {0x01, 0x0011, 0x0059},
  1404. {0x01, 0x0001, 0x005a},
  1405. {0x02, 0x0007, 0x0005},
  1406. {0x02, 0xa048, 0x0000},
  1407. {0x02, 0x0007, 0x0005},
  1408. {0x02, 0x0015, 0x0006},
  1409. {0x02, 0x100a, 0x0007},
  1410. {0x02, 0xa048, 0x0000},
  1411. {0x02, 0xc002, 0x0001},
  1412. {0x02, 0x000f, 0x0005},
  1413. {0x02, 0xa048, 0x0000},
  1414. {0x05, 0x0022, 0x0004},
  1415. {0x05, 0x0025, 0x0001},
  1416. {0x05, 0x0000, 0x0000},
  1417. {0x05, 0x0026, 0x0001},
  1418. {0x05, 0x0001, 0x0000},
  1419. {0x05, 0x0027, 0x0001},
  1420. {0x05, 0x0000, 0x0000},
  1421. {0x05, 0x0001, 0x0001},
  1422. {0x05, 0x0000, 0x0000},
  1423. {0x05, 0x0021, 0x0001},
  1424. {0x05, 0x00d2, 0x0000},
  1425. {0x05, 0x0020, 0x0001},
  1426. {0x05, 0x0000, 0x0000},
  1427. {0x00, 0x0090, 0x0005},
  1428. {0x01, 0x00a6, 0x0000},
  1429. {0x02, 0x0007, 0x0005},
  1430. {0x02, 0x2000, 0x0000},
  1431. {0x05, 0x0022, 0x0004},
  1432. {0x05, 0x0015, 0x0001},
  1433. {0x05, 0x00ea, 0x0000},
  1434. {0x05, 0x0021, 0x0001},
  1435. {0x05, 0x00d2, 0x0000},
  1436. {0x05, 0x0023, 0x0001},
  1437. {0x05, 0x0003, 0x0000},
  1438. {0x05, 0x0030, 0x0001},
  1439. {0x05, 0x002b, 0x0000},
  1440. {0x05, 0x0031, 0x0001},
  1441. {0x05, 0x0023, 0x0000},
  1442. {0x05, 0x0032, 0x0001},
  1443. {0x05, 0x0023, 0x0000},
  1444. {0x05, 0x0033, 0x0001},
  1445. {0x05, 0x0023, 0x0000},
  1446. {0x05, 0x0034, 0x0001},
  1447. {0x05, 0x0002, 0x0000},
  1448. {0x05, 0x0050, 0x0001},
  1449. {0x05, 0x0000, 0x0000},
  1450. {0x05, 0x0051, 0x0001},
  1451. {0x05, 0x0000, 0x0000},
  1452. {0x05, 0x0052, 0x0001},
  1453. {0x05, 0x0000, 0x0000},
  1454. {0x05, 0x0054, 0x0001},
  1455. {0x05, 0x0001, 0x0000},
  1456. {0x00, 0x0000, 0x0001},
  1457. {0x00, 0x0000, 0x0002},
  1458. {0x00, 0x000c, 0x0003},
  1459. {0x00, 0x0000, 0x0004},
  1460. {0x00, 0x0090, 0x0005},
  1461. {0x00, 0x0000, 0x0006},
  1462. {0x00, 0x0040, 0x0007},
  1463. {0x00, 0x00c0, 0x0008},
  1464. {0x00, 0x004a, 0x0009},
  1465. {0x00, 0x0000, 0x000a},
  1466. {0x00, 0x0000, 0x000b},
  1467. {0x00, 0x0001, 0x000c},
  1468. {0x00, 0x0001, 0x000d},
  1469. {0x00, 0x0000, 0x000e},
  1470. {0x00, 0x0002, 0x000f},
  1471. {0x00, 0x0001, 0x0010},
  1472. {0x00, 0x0000, 0x0011},
  1473. {0x00, 0x0000, 0x0012},
  1474. {0x00, 0x0002, 0x0020},
  1475. {0x00, 0x0080, 0x0021},
  1476. {0x00, 0x0001, 0x0022},
  1477. {0x00, 0x00e0, 0x0023},
  1478. {0x00, 0x0000, 0x0024},
  1479. {0x00, 0x00d5, 0x0025},
  1480. {0x00, 0x0000, 0x0026},
  1481. {0x00, 0x000b, 0x0027},
  1482. {0x00, 0x0000, 0x0046},
  1483. {0x00, 0x0000, 0x0047},
  1484. {0x00, 0x0000, 0x0048},
  1485. {0x00, 0x0000, 0x0049},
  1486. {0x00, 0x0008, 0x004a},
  1487. {0xff, 0x0000, 0x00d0},
  1488. {0xff, 0x00d8, 0x00d1},
  1489. {0xff, 0x0000, 0x00d4},
  1490. {0xff, 0x0000, 0x00d5},
  1491. {0x01, 0x00a6, 0x0000},
  1492. {0x01, 0x0028, 0x0001},
  1493. {0x01, 0x0000, 0x0002},
  1494. {0x01, 0x000a, 0x0003},
  1495. {0x01, 0x0040, 0x0004},
  1496. {0x01, 0x0066, 0x0007},
  1497. {0x01, 0x0011, 0x0008},
  1498. {0x01, 0x0032, 0x0009},
  1499. {0x01, 0x00fd, 0x000a},
  1500. {0x01, 0x0038, 0x000b},
  1501. {0x01, 0x00d1, 0x000c},
  1502. {0x01, 0x00f7, 0x000d},
  1503. {0x01, 0x00ed, 0x000e},
  1504. {0x01, 0x00d8, 0x000f},
  1505. {0x01, 0x0038, 0x0010},
  1506. {0x01, 0x00ff, 0x0015},
  1507. {0x01, 0x0001, 0x0016},
  1508. {0x01, 0x0032, 0x0017},
  1509. {0x01, 0x0023, 0x0018},
  1510. {0x01, 0x00ce, 0x0019},
  1511. {0x01, 0x0023, 0x001a},
  1512. {0x01, 0x0032, 0x001b},
  1513. {0x01, 0x008d, 0x001c},
  1514. {0x01, 0x00ce, 0x001d},
  1515. {0x01, 0x008d, 0x001e},
  1516. {0x01, 0x0000, 0x001f},
  1517. {0x01, 0x0000, 0x0020},
  1518. {0x01, 0x00ff, 0x003e},
  1519. {0x01, 0x0003, 0x003f},
  1520. {0x01, 0x0000, 0x0040},
  1521. {0x01, 0x0035, 0x0041},
  1522. {0x01, 0x0053, 0x0042},
  1523. {0x01, 0x0069, 0x0043},
  1524. {0x01, 0x007c, 0x0044},
  1525. {0x01, 0x008c, 0x0045},
  1526. {0x01, 0x009a, 0x0046},
  1527. {0x01, 0x00a8, 0x0047},
  1528. {0x01, 0x00b4, 0x0048},
  1529. {0x01, 0x00bf, 0x0049},
  1530. {0x01, 0x00ca, 0x004a},
  1531. {0x01, 0x00d4, 0x004b},
  1532. {0x01, 0x00dd, 0x004c},
  1533. {0x01, 0x00e7, 0x004d},
  1534. {0x01, 0x00ef, 0x004e},
  1535. {0x01, 0x00f8, 0x004f},
  1536. {0x01, 0x00ff, 0x0050},
  1537. {0x01, 0x0001, 0x0056},
  1538. {0x01, 0x0060, 0x0057},
  1539. {0x01, 0x0040, 0x0058},
  1540. {0x01, 0x0011, 0x0059},
  1541. {0x01, 0x0001, 0x005a},
  1542. {0x02, 0x0007, 0x0005},
  1543. {0x02, 0xa048, 0x0000},
  1544. {0x02, 0x0007, 0x0005},
  1545. {0x02, 0x0015, 0x0006},
  1546. {0x02, 0x100a, 0x0007},
  1547. {0x02, 0xa048, 0x0000},
  1548. {0x02, 0xc002, 0x0001},
  1549. {0x02, 0x000f, 0x0005},
  1550. {0x02, 0xa048, 0x0000},
  1551. {0x05, 0x0022, 0x0004},
  1552. {0x05, 0x0025, 0x0001},
  1553. {0x05, 0x0000, 0x0000},
  1554. {0x05, 0x0026, 0x0001},
  1555. {0x05, 0x0001, 0x0000},
  1556. {0x05, 0x0027, 0x0001},
  1557. {0x05, 0x0000, 0x0000},
  1558. {0x05, 0x0001, 0x0001},
  1559. {0x05, 0x0000, 0x0000},
  1560. {0x05, 0x0021, 0x0001},
  1561. {0x05, 0x00d2, 0x0000},
  1562. {0x05, 0x0020, 0x0001},
  1563. {0x05, 0x0000, 0x0000},
  1564. {0x00, 0x0090, 0x0005},
  1565. {0x01, 0x00a6, 0x0000},
  1566. {0x05, 0x0026, 0x0001},
  1567. {0x05, 0x0001, 0x0000},
  1568. {0x05, 0x0027, 0x0001},
  1569. {0x05, 0x001e, 0x0000},
  1570. {0x01, 0x0003, 0x003f},
  1571. {0x01, 0x0001, 0x0056},
  1572. {0x01, 0x0011, 0x0008},
  1573. {0x01, 0x0032, 0x0009},
  1574. {0x01, 0xfffd, 0x000a},
  1575. {0x01, 0x0023, 0x000b},
  1576. {0x01, 0xffea, 0x000c},
  1577. {0x01, 0xfff4, 0x000d},
  1578. {0x01, 0xfffc, 0x000e},
  1579. {0x01, 0xffe3, 0x000f},
  1580. {0x01, 0x001f, 0x0010},
  1581. {0x01, 0x00a8, 0x0001},
  1582. {0x01, 0x0067, 0x0007},
  1583. {0x01, 0x0042, 0x0051},
  1584. {0x01, 0x0051, 0x0053},
  1585. {0x01, 0x000a, 0x0003},
  1586. {0x02, 0xc002, 0x0001},
  1587. {0x02, 0x0007, 0x0005},
  1588. {0x01, 0x0042, 0x0051},
  1589. {0x01, 0x0051, 0x0053},
  1590. {0x05, 0x0026, 0x0001},
  1591. {0x05, 0x0001, 0x0000},
  1592. {0x05, 0x0027, 0x0001},
  1593. {0x05, 0x002d, 0x0000},
  1594. {0x01, 0x0003, 0x003f},
  1595. {0x01, 0x0001, 0x0056},
  1596. {0x02, 0xc000, 0x0001},
  1597. {0x02, 0x0000, 0x0005},
  1598. {}
  1599. };
  1600. /* Unknown camera from Ori Usbid 0x0000:0x0000 */
  1601. /* Based on snoops from Ori Cohen */
  1602. static const __u16 spca501c_mysterious_open_data[][3] = {
  1603. {0x02, 0x000f, 0x0005},
  1604. {0x02, 0xa048, 0x0000},
  1605. {0x05, 0x0022, 0x0004},
  1606. /* DSP Registers */
  1607. {0x01, 0x0016, 0x0011}, /* RGB offset */
  1608. {0x01, 0x0000, 0x0012},
  1609. {0x01, 0x0006, 0x0013},
  1610. {0x01, 0x0078, 0x0051},
  1611. {0x01, 0x0040, 0x0052},
  1612. {0x01, 0x0046, 0x0053},
  1613. {0x01, 0x0040, 0x0054},
  1614. {0x00, 0x0025, 0x0000},
  1615. /* {0x00, 0x0000, 0x0000 }, */
  1616. /* Part 2 */
  1617. /* TG Registers */
  1618. {0x00, 0x0026, 0x0000},
  1619. {0x00, 0x0001, 0x0000},
  1620. {0x00, 0x0027, 0x0000},
  1621. {0x00, 0x008a, 0x0000},
  1622. {0x02, 0x0007, 0x0005},
  1623. {0x02, 0x2000, 0x0000},
  1624. {0x05, 0x0022, 0x0004},
  1625. {0x05, 0x0015, 0x0001},
  1626. {0x05, 0x00ea, 0x0000},
  1627. {0x05, 0x0021, 0x0001},
  1628. {0x05, 0x00d2, 0x0000},
  1629. {0x05, 0x0023, 0x0001},
  1630. {0x05, 0x0003, 0x0000},
  1631. {0x05, 0x0030, 0x0001},
  1632. {0x05, 0x002b, 0x0000},
  1633. {0x05, 0x0031, 0x0001},
  1634. {0x05, 0x0023, 0x0000},
  1635. {0x05, 0x0032, 0x0001},
  1636. {0x05, 0x0023, 0x0000},
  1637. {0x05, 0x0033, 0x0001},
  1638. {0x05, 0x0023, 0x0000},
  1639. {0x05, 0x0034, 0x0001},
  1640. {0x05, 0x0002, 0x0000},
  1641. {0x05, 0x0050, 0x0001},
  1642. {0x05, 0x0000, 0x0000},
  1643. {0x05, 0x0051, 0x0001},
  1644. {0x05, 0x0000, 0x0000},
  1645. {0x05, 0x0052, 0x0001},
  1646. {0x05, 0x0000, 0x0000},
  1647. {0x05, 0x0054, 0x0001},
  1648. {0x05, 0x0001, 0x0000},
  1649. {}
  1650. };
  1651. /* Based on snoops from Ori Cohen */
  1652. static const __u16 spca501c_mysterious_init_data[][3] = {
  1653. /* Part 3 */
  1654. /* TG registers */
  1655. /* {0x00, 0x0000, 0x0000}, */
  1656. {0x00, 0x0000, 0x0001},
  1657. {0x00, 0x0000, 0x0002},
  1658. {0x00, 0x0006, 0x0003},
  1659. {0x00, 0x0000, 0x0004},
  1660. {0x00, 0x0090, 0x0005},
  1661. {0x00, 0x0000, 0x0006},
  1662. {0x00, 0x0040, 0x0007},
  1663. {0x00, 0x00c0, 0x0008},
  1664. {0x00, 0x004a, 0x0009},
  1665. {0x00, 0x0000, 0x000a},
  1666. {0x00, 0x0000, 0x000b},
  1667. {0x00, 0x0001, 0x000c},
  1668. {0x00, 0x0001, 0x000d},
  1669. {0x00, 0x0000, 0x000e},
  1670. {0x00, 0x0002, 0x000f},
  1671. {0x00, 0x0001, 0x0010},
  1672. {0x00, 0x0000, 0x0011},
  1673. {0x00, 0x0001, 0x0012},
  1674. {0x00, 0x0002, 0x0020},
  1675. {0x00, 0x0080, 0x0021}, /* 640 */
  1676. {0x00, 0x0001, 0x0022},
  1677. {0x00, 0x00e0, 0x0023}, /* 480 */
  1678. {0x00, 0x0000, 0x0024}, /* Offset H hight */
  1679. {0x00, 0x00d3, 0x0025}, /* low */
  1680. {0x00, 0x0000, 0x0026}, /* Offset V */
  1681. {0x00, 0x000d, 0x0027}, /* low */
  1682. {0x00, 0x0000, 0x0046},
  1683. {0x00, 0x0000, 0x0047},
  1684. {0x00, 0x0000, 0x0048},
  1685. {0x00, 0x0000, 0x0049},
  1686. {0x00, 0x0008, 0x004a},
  1687. /* DSP Registers */
  1688. {0x01, 0x00a6, 0x0000},
  1689. {0x01, 0x0028, 0x0001},
  1690. {0x01, 0x0000, 0x0002},
  1691. {0x01, 0x000a, 0x0003}, /* Level Calc bit7 ->1 Auto */
  1692. {0x01, 0x0040, 0x0004},
  1693. {0x01, 0x0066, 0x0007},
  1694. {0x01, 0x000f, 0x0008}, /* A11 Color correction coeff */
  1695. {0x01, 0x002d, 0x0009}, /* A12 */
  1696. {0x01, 0x0005, 0x000a}, /* A13 */
  1697. {0x01, 0x0023, 0x000b}, /* A21 */
  1698. {0x01, 0x00e0, 0x000c}, /* A22 */
  1699. {0x01, 0x00fd, 0x000d}, /* A23 */
  1700. {0x01, 0x00f4, 0x000e}, /* A31 */
  1701. {0x01, 0x00e4, 0x000f}, /* A32 */
  1702. {0x01, 0x0028, 0x0010}, /* A33 */
  1703. {0x01, 0x00ff, 0x0015}, /* Reserved */
  1704. {0x01, 0x0001, 0x0016}, /* Reserved */
  1705. {0x01, 0x0032, 0x0017}, /* Win1 Start begin */
  1706. {0x01, 0x0023, 0x0018},
  1707. {0x01, 0x00ce, 0x0019},
  1708. {0x01, 0x0023, 0x001a},
  1709. {0x01, 0x0032, 0x001b},
  1710. {0x01, 0x008d, 0x001c},
  1711. {0x01, 0x00ce, 0x001d},
  1712. {0x01, 0x008d, 0x001e},
  1713. {0x01, 0x0000, 0x001f},
  1714. {0x01, 0x0000, 0x0020}, /* Win1 Start end */
  1715. {0x01, 0x00ff, 0x003e}, /* Reserved begin */
  1716. {0x01, 0x0002, 0x003f},
  1717. {0x01, 0x0000, 0x0040},
  1718. {0x01, 0x0035, 0x0041},
  1719. {0x01, 0x0053, 0x0042},
  1720. {0x01, 0x0069, 0x0043},
  1721. {0x01, 0x007c, 0x0044},
  1722. {0x01, 0x008c, 0x0045},
  1723. {0x01, 0x009a, 0x0046},
  1724. {0x01, 0x00a8, 0x0047},
  1725. {0x01, 0x00b4, 0x0048},
  1726. {0x01, 0x00bf, 0x0049},
  1727. {0x01, 0x00ca, 0x004a},
  1728. {0x01, 0x00d4, 0x004b},
  1729. {0x01, 0x00dd, 0x004c},
  1730. {0x01, 0x00e7, 0x004d},
  1731. {0x01, 0x00ef, 0x004e},
  1732. {0x01, 0x00f8, 0x004f},
  1733. {0x01, 0x00ff, 0x0050},
  1734. {0x01, 0x0003, 0x0056}, /* Reserved end */
  1735. {0x01, 0x0060, 0x0057}, /* Edge Gain */
  1736. {0x01, 0x0040, 0x0058},
  1737. {0x01, 0x0011, 0x0059}, /* Edge Bandwidth */
  1738. {0x01, 0x0001, 0x005a},
  1739. {0x02, 0x0007, 0x0005},
  1740. {0x02, 0xa048, 0x0000},
  1741. {0x02, 0x0007, 0x0005},
  1742. {0x02, 0x0015, 0x0006},
  1743. {0x02, 0x200a, 0x0007},
  1744. {0x02, 0xa048, 0x0000},
  1745. {0x02, 0xc000, 0x0001},
  1746. {0x02, 0x000f, 0x0005},
  1747. {0x02, 0xa048, 0x0000},
  1748. {0x05, 0x0022, 0x0004},
  1749. {0x05, 0x0025, 0x0001},
  1750. {0x05, 0x0000, 0x0000},
  1751. /* Part 4 */
  1752. {0x05, 0x0026, 0x0001},
  1753. {0x05, 0x0001, 0x0000},
  1754. {0x05, 0x0027, 0x0001},
  1755. {0x05, 0x0000, 0x0000},
  1756. {0x05, 0x0001, 0x0001},
  1757. {0x05, 0x0000, 0x0000},
  1758. {0x05, 0x0021, 0x0001},
  1759. {0x05, 0x00d2, 0x0000},
  1760. {0x05, 0x0020, 0x0001},
  1761. {0x05, 0x0000, 0x0000},
  1762. {0x00, 0x0090, 0x0005},
  1763. {0x01, 0x00a6, 0x0000},
  1764. {0x02, 0x0000, 0x0005},
  1765. {0x05, 0x0026, 0x0001},
  1766. {0x05, 0x0001, 0x0000},
  1767. {0x05, 0x0027, 0x0001},
  1768. {0x05, 0x004e, 0x0000},
  1769. /* Part 5 */
  1770. {0x01, 0x0003, 0x003f},
  1771. {0x01, 0x0001, 0x0056},
  1772. {0x01, 0x000f, 0x0008},
  1773. {0x01, 0x002d, 0x0009},
  1774. {0x01, 0x0005, 0x000a},
  1775. {0x01, 0x0023, 0x000b},
  1776. {0x01, 0xffe0, 0x000c},
  1777. {0x01, 0xfffd, 0x000d},
  1778. {0x01, 0xfff4, 0x000e},
  1779. {0x01, 0xffe4, 0x000f},
  1780. {0x01, 0x0028, 0x0010},
  1781. {0x01, 0x00a8, 0x0001},
  1782. {0x01, 0x0066, 0x0007},
  1783. {0x01, 0x0032, 0x0017},
  1784. {0x01, 0x0023, 0x0018},
  1785. {0x01, 0x00ce, 0x0019},
  1786. {0x01, 0x0023, 0x001a},
  1787. {0x01, 0x0032, 0x001b},
  1788. {0x01, 0x008d, 0x001c},
  1789. {0x01, 0x00ce, 0x001d},
  1790. {0x01, 0x008d, 0x001e},
  1791. {0x01, 0x00c8, 0x0015}, /* c8 Poids fort Luma */
  1792. {0x01, 0x0032, 0x0016}, /* 32 */
  1793. {0x01, 0x0016, 0x0011}, /* R 00 */
  1794. {0x01, 0x0016, 0x0012}, /* G 00 */
  1795. {0x01, 0x0016, 0x0013}, /* B 00 */
  1796. {0x01, 0x000a, 0x0003},
  1797. {0x02, 0xc002, 0x0001},
  1798. {0x02, 0x0007, 0x0005},
  1799. {}
  1800. };
  1801. static int reg_write(struct usb_device *dev,
  1802. __u16 req, __u16 index, __u16 value)
  1803. {
  1804. int ret;
  1805. ret = usb_control_msg(dev,
  1806. usb_sndctrlpipe(dev, 0),
  1807. req,
  1808. USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  1809. value, index, NULL, 0, 500);
  1810. PDEBUG(D_USBO, "reg write: 0x%02x 0x%02x 0x%02x",
  1811. req, index, value);
  1812. if (ret < 0)
  1813. err("reg write: error %d", ret);
  1814. return ret;
  1815. }
  1816. static int write_vector(struct gspca_dev *gspca_dev,
  1817. const __u16 data[][3])
  1818. {
  1819. struct usb_device *dev = gspca_dev->dev;
  1820. int ret, i = 0;
  1821. while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) {
  1822. ret = reg_write(dev, data[i][0], data[i][2], data[i][1]);
  1823. if (ret < 0) {
  1824. PDEBUG(D_ERR,
  1825. "Reg write failed for 0x%02x,0x%02x,0x%02x",
  1826. data[i][0], data[i][1], data[i][2]);
  1827. return ret;
  1828. }
  1829. i++;
  1830. }
  1831. return 0;
  1832. }
  1833. static void setbrightness(struct gspca_dev *gspca_dev)
  1834. {
  1835. struct sd *sd = (struct sd *) gspca_dev;
  1836. reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x12, sd->brightness);
  1837. }
  1838. static void setcontrast(struct gspca_dev *gspca_dev)
  1839. {
  1840. struct sd *sd = (struct sd *) gspca_dev;
  1841. reg_write(gspca_dev->dev, 0x00, 0x00,
  1842. (sd->contrast >> 8) & 0xff);
  1843. reg_write(gspca_dev->dev, 0x00, 0x01,
  1844. sd->contrast & 0xff);
  1845. }
  1846. static void setcolors(struct gspca_dev *gspca_dev)
  1847. {
  1848. struct sd *sd = (struct sd *) gspca_dev;
  1849. reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x0c, sd->colors);
  1850. }
  1851. static void setblue_balance(struct gspca_dev *gspca_dev)
  1852. {
  1853. struct sd *sd = (struct sd *) gspca_dev;
  1854. reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x11, sd->blue_balance);
  1855. }
  1856. static void setred_balance(struct gspca_dev *gspca_dev)
  1857. {
  1858. struct sd *sd = (struct sd *) gspca_dev;
  1859. reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x13, sd->red_balance);
  1860. }
  1861. /* this function is called at probe time */
  1862. static int sd_config(struct gspca_dev *gspca_dev,
  1863. const struct usb_device_id *id)
  1864. {
  1865. struct sd *sd = (struct sd *) gspca_dev;
  1866. struct cam *cam;
  1867. cam = &gspca_dev->cam;
  1868. cam->cam_mode = vga_mode;
  1869. cam->nmodes = ARRAY_SIZE(vga_mode);
  1870. sd->subtype = id->driver_info;
  1871. sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value;
  1872. sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value;
  1873. sd->colors = sd_ctrls[MY_COLOR].qctrl.default_value;
  1874. return 0;
  1875. }
  1876. /* this function is called at probe and resume time */
  1877. static int sd_init(struct gspca_dev *gspca_dev)
  1878. {
  1879. struct sd *sd = (struct sd *) gspca_dev;
  1880. switch (sd->subtype) {
  1881. case Arowana300KCMOSCamera:
  1882. case SmileIntlCamera:
  1883. /* Arowana 300k CMOS Camera data */
  1884. if (write_vector(gspca_dev, spca501c_arowana_init_data))
  1885. goto error;
  1886. break;
  1887. case MystFromOriUnknownCamera:
  1888. /* Unknown Ori CMOS Camera data */
  1889. if (write_vector(gspca_dev, spca501c_mysterious_open_data))
  1890. goto error;
  1891. break;
  1892. default:
  1893. /* generic spca501 init data */
  1894. if (write_vector(gspca_dev, spca501_init_data))
  1895. goto error;
  1896. break;
  1897. }
  1898. PDEBUG(D_STREAM, "Initializing SPCA501 finished");
  1899. return 0;
  1900. error:
  1901. return -EINVAL;
  1902. }
  1903. static int sd_start(struct gspca_dev *gspca_dev)
  1904. {
  1905. struct sd *sd = (struct sd *) gspca_dev;
  1906. struct usb_device *dev = gspca_dev->dev;
  1907. int mode;
  1908. switch (sd->subtype) {
  1909. case ThreeComHomeConnectLite:
  1910. /* Special handling for 3com data */
  1911. write_vector(gspca_dev, spca501_3com_open_data);
  1912. break;
  1913. case Arowana300KCMOSCamera:
  1914. case SmileIntlCamera:
  1915. /* Arowana 300k CMOS Camera data */
  1916. write_vector(gspca_dev, spca501c_arowana_open_data);
  1917. break;
  1918. case MystFromOriUnknownCamera:
  1919. /* Unknown CMOS Camera data */
  1920. write_vector(gspca_dev, spca501c_mysterious_init_data);
  1921. break;
  1922. default:
  1923. /* Generic 501 open data */
  1924. write_vector(gspca_dev, spca501_open_data);
  1925. }
  1926. /* memorize the wanted pixel format */
  1927. mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
  1928. /* Enable ISO packet machine CTRL reg=2,
  1929. * index=1 bitmask=0x2 (bit ordinal 1) */
  1930. reg_write(dev, SPCA50X_REG_USB, 0x6, 0x94);
  1931. switch (mode) {
  1932. case 0: /* 640x480 */
  1933. reg_write(dev, SPCA50X_REG_USB, 0x07, 0x004a);
  1934. break;
  1935. case 1: /* 320x240 */
  1936. reg_write(dev, SPCA50X_REG_USB, 0x07, 0x104a);
  1937. break;
  1938. default:
  1939. /* case 2: * 160x120 */
  1940. reg_write(dev, SPCA50X_REG_USB, 0x07, 0x204a);
  1941. break;
  1942. }
  1943. reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02);
  1944. /* HDG atleast the Intel CreateAndShare needs to have one of its
  1945. * brightness / contrast / color set otherwise it assumes what seems
  1946. * max contrast. Note that strange enough setting any of these is
  1947. * enough to fix the max contrast problem, to be sure we set all 3 */
  1948. setbrightness(gspca_dev);
  1949. setcontrast(gspca_dev);
  1950. setcolors(gspca_dev);
  1951. return 0;
  1952. }
  1953. static void sd_stopN(struct gspca_dev *gspca_dev)
  1954. {
  1955. /* Disable ISO packet
  1956. * machine CTRL reg=2, index=1 bitmask=0x0 (bit ordinal 1) */
  1957. reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x01, 0x00);
  1958. }
  1959. /* called on streamoff with alt 0 and on disconnect */
  1960. static void sd_stop0(struct gspca_dev *gspca_dev)
  1961. {
  1962. if (!gspca_dev->present)
  1963. return;
  1964. reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00);
  1965. }
  1966. static void sd_pkt_scan(struct gspca_dev *gspca_dev,
  1967. u8 *data, /* isoc packet */
  1968. int len) /* iso packet length */
  1969. {
  1970. switch (data[0]) {
  1971. case 0: /* start of frame */
  1972. gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
  1973. data += SPCA501_OFFSET_DATA;
  1974. len -= SPCA501_OFFSET_DATA;
  1975. gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
  1976. return;
  1977. case 0xff: /* drop */
  1978. /* gspca_dev->last_packet_type = DISCARD_PACKET; */
  1979. return;
  1980. }
  1981. data++;
  1982. len--;
  1983. gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
  1984. }
  1985. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
  1986. {
  1987. struct sd *sd = (struct sd *) gspca_dev;
  1988. sd->brightness = val;
  1989. if (gspca_dev->streaming)
  1990. setbrightness(gspca_dev);
  1991. return 0;
  1992. }
  1993. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
  1994. {
  1995. struct sd *sd = (struct sd *) gspca_dev;
  1996. *val = sd->brightness;
  1997. return 0;
  1998. }
  1999. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
  2000. {
  2001. struct sd *sd = (struct sd *) gspca_dev;
  2002. sd->contrast = val;
  2003. if (gspca_dev->streaming)
  2004. setcontrast(gspca_dev);
  2005. return 0;
  2006. }
  2007. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
  2008. {
  2009. struct sd *sd = (struct sd *) gspca_dev;
  2010. *val = sd->contrast;
  2011. return 0;
  2012. }
  2013. static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)
  2014. {
  2015. struct sd *sd = (struct sd *) gspca_dev;
  2016. sd->colors = val;
  2017. if (gspca_dev->streaming)
  2018. setcolors(gspca_dev);
  2019. return 0;
  2020. }
  2021. static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
  2022. {
  2023. struct sd *sd = (struct sd *) gspca_dev;
  2024. *val = sd->colors;
  2025. return 0;
  2026. }
  2027. static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val)
  2028. {
  2029. struct sd *sd = (struct sd *) gspca_dev;
  2030. sd->blue_balance = val;
  2031. if (gspca_dev->streaming)
  2032. setblue_balance(gspca_dev);
  2033. return 0;
  2034. }
  2035. static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val)
  2036. {
  2037. struct sd *sd = (struct sd *) gspca_dev;
  2038. *val = sd->blue_balance;
  2039. return 0;
  2040. }
  2041. static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val)
  2042. {
  2043. struct sd *sd = (struct sd *) gspca_dev;
  2044. sd->red_balance = val;
  2045. if (gspca_dev->streaming)
  2046. setred_balance(gspca_dev);
  2047. return 0;
  2048. }
  2049. static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val)
  2050. {
  2051. struct sd *sd = (struct sd *) gspca_dev;
  2052. *val = sd->red_balance;
  2053. return 0;
  2054. }
  2055. /* sub-driver description */
  2056. static const struct sd_desc sd_desc = {
  2057. .name = MODULE_NAME,
  2058. .ctrls = sd_ctrls,
  2059. .nctrls = ARRAY_SIZE(sd_ctrls),
  2060. .config = sd_config,
  2061. .init = sd_init,
  2062. .start = sd_start,
  2063. .stopN = sd_stopN,
  2064. .stop0 = sd_stop0,
  2065. .pkt_scan = sd_pkt_scan,
  2066. };
  2067. /* -- module initialisation -- */
  2068. static const struct usb_device_id device_table[] = {
  2069. {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},
  2070. {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},
  2071. {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},
  2072. {USB_DEVICE(0x0733, 0x0401), .driver_info = IntelCreateAndShare},
  2073. {USB_DEVICE(0x0733, 0x0402), .driver_info = ViewQuestM318B},
  2074. {USB_DEVICE(0x1776, 0x501c), .driver_info = Arowana300KCMOSCamera},
  2075. {USB_DEVICE(0x0000, 0x0000), .driver_info = MystFromOriUnknownCamera},
  2076. {}
  2077. };
  2078. MODULE_DEVICE_TABLE(usb, device_table);
  2079. /* -- device connect -- */
  2080. static int sd_probe(struct usb_interface *intf,
  2081. const struct usb_device_id *id)
  2082. {
  2083. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  2084. THIS_MODULE);
  2085. }
  2086. static struct usb_driver sd_driver = {
  2087. .name = MODULE_NAME,
  2088. .id_table = device_table,
  2089. .probe = sd_probe,
  2090. .disconnect = gspca_disconnect,
  2091. #ifdef CONFIG_PM
  2092. .suspend = gspca_suspend,
  2093. .resume = gspca_resume,
  2094. #endif
  2095. };
  2096. /* -- module insert / remove -- */
  2097. static int __init sd_mod_init(void)
  2098. {
  2099. return usb_register(&sd_driver);
  2100. }
  2101. static void __exit sd_mod_exit(void)
  2102. {
  2103. usb_deregister(&sd_driver);
  2104. }
  2105. module_init(sd_mod_init);
  2106. module_exit(sd_mod_exit);