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