SyntekUSBVideoCamera
stk11xx-dev-6a31.c
Go to the documentation of this file.
1 
34 #include <linux/module.h>
35 #include <linux/init.h>
36 #include <linux/kernel.h>
37 #include <linux/version.h>
38 #include <linux/errno.h>
39 #include <linux/slab.h>
40 #include <linux/kref.h>
41 
42 #include <linux/usb.h>
43 #include <media/v4l2-common.h>
44 #include <media/v4l2-ioctl.h>
45 
46 #include "stk11xx.h"
47 #include "stk11xx-dev.h"
48 
49 
50 //=============================================================================
51 //
52 // STK-6A31 API
53 //
54 //=============================================================================
55 
56 
71 {
72  int retok;
73 
74  STK_INFO("Initialize USB2.0 Syntek Camera\n");
75 
76  usb_stk11xx_write_registry(dev, 0x0000, 0x00e0);
77  usb_stk11xx_write_registry(dev, 0x0002, 0x00f8);
78  usb_stk11xx_write_registry(dev, 0x0002, 0x0078);
79  usb_stk11xx_write_registry(dev, 0x0000, 0x0020);
80 
82  retok = dev_stk11xx_check_device(dev, 65);
83  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
84 
86  retok = dev_stk11xx_check_device(dev, 65);
87  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
88 
90  retok = dev_stk11xx_check_device(dev, 65);
91  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
92 
94  retok = dev_stk11xx_check_device(dev, 65);
95  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
96 
98  retok = dev_stk11xx_check_device(dev, 65);
99  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
100 
102  retok = dev_stk11xx_check_device(dev, 65);
103  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
104 
106  retok = dev_stk11xx_check_device(dev, 65);
107  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
108 
110  retok = dev_stk11xx_check_device(dev, 65);
111  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
112 
114 
116  retok = dev_stk11xx_check_device(dev, 65);
117  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
118 
120  retok = dev_stk11xx_check_device(dev, 65);
121  usb_stk11xx_write_registry(dev, 0x0200, 0x0008);
122 
124 
126 
128 
130 
132 
133  usb_stk11xx_set_feature(dev, 0);
134 
135  // Device is initialized and is ready !!!
136  STK_INFO("Syntek USB2.0 Camera is ready\n");
137 
138  return 0;
139 }
140 
141 
155 int dev_stk6a31_configure_device(struct usb_stk11xx *dev, int step)
156 {
157  int retok;
158  int value;
159 
160  // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
161  static const int values_001B[] = {
162  0x03, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07
163  };
164  static const int values_001C[] = {
165  0x02, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06
166  };
167  static const int values_0202[] = {
168  0x0a, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x0a, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f
169  };
170  static const int values_0110[] = {
171  0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
172  };
173  static const int values_0112[] = {
174  0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
175  };
176  static const int values_0114[] = {
177  0x80, 0x80, 0x80, 0x80, 0x00, 0xbe, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80
178  };
179  static const int values_0115[] = {
180  0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x05, 0x02, 0x02, 0x02, 0x02
181  };
182  static const int values_0116[] = {
183  0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe9, 0xe0, 0xe0, 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0
184  };
185  static const int values_0117[] = {
186  0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
187  };
188  static const int values_0100[] = {
189  0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
190  };
191 
192 
193  STK_DEBUG("dev_stk6a31_configure_device : %d\n", step);
194 
195  usb_stk11xx_write_registry(dev, 0x0000, 0x0024);
196  usb_stk11xx_write_registry(dev, 0x0002, 0x0078);
197  usb_stk11xx_write_registry(dev, 0x0003, 0x0080);
198  usb_stk11xx_write_registry(dev, 0x0005, 0x0000);
199 
200  usb_stk11xx_write_registry(dev, 0x0007, 0x0003);
201  usb_stk11xx_write_registry(dev, 0x000d, 0x0000);
202  usb_stk11xx_write_registry(dev, 0x000f, 0x0002);
203  usb_stk11xx_write_registry(dev, 0x0300, 0x0012);
204  usb_stk11xx_write_registry(dev, 0x0350, 0x0041);
205 
206  usb_stk11xx_write_registry(dev, 0x0351, 0x0000);
207  usb_stk11xx_write_registry(dev, 0x0352, 0x0000);
208  usb_stk11xx_write_registry(dev, 0x0353, 0x0000);
209  usb_stk11xx_write_registry(dev, 0x0018, 0x0010);
210  usb_stk11xx_write_registry(dev, 0x0019, 0x0000);
211 
212  usb_stk11xx_write_registry(dev, 0x001b, values_001B[step]);
213  usb_stk11xx_write_registry(dev, 0x001c, values_001C[step]);
214  usb_stk11xx_write_registry(dev, 0x0300, 0x0080);
215  usb_stk11xx_write_registry(dev, 0x001a, 0x0004);
216  usb_stk11xx_write_registry(dev, 0x0202, values_0202[step]);
217 
218  usb_stk11xx_write_registry(dev, 0x0110, values_0110[step]);
219  usb_stk11xx_write_registry(dev, 0x0111, 0x0000);
220  usb_stk11xx_write_registry(dev, 0x0112, values_0112[step]);
221  usb_stk11xx_write_registry(dev, 0x0113, 0x0000);
222  usb_stk11xx_write_registry(dev, 0x0114, values_0114[step]);
223 
224  usb_stk11xx_write_registry(dev, 0x0115, values_0115[step]);
225  usb_stk11xx_write_registry(dev, 0x0116, values_0116[step]);
226  usb_stk11xx_write_registry(dev, 0x0117, values_0117[step]);
227 
228  usb_stk11xx_read_registry(dev, 0x0100, &value);
229  usb_stk11xx_write_registry(dev, 0x0100, values_0100[step]);
230 
231 // usb_stk11xx_write_registry(dev, 0x0200, 0x0080);
232 // usb_stk11xx_write_registry(dev, 0x0200, 0x0000);
233  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
234 
235 
236  switch (step) {
237  case 0:
238  usb_stk11xx_write_registry(dev, 0x0203, 0x0022);
239 
240  usb_stk11xx_write_registry(dev, 0x0204, 0x0027);
241  usb_stk11xx_write_registry(dev, 0x0205, 0x00a5);
242 
243  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
244 
245  break;
246 
247  case 1:
248  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
249 
250  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
251  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
252  usb_stk11xx_write_registry(dev, 0x0204, 0x0013);
253  usb_stk11xx_write_registry(dev, 0x0205, 0x00bf);
254 
255  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
256 
257  break;
258 
259  case 2:
260  usb_stk11xx_write_registry(dev, 0x0203, 0x0042);
261 
262  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
263  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
264  usb_stk11xx_write_registry(dev, 0x0204, 0x0024);
265  usb_stk11xx_write_registry(dev, 0x0205, 0x00a5);
266 
267  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
268 
269  break;
270 
271  case 3:
272  usb_stk11xx_write_registry(dev, 0x0203, 0x0042);
273 
274  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
275  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
276  usb_stk11xx_write_registry(dev, 0x0204, 0x0013);
277  usb_stk11xx_write_registry(dev, 0x0205, 0x00e0);
278  usb_stk11xx_write_registry(dev, 0x0204, 0x0024);
279  usb_stk11xx_write_registry(dev, 0x0205, 0x00a5);
280 
281  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
282 
283  break;
284 
285  case 4:
286  usb_stk11xx_write_registry(dev, 0x0203, 0x0042);
287 
288  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
289  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
290  usb_stk11xx_write_registry(dev, 0x0204, 0x0013);
291  usb_stk11xx_write_registry(dev, 0x0205, 0x00bf);
292 
293  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
294 
295  break;
296 
297  case 5:
298  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
299 
300  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
301  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
302  usb_stk11xx_write_registry(dev, 0x0204, 0x0013);
303  usb_stk11xx_write_registry(dev, 0x0205, 0x00ff);
304 
305  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
306 
307  break;
308 
309  case 6:
310  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
311 
312  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
313  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
314  usb_stk11xx_write_registry(dev, 0x0204, 0x0013);
315  usb_stk11xx_write_registry(dev, 0x0205, 0x00b7);
316 
317  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
318 
319  break;
320 
321  case 7:
322  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
323 
324  usb_stk11xx_write_registry(dev, 0x0204, 0x0012);
325  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
326  usb_stk11xx_write_registry(dev, 0x0204, 0x0013);
327  usb_stk11xx_write_registry(dev, 0x0205, 0x00b7);
328 
329  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
330 
331  break;
332 
333  case 8:
334  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
335 
336  usb_stk11xx_read_registry(dev, 0x02ff, &value);
337  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
338 
339  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
340  usb_stk11xx_write_registry(dev, 0x0204, 0x00ff);
341  usb_stk11xx_write_registry(dev, 0x0205, 0x0001);
342  usb_stk11xx_write_registry(dev, 0x0200, 0x0001);
343  retok = dev_stk11xx_check_device(dev, 500);
344  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
345  usb_stk11xx_read_registry(dev, 0x02ff, &value);
346  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
347 
348  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
349  usb_stk11xx_write_registry(dev, 0x0208, 0x000a);
350  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
351  retok = dev_stk11xx_check_device(dev, 500);
352  usb_stk11xx_read_registry(dev, 0x0209, &value);
353  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
354  usb_stk11xx_read_registry(dev, 0x02ff, &value);
355  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
356 
357  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
358  usb_stk11xx_write_registry(dev, 0x0208, 0x000b);
359  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
360  retok = dev_stk11xx_check_device(dev, 500);
361  usb_stk11xx_read_registry(dev, 0x0209, &value);
362  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
363  usb_stk11xx_read_registry(dev, 0x02ff, &value);
364  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
365 
366  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
367  usb_stk11xx_write_registry(dev, 0x0208, 0x001c);
368  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
369  retok = dev_stk11xx_check_device(dev, 500);
370  usb_stk11xx_read_registry(dev, 0x0209, &value);
371  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
372  usb_stk11xx_read_registry(dev, 0x02ff, &value);
373  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
374 
375  usb_stk11xx_write_registry(dev, 0x0203, 0x0060);
376  usb_stk11xx_write_registry(dev, 0x0208, 0x001d);
377  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
378  retok = dev_stk11xx_check_device(dev, 500);
379  usb_stk11xx_read_registry(dev, 0x0209, &value);
380  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
381 
382  break;
383 
384  case 9:
385  usb_stk11xx_write_registry(dev, 0x0203, 0x00dc);
386 
387  usb_stk11xx_write_registry(dev, 0x0204, 0x0015);
388  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
389 
390  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
391 
392  break;
393 
394  case 10:
395  usb_stk11xx_write_registry(dev, 0x0203, 0x00ec);
396 
397  usb_stk11xx_write_registry(dev, 0x0204, 0x0015);
398  usb_stk11xx_write_registry(dev, 0x0205, 0x0080);
399 
400  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
401 
402  break;
403 
404  case 11:
405  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
406 
407  usb_stk11xx_read_registry(dev, 0x02ff, &value);
408  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
409 
410  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
411 
412  usb_stk11xx_write_registry(dev, 0x0208, 0x0000);
413  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
414  retok = dev_stk11xx_check_device(dev, 500);
415  usb_stk11xx_read_registry(dev, 0x0209, &value);
416  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
417 
418  break;
419 
420  case 12:
421  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
422 
423  usb_stk11xx_write_registry(dev, 0x0204, 0x00f0);
424  usb_stk11xx_write_registry(dev, 0x0205, 0x0000);
425  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
426  retok = dev_stk11xx_check_device(dev, 500);
427  usb_stk11xx_write_registry(dev, 0x0204, 0x00f1);
428  usb_stk11xx_write_registry(dev, 0x0205, 0x0000);
429  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
430  retok = dev_stk11xx_check_device(dev, 500);
431  usb_stk11xx_read_registry(dev, 0x02ff, &value);
432  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
433 
434  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
435  usb_stk11xx_write_registry(dev, 0x0208, 0x0000);
436  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
437  retok = dev_stk11xx_check_device(dev, 500);
438  usb_stk11xx_read_registry(dev, 0x0209, &value);
439  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
440  usb_stk11xx_read_registry(dev, 0x02ff, &value);
441  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
442 
443  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
444  usb_stk11xx_write_registry(dev, 0x0208, 0x00f1);
445  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
446  retok = dev_stk11xx_check_device(dev, 500);
447  usb_stk11xx_read_registry(dev, 0x0209, &value);
448  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
449 
450  break;
451 
452  case 13:
453  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
454 
455  usb_stk11xx_read_registry(dev, 0x02ff, &value);
456  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
457 
458  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
459  usb_stk11xx_write_registry(dev, 0x0208, 0x0000);
460  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
461  retok = dev_stk11xx_check_device(dev, 500);
462  usb_stk11xx_read_registry(dev, 0x0209, &value);
463  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
464  usb_stk11xx_read_registry(dev, 0x02ff, &value);
465  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
466 
467  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
468  usb_stk11xx_write_registry(dev, 0x0208, 0x00f1);
469  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
470  retok = dev_stk11xx_check_device(dev, 500);
471  usb_stk11xx_read_registry(dev, 0x0209, &value);
472  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
473 
474  break;
475 
476  case 14:
477  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
478 
479  usb_stk11xx_write_registry(dev, 0x0204, 0x0001);
480  usb_stk11xx_write_registry(dev, 0x0205, 0x0000);
481  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
482  retok = dev_stk11xx_check_device(dev, 500);
483  usb_stk11xx_write_registry(dev, 0x0204, 0x00f1);
484  usb_stk11xx_write_registry(dev, 0x0205, 0x0000);
485  usb_stk11xx_write_registry(dev, 0x0200, 0x0005);
486  retok = dev_stk11xx_check_device(dev, 500);
487  usb_stk11xx_read_registry(dev, 0x02ff, &value);
488  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
489 
490  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
491  usb_stk11xx_write_registry(dev, 0x0208, 0x0000);
492  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
493  retok = dev_stk11xx_check_device(dev, 500);
494  usb_stk11xx_read_registry(dev, 0x0209, &value);
495  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
496  usb_stk11xx_read_registry(dev, 0x02ff, &value);
497  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
498 
499  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
500  usb_stk11xx_write_registry(dev, 0x0208, 0x00f1);
501  usb_stk11xx_write_registry(dev, 0x0200, 0x0020);
502  retok = dev_stk11xx_check_device(dev, 500);
503  usb_stk11xx_read_registry(dev, 0x0209, &value);
504  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
505 
506  break;
507 
508  case 15:
509  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
510 
512 
513  usb_stk11xx_write_registry(dev, 0x0200, 0x0080);
514  usb_stk11xx_write_registry(dev, 0x0200, 0x0000);
515  usb_stk11xx_write_registry(dev, 0x02ff, 0x0001);
516  usb_stk11xx_write_registry(dev, 0x0203, 0x00a0);
517 
518 
519  break;
520 
521  case 16:
522  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
523 
525 
526  break;
527  }
528 
529  return 0;
530 }
531 
532 
543 {
544  int value;
545 
546  usb_stk11xx_read_registry(dev, 0x0104, &value);
547  usb_stk11xx_read_registry(dev, 0x0105, &value);
548  usb_stk11xx_read_registry(dev, 0x0106, &value);
549 
550  usb_stk11xx_write_registry(dev, 0x0100, 0x0021);
551  usb_stk11xx_write_registry(dev, 0x0116, 0x0000);
552  usb_stk11xx_write_registry(dev, 0x0117, 0x0000);
553  usb_stk11xx_write_registry(dev, 0x0018, 0x0000);
554 
555  usb_stk11xx_read_registry(dev, 0x0000, &value);
556  usb_stk11xx_write_registry(dev, 0x0000, 0x0049);
557 
558  return 0;
559 }
560 
561 
573 {
574 // int retok;
575 // int value;
576 
578 
579  usb_stk11xx_set_feature(dev, 0);
580 
582 
583  usb_stk11xx_write_registry(dev, 0x0000, 0x00e0);
584  usb_stk11xx_write_registry(dev, 0x0002, 0x00f8);
585  usb_stk11xx_write_registry(dev, 0x0002, 0x0078);
586  usb_stk11xx_write_registry(dev, 0x0000, 0x0020);
587 
589 
591 
592  return 0;
593 }
594 
595 
607 {
608  int i;
609  int retok;
610  int value;
611 
612  int asize;
613  static const int values_204[] = {
614  0xf0, 0xf1, 0x0d, 0xf1, 0x0d, 0xf1, 0xf0, 0xf1, 0x35, 0xf1,
615  0xf0, 0xf1, 0x06, 0xf1, 0xf0, 0xf1, 0xdd, 0xf1, 0xf0, 0xf1,
616  0x1f, 0xf1, 0x20, 0xf1, 0x21, 0xf1, 0x22, 0xf1, 0x23, 0xf1,
617  0x24, 0xf1, 0x28, 0xf1, 0x29, 0xf1, 0x5e, 0xf1, 0x5f, 0xf1,
618  0x60, 0xf1, 0xef, 0xf1, 0xf2, 0xf1, 0x02, 0xf1, 0x03, 0xf1,
619  0x04, 0xf1, 0x09, 0xf1, 0x0a, 0xf1, 0x0b, 0xf1, 0x0c, 0xf1,
620  0x0d, 0xf1, 0x0e, 0xf1, 0x0f, 0xf1, 0x10, 0xf1, 0x11, 0xf1,
621  0x15, 0xf1, 0x16, 0xf1, 0x17, 0xf1, 0x18, 0xf1, 0x19, 0xf1,
622  0x1a, 0xf1, 0x1b, 0xf1, 0x1c, 0xf1, 0x1d, 0xf1, 0x1e, 0xf1,
623  0xf0, 0xf1, 0x06, 0xf1, 0x06, 0xf1, 0xf0, 0xf1, 0x80, 0xf1,
624  0x81, 0xf1, 0x82, 0xf1, 0x83, 0xf1, 0x84, 0xf1, 0x85, 0xf1,
625  0x86, 0xf1, 0x87, 0xf1, 0x88, 0xf1, 0x89, 0xf1, 0x8a, 0xf1,
626  0x8b, 0xf1, 0x8c, 0xf1, 0x8d, 0xf1, 0x8e, 0xf1, 0x8f, 0xf1,
627  0x90, 0xf1, 0x91, 0xf1, 0x92, 0xf1, 0x93, 0xf1, 0x94, 0xf1,
628  0x95, 0xf1, 0xb6, 0xf1, 0xb7, 0xf1, 0xb8, 0xf1, 0xb9, 0xf1,
629  0xba, 0xf1, 0xbb, 0xf1, 0xbc, 0xf1, 0xbd, 0xf1, 0xbe, 0xf1,
630  0xbf, 0xf1, 0xc0, 0xf1, 0xc1, 0xf1, 0xc2, 0xf1, 0xc3, 0xf1,
631  0xc4, 0xf1, 0x06, 0xf1, 0xf0, 0xf1, 0x53, 0xf1, 0x54, 0xf1,
632  0x55, 0xf1, 0x56, 0xf1, 0x57, 0xf1, 0x58, 0xf1, 0xdc, 0xf1,
633  0xdd, 0xf1, 0xde, 0xf1, 0xdf, 0xf1, 0xe0, 0xf1, 0xe1, 0xf1,
634  0xf0, 0xf1, 0xa7, 0xf1, 0xaa, 0xf1, 0x3a, 0xf1, 0xa1, 0xf1,
635  0xa4, 0xf1, 0x9b, 0xf1, 0x08, 0xf1, 0xf0, 0xf1, 0x2f, 0xf1,
636  0x9c, 0xf1, 0xd2, 0xf1, 0xcc, 0xf1, 0xcb, 0xf1, 0x2e, 0xf1,
637  0x67, 0xf1, 0xf0, 0xf1, 0x65, 0xf1, 0x66, 0xf1, 0x67, 0xf1,
638  0x65, 0xf1, 0xf0, 0xf1, 0x05, 0xf1, 0x07, 0xf1, 0xf0, 0xf1,
639  0x39, 0xf1, 0x3b, 0xf1, 0x3a, 0xf1, 0x3c, 0xf1, 0x57, 0xf1,
640  0x58, 0xf1, 0x59, 0xf1, 0x5a, 0xf1, 0x5c, 0xf1, 0x5d, 0xf1,
641  0x64, 0xf1, 0xf0, 0xf1, 0x5b, 0xf1, 0xf0, 0xf1, 0x36, 0xf1,
642  0x37, 0xf1, 0xf0, 0xf1, 0x08, 0xf1
643  };
644  static const int values_205[] = {
645  0x00, 0x00, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x00, 0x00, 0x22,
646  0x00, 0x01, 0x70, 0x0e, 0x00, 0x02, 0x18, 0xe0, 0x00, 0x02,
647  0x01, 0x80, 0xc8, 0x14, 0x80, 0x80, 0xa0, 0x78, 0xa0, 0x78,
648  0x5f, 0x20, 0xea, 0x02, 0x86, 0x7a, 0x59, 0x4c, 0x4d, 0x51,
649  0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0xee, 0x39, 0x23,
650  0x07, 0x24, 0x00, 0xcd, 0x00, 0x93, 0x00, 0x04, 0x00, 0x5c,
651  0x00, 0xd9, 0x00, 0x53, 0x00, 0x08, 0x00, 0x91, 0x00, 0xcf,
652  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
653  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
654  0x00, 0x01, 0xf0, 0x0e, 0x70, 0x0e, 0x00, 0x01, 0x00, 0x07,
655  0xde, 0x13, 0xeb, 0xe2, 0x00, 0xf6, 0xe1, 0x14, 0xea, 0xdd,
656  0xfd, 0xf6, 0xe5, 0x11, 0xed, 0xe6, 0xfb, 0xf7, 0xd6, 0x13,
657  0xed, 0xec, 0xf9, 0xf2, 0x00, 0x00, 0xd8, 0x15, 0xe9, 0xea,
658  0xf9, 0xf1, 0x00, 0x02, 0xde, 0x10, 0xef, 0xef, 0xfb, 0xf4,
659  0x00, 0x02, 0x0e, 0x06, 0x27, 0x13, 0x11, 0x06, 0x27, 0x13,
660  0x0c, 0x03, 0x2a, 0x0f, 0x12, 0x08, 0x1a, 0x16, 0x00, 0x22,
661  0x15, 0x0a, 0x1c, 0x1a, 0x00, 0x2d, 0x11, 0x09, 0x14, 0x14,
662  0x00, 0x2a, 0x74, 0x0e, 0x00, 0x01, 0x0b, 0x03, 0x47, 0x22,
663  0xac, 0x82, 0xda, 0xc7, 0xf5, 0xe9, 0xff, 0x00, 0x0b, 0x03,
664  0x47, 0x22, 0xac, 0x82, 0xda, 0xc7, 0xf5, 0xe9, 0xff, 0x00,
665  0x00, 0x01, 0x02, 0x80, 0x01, 0xe0, 0x43, 0x00, 0x05, 0x00,
666  0x04, 0x00, 0x43, 0x00, 0x01, 0x80, 0x00, 0x02, 0xd1, 0x00,
667  0xd1, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x0c, 0x3c,
668  0x10, 0x10, 0x00, 0x00, 0xa0, 0x00, 0x20, 0x03, 0x05, 0x01,
669  0x20, 0x00, 0x00, 0x00, 0x01, 0xb8, 0x00, 0xd8, 0x00, 0x02,
670  0x06, 0xc0, 0x04, 0x0e, 0x06, 0xc0, 0x05, 0x64, 0x02, 0x08,
671  0x02, 0x71, 0x02, 0x09, 0x02, 0x71, 0x12, 0x0d, 0x17, 0x12,
672  0x5e, 0x1c, 0x00, 0x02, 0x00, 0x03, 0x00, 0x02, 0x78, 0x10,
673  0x83, 0x04, 0x00, 0x00, 0x00, 0x21
674  };
675 
676 
677  asize = ARRAY_SIZE(values_204);
678 
679  for(i=0; i<asize; i++) {
680  usb_stk11xx_read_registry(dev, 0x02ff, &value);
681  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
682 
683  usb_stk11xx_write_registry(dev, 0x0203, 0x00ba);
684 
685  usb_stk11xx_write_registry(dev, 0x0204, values_204[i]);
686  usb_stk11xx_write_registry(dev, 0x0205, values_205[i]);
687  usb_stk11xx_write_registry(dev, 0x0200, 0x0001);
688 
689  retok = dev_stk11xx_check_device(dev, 500);
690 
691  if (retok != 1) {
692  STK_ERROR("Load default sensor settings fail !\n");
693  return -1;
694  }
695 
696  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
697  }
698 
699  retok = dev_stk11xx_check_device(dev, 500);
700 
701  return 0;
702 }
703 
704 
719 {
720  int i;
721  int ret;
722  int value;
723 
724  int asize;
725  static const int values_204[] = {
726  0xf0, 0xf1, 0x2e, 0xf1, 0xf0, 0xf1, 0x5b, 0xf1, 0xf0, 0xf1, 0x36, 0xf1, 0x37, 0xf1, 0xf0, 0xf1, 0x08, 0xf1
727  };
728  static const int values_205[] = {
729  0x00, 0x02, 0x0c, 0x3c, 0x00, 0x02, 0x00, 0x03, 0x00, 0x02, 0x78, 0x10, 0x83, 0x04, 0x00, 0x00, 0x00, 0x21
730  };
731 
732 
733  asize = ARRAY_SIZE(values_204);
734 
735  // Contrast register
736  for (i=0; i<asize; i++) {
737  usb_stk11xx_read_registry(dev, 0x02ff, &value);
738  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
739 
740  usb_stk11xx_write_registry(dev, 0x0204, values_204[i]);
741  usb_stk11xx_write_registry(dev, 0x0205, values_205[i]);
742 
743  usb_stk11xx_write_registry(dev, 0x0200, 0x0001);
744  ret = dev_stk11xx_check_device(dev, 500);
745  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
746  }
747 
748  return 0;
749 }
750 
751 
766 {
767  int ret;
768  int value;
769 
770  // Contrast register
771  usb_stk11xx_read_registry(dev, 0x02ff, &value);
772  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
773 
774  usb_stk11xx_write_registry(dev, 0x0204, 0x00b3);
775  usb_stk11xx_write_registry(dev, 0x0205, (dev->vsettings.contrast >> 8));
776 
777  usb_stk11xx_write_registry(dev, 0x0200, 0x0001);
778  ret = dev_stk11xx_check_device(dev, 500);
779  usb_stk11xx_write_registry(dev, 0x02ff, 0x0000);
780 
781  STK_DEBUG("Set colour : %d\n", dev->vsettings.colour);
782  STK_DEBUG("Set contrast : %d\n", dev->vsettings.contrast);
783  STK_DEBUG("Set whiteness : %d\n", dev->vsettings.whiteness);
784  STK_DEBUG("Set brightness : %d\n", dev->vsettings.brightness);
785 
786  return 0;
787 }
788 
789 
800 {
801  return 0;
802 }
803 
804 
816 {
817  int value;
818  int value_116, value_117;
819 
820  usb_stk11xx_read_registry(dev, 0x0114, &value); // read 0x80
821  usb_stk11xx_read_registry(dev, 0x0115, &value); // read 0x02
822 
823  usb_stk11xx_read_registry(dev, 0x0116, &value_116);
824  usb_stk11xx_read_registry(dev, 0x0117, &value_117);
825 
826  usb_stk11xx_write_registry(dev, 0x0116, 0x0000);
827  usb_stk11xx_write_registry(dev, 0x0117, 0x0000);
828 
829  usb_stk11xx_read_registry(dev, 0x0100, &value); // read 0x21
830  usb_stk11xx_write_registry(dev, 0x0100, 0x00a0);
831 
832  usb_stk11xx_write_registry(dev, 0x0116, value_116);
833  usb_stk11xx_write_registry(dev, 0x0117, value_117);
834 
835  return 0;
836 }
837 
838 
849 {
851 
853 
854  return 0;
855 }
856 
857 
869 {
870  return 0;
871 }
872 
dev_stk6a31_initialize_device
int dev_stk6a31_initialize_device(struct usb_stk11xx *dev)
This function permits to initialize the device.
Definition: stk11xx-dev-6a31.c:70
dev_stk6a31_camera_settings
int dev_stk6a31_camera_settings(struct usb_stk11xx *dev)
This function permits to modify the settings of the camera.
Definition: stk11xx-dev-6a31.c:718
dev_stk6a31_stop_stream
int dev_stk6a31_stop_stream(struct usb_stk11xx *dev)
This function sets the device to stop the stream.
Definition: stk11xx-dev-6a31.c:868
dev_stk11xx_camera_off
int dev_stk11xx_camera_off(struct usb_stk11xx *dev)
This function switchs off the camera.
Definition: stk11xx-dev.c:264
dev_stk6a31_configure_device
int dev_stk6a31_configure_device(struct usb_stk11xx *dev, int step)
This function permits to configure the device.
Definition: stk11xx-dev-6a31.c:155
stk11xx_video::brightness
int brightness
Definition: stk11xx.h:278
dev_stk6a31_set_camera_quality
int dev_stk6a31_set_camera_quality(struct usb_stk11xx *dev)
This function permits to modify the settings of the camera.
Definition: stk11xx-dev-6a31.c:765
stk11xx.h
Driver for Syntek USB video camera.
dev_stk6a31_set_camera_fps
int dev_stk6a31_set_camera_fps(struct usb_stk11xx *dev)
This function permits to modify the settings of the camera.
Definition: stk11xx-dev-6a31.c:799
dev_stk6a31_sensor_settings
int dev_stk6a31_sensor_settings(struct usb_stk11xx *dev)
This function permits to set default sensor settings.
Definition: stk11xx-dev-6a31.c:606
STK_DEBUG
#define STK_DEBUG(str, args...)
Definition: stk11xx.h:149
stk11xx_video::colour
int colour
Definition: stk11xx.h:281
STK_ERROR
#define STK_ERROR(str, args...)
Definition: stk11xx.h:147
dev_stk11xx_camera_settings
int dev_stk11xx_camera_settings(struct usb_stk11xx *dev)
This function permits to modify the settings of the camera.
Definition: stk11xx-dev.c:342
usb_stk11xx_set_feature
int usb_stk11xx_set_feature(struct usb_stk11xx *dev, int index)
Send the message SET_FEATURE and choose the interface.
Definition: stk11xx-usb.c:474
dev_stk6a31_camera_asleep
int dev_stk6a31_camera_asleep(struct usb_stk11xx *dev)
Wake-up the camera.
Definition: stk11xx-dev-6a31.c:542
dev_stk6a31_start_stream
int dev_stk6a31_start_stream(struct usb_stk11xx *dev)
This function sets the device to start the stream.
Definition: stk11xx-dev-6a31.c:815
usb_stk11xx_write_registry
int usb_stk11xx_write_registry(struct usb_stk11xx *dev, __u16 index, __u16 value)
Write a 16-bits value to a 16-bits register.
Definition: stk11xx-usb.c:540
usb_stk11xx_read_registry
int usb_stk11xx_read_registry(struct usb_stk11xx *dev, __u16 index, int *value)
Read a 16-bits value from a 16-bits register.
Definition: stk11xx-usb.c:572
dev_stk6a31_init_camera
int dev_stk6a31_init_camera(struct usb_stk11xx *dev)
This function initializes the device for the stream.
Definition: stk11xx-dev-6a31.c:572
STK_INFO
#define STK_INFO(str, args...)
Definition: stk11xx.h:146
stk11xx_video::contrast
int contrast
Definition: stk11xx.h:279
usb_stk11xx
Definition: stk11xx.h:301
usb_stk11xx::vsettings
struct stk11xx_video vsettings
Definition: stk11xx.h:319
stk11xx-dev.h
Driver for Syntek USB video camera.
stk11xx_video::whiteness
int whiteness
Definition: stk11xx.h:280
dev_stk11xx_check_device
int dev_stk11xx_check_device(struct usb_stk11xx *dev, int nbr)
This function permits to check the device in reading the register 0x0201.
Definition: stk11xx-dev.c:170
dev_stk6a31_reconf_camera
int dev_stk6a31_reconf_camera(struct usb_stk11xx *dev)
Reconfigure the camera before the stream.
Definition: stk11xx-dev-6a31.c:848