Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
[linux-2.6] / drivers / media / video / cx231xx / cx231xx-pcb-cfg.c
1 /*
2    cx231xx-pcb-config.c - driver for Conexant
3                 Cx23100/101/102 USB video capture devices
4
5    Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include "cx231xx.h"
23 #include "cx231xx-conf-reg.h"
24
25 static unsigned int pcb_debug;
26 module_param(pcb_debug, int, 0644);
27 MODULE_PARM_DESC(pcb_debug, "enable pcb config debug messages [video]");
28
29 /******************************************************************************/
30
31 struct pcb_config cx231xx_Scenario[] = {
32         {
33          INDEX_SELFPOWER_DIGITAL_ONLY,  /* index */
34          USB_SELF_POWER,        /* power_type */
35          0,                     /* speed , not decide yet */
36          MOD_DIGITAL,           /* mode */
37          SOURCE_TS_BDA,         /* ts1_source, digital tv only */
38          NOT_SUPPORTED,         /* ts2_source  */
39          NOT_SUPPORTED,         /* analog source */
40
41          0,                     /* digital_index  */
42          0,                     /* analog index */
43          0,                     /* dif_index   */
44          0,                     /* external_index */
45
46          1,                     /* only one configuration */
47          {
48           {
49            0,                   /* config index */
50            {
51             0,                  /* interrupt ep index */
52             1,                  /* ts1 index */
53             NOT_SUPPORTED,      /* TS2 index */
54             NOT_SUPPORTED,      /* AUDIO */
55             NOT_SUPPORTED,      /* VIDEO */
56             NOT_SUPPORTED,      /* VANC */
57             NOT_SUPPORTED,      /* HANC */
58             NOT_SUPPORTED       /* ir_index */
59             }
60            ,
61            }
62           ,
63           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
64                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
65                            NOT_SUPPORTED}
66            }
67           ,
68           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
69                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
70                            NOT_SUPPORTED}
71            }
72           }
73          ,
74          /* full-speed config */
75          {
76           {
77            0,                   /* config index */
78            {
79             0,                  /* interrupt ep index */
80             1,                  /* ts1 index */
81             NOT_SUPPORTED,      /* TS2 index */
82             NOT_SUPPORTED,      /* AUDIO */
83             NOT_SUPPORTED,      /* VIDEO */
84             NOT_SUPPORTED,      /* VANC */
85             NOT_SUPPORTED,      /* HANC */
86             NOT_SUPPORTED       /* ir_index */
87             }
88            }
89           ,
90           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
91                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
92                            NOT_SUPPORTED}
93            }
94           ,
95           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
96                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
97                            NOT_SUPPORTED}
98            }
99           }
100          }
101         ,
102
103         {
104          INDEX_SELFPOWER_DUAL_DIGITAL,  /* index */
105          USB_SELF_POWER,        /* power_type */
106          0,                     /* speed , not decide yet */
107          MOD_DIGITAL,           /* mode */
108          SOURCE_TS_BDA,         /* ts1_source, digital tv only */
109          0,                     /* ts2_source,need update from register */
110          NOT_SUPPORTED,         /* analog source */
111          0,                     /* digital_index  */
112          0,                     /* analog index */
113          0,                     /* dif_index */
114          0,                     /* external_index */
115
116          1,                     /* only one configuration */
117          {
118           {
119            0,                   /* config index */
120            {
121             0,                  /* interrupt ep index */
122             1,                  /* ts1 index */
123             2,                  /* TS2 index */
124             NOT_SUPPORTED,      /* AUDIO */
125             NOT_SUPPORTED,      /* VIDEO */
126             NOT_SUPPORTED,      /* VANC */
127             NOT_SUPPORTED,      /* HANC */
128             NOT_SUPPORTED       /* ir_index */
129             }
130            }
131           ,
132           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
133                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
134                            NOT_SUPPORTED}
135            }
136           ,
137           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
138                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
139                            NOT_SUPPORTED}
140            }
141           }
142          ,
143          /* full-speed */
144          {
145           {
146            0,                   /* config index */
147            {
148             0,                  /* interrupt ep index */
149             1,                  /* ts1 index */
150             2,                  /* TS2 index */
151             NOT_SUPPORTED,      /* AUDIO */
152             NOT_SUPPORTED,      /* VIDEO */
153             NOT_SUPPORTED,      /* VANC */
154             NOT_SUPPORTED,      /* HANC */
155             NOT_SUPPORTED       /* ir_index */
156             }
157            }
158           ,
159           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
160                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
161                            NOT_SUPPORTED}
162            }
163           ,
164           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
165                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
166                            NOT_SUPPORTED}
167            }
168           }
169          }
170         ,
171
172         {
173          INDEX_SELFPOWER_ANALOG_ONLY,   /* index */
174          USB_SELF_POWER,        /* power_type */
175          0,                     /* speed , not decide yet */
176          MOD_ANALOG | MOD_DIF | MOD_EXTERNAL,   /* mode ,analog tv only */
177          NOT_SUPPORTED,         /* ts1_source, NOT SUPPORT */
178          NOT_SUPPORTED,         /* ts2_source,NOT SUPPORT */
179          0,                     /* analog source, need update */
180
181          0,                     /* digital_index  */
182          0,                     /* analog index */
183          0,                     /* dif_index */
184          0,                     /* external_index */
185
186          1,                     /* only one configuration */
187          {
188           {
189            0,                   /* config index */
190            {
191             0,                  /* interrupt ep index */
192             NOT_SUPPORTED,      /* ts1 index */
193             NOT_SUPPORTED,      /* TS2 index */
194             1,                  /* AUDIO */
195             2,                  /* VIDEO */
196             3,                  /* VANC */
197             4,                  /* HANC */
198             NOT_SUPPORTED       /* ir_index */
199             }
200            }
201           ,
202           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
203                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
204                            NOT_SUPPORTED}
205            }
206           ,
207           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
208                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
209                            NOT_SUPPORTED}
210            }
211           }
212          ,
213          /* full-speed */
214          {
215           {
216            0,                   /* config index */
217            {
218             0,                  /* interrupt ep index */
219             NOT_SUPPORTED,      /* ts1 index */
220             NOT_SUPPORTED,      /* TS2 index */
221             1,                  /* AUDIO */
222             2,                  /* VIDEO */
223             NOT_SUPPORTED,      /* VANC */
224             NOT_SUPPORTED,      /* HANC */
225             NOT_SUPPORTED       /* ir_index */
226             }
227            }
228           ,
229           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
230                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
231                            NOT_SUPPORTED}
232            }
233           ,
234           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
235                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
236                            NOT_SUPPORTED}
237            }
238           }
239          }
240         ,
241
242         {
243          INDEX_SELFPOWER_DUAL,  /* index */
244          USB_SELF_POWER,        /* power_type */
245          0,                     /* speed , not decide yet */
246          /* mode ,analog tv and digital path */
247          MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
248          0,                     /* ts1_source,will update in register */
249          NOT_SUPPORTED,         /* ts2_source,NOT SUPPORT */
250          0,                     /* analog source need update */
251          0,                     /* digital_index  */
252          0,                     /* analog index */
253          0,                     /* dif_index */
254          0,                     /* external_index */
255          1,                     /* only one configuration */
256          {
257           {
258            0,                   /* config index */
259            {
260             0,                  /* interrupt ep index */
261             1,                  /* ts1 index */
262             NOT_SUPPORTED,      /* TS2 index */
263             2,                  /* AUDIO */
264             3,                  /* VIDEO */
265             4,                  /* VANC */
266             5,                  /* HANC */
267             NOT_SUPPORTED       /* ir_index */
268             }
269            }
270           ,
271           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
272                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
273                            NOT_SUPPORTED}
274            }
275           ,
276           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
277                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
278                            NOT_SUPPORTED}
279            }
280           }
281          ,
282          /* full-speed */
283          {
284           {
285            0,                   /* config index */
286            {
287             0,                  /* interrupt ep index */
288             1,                  /* ts1 index */
289             NOT_SUPPORTED,      /* TS2 index */
290             2,                  /* AUDIO */
291             3,                  /* VIDEO */
292             NOT_SUPPORTED,      /* VANC */
293             NOT_SUPPORTED,      /* HANC */
294             NOT_SUPPORTED       /* ir_index */
295             }
296            }
297           ,
298           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
299                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
300                            NOT_SUPPORTED}
301            }
302           ,
303           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
304                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
305                            NOT_SUPPORTED}
306            }
307           }
308          }
309         ,
310
311         {
312          INDEX_SELFPOWER_TRIPLE,        /* index */
313          USB_SELF_POWER,        /* power_type */
314          0,                     /* speed , not decide yet */
315          /* mode ,analog tv and digital path */
316          MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
317          0,                     /* ts1_source, update in register */
318          0,                     /* ts2_source,update in register */
319          0,                     /* analog source, need update */
320
321          0,                     /* digital_index  */
322          0,                     /* analog index */
323          0,                     /* dif_index */
324          0,                     /* external_index */
325          1,                     /* only one configuration */
326          {
327           {
328            0,                   /* config index */
329            {
330             0,                  /* interrupt ep index */
331             1,                  /* ts1 index */
332             2,                  /* TS2 index */
333             3,                  /* AUDIO */
334             4,                  /* VIDEO */
335             5,                  /* VANC */
336             6,                  /* HANC */
337             NOT_SUPPORTED       /* ir_index */
338             }
339            }
340           ,
341           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
342                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
343                            NOT_SUPPORTED}
344            }
345           ,
346           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
347                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
348                            NOT_SUPPORTED}
349            }
350           }
351          ,
352          /* full-speed */
353          {
354           {
355            0,                   /* config index */
356            {
357             0,                  /* interrupt ep index */
358             1,                  /* ts1 index */
359             2,                  /* TS2 index */
360             3,                  /* AUDIO */
361             4,                  /* VIDEO */
362             NOT_SUPPORTED,      /* VANC */
363             NOT_SUPPORTED,      /* HANC */
364             NOT_SUPPORTED       /* ir_index */
365             }
366            }
367           ,
368           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
369                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
370                            NOT_SUPPORTED}
371            }
372           ,
373           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
374                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
375                            NOT_SUPPORTED}
376            }
377           }
378          }
379         ,
380
381         {
382          INDEX_SELFPOWER_COMPRESSOR,    /* index */
383          USB_SELF_POWER,        /* power_type */
384          0,                     /* speed , not decide yet */
385          /* mode ,analog tv AND DIGITAL path */
386          MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
387          NOT_SUPPORTED,         /* ts1_source, disable */
388          SOURCE_TS_BDA,         /* ts2_source */
389          0,                     /* analog source,need update */
390          0,                     /* digital_index  */
391          0,                     /* analog index */
392          0,                     /* dif_index */
393          0,                     /* external_index */
394          1,                     /* only one configuration */
395          {
396           {
397            0,                   /* config index */
398            {
399             0,                  /* interrupt ep index */
400             NOT_SUPPORTED,      /* ts1 index */
401             1,                  /* TS2 index */
402             2,                  /* AUDIO */
403             3,                  /* VIDEO */
404             4,                  /* VANC */
405             5,                  /* HANC */
406             NOT_SUPPORTED       /* ir_index */
407             }
408            }
409           ,
410           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
411                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
412                            NOT_SUPPORTED}
413            }
414           ,
415           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
416                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
417                            NOT_SUPPORTED}
418            }
419           }
420          ,
421          /* full-speed  */
422          {
423           {
424            0,                   /* config index */
425            {
426             0,                  /* interrupt ep index */
427             NOT_SUPPORTED,      /* ts1 index */
428             1,                  /* TS2 index */
429             2,                  /* AUDIO */
430             3,                  /* VIDEO */
431             NOT_SUPPORTED,      /* VANC */
432             NOT_SUPPORTED,      /* HANC */
433             NOT_SUPPORTED       /* ir_index */
434             }
435            }
436           ,
437           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
438                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
439                            NOT_SUPPORTED}
440            }
441           ,
442           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
443                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
444                            NOT_SUPPORTED}
445            }
446           }
447          }
448         ,
449
450         {
451          INDEX_BUSPOWER_DIGITAL_ONLY,   /* index */
452          USB_BUS_POWER,         /* power_type */
453          0,                     /* speed , not decide yet */
454          MOD_DIGITAL,           /* mode ,analog tv AND DIGITAL path */
455          SOURCE_TS_BDA,         /* ts1_source, disable */
456          NOT_SUPPORTED,         /* ts2_source */
457          NOT_SUPPORTED,         /* analog source */
458
459          0,                     /* digital_index  */
460          0,                     /* analog index */
461          0,                     /* dif_index */
462          0,                     /* external_index */
463
464          1,                     /* only one configuration */
465          {
466           {
467            0,                   /* config index */
468            {
469             0,                  /* interrupt ep index  = 2 */
470             1,                  /* ts1 index */
471             NOT_SUPPORTED,      /* TS2 index */
472             NOT_SUPPORTED,      /* AUDIO */
473             NOT_SUPPORTED,      /* VIDEO */
474             NOT_SUPPORTED,      /* VANC */
475             NOT_SUPPORTED,      /* HANC */
476             NOT_SUPPORTED       /* ir_index */
477             }
478            }
479           ,
480           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
481                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
482                            NOT_SUPPORTED}
483            }
484           ,
485           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
486                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
487                            NOT_SUPPORTED}
488            }
489           }
490          ,
491          /* full-speed */
492          {
493           {
494            0,                   /* config index */
495            {
496             0,                  /* interrupt ep index  = 2 */
497             1,                  /* ts1 index */
498             NOT_SUPPORTED,      /* TS2 index */
499             NOT_SUPPORTED,      /* AUDIO */
500             NOT_SUPPORTED,      /* VIDEO */
501             NOT_SUPPORTED,      /* VANC */
502             NOT_SUPPORTED,      /* HANC */
503             NOT_SUPPORTED       /* ir_index */
504             }
505            }
506           ,
507           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
508                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
509                            NOT_SUPPORTED}
510            }
511           ,
512           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
513                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
514                            NOT_SUPPORTED}
515            }
516           }
517          }
518         ,
519         {
520          INDEX_BUSPOWER_ANALOG_ONLY,    /* index */
521          USB_BUS_POWER,         /* power_type */
522          0,                     /* speed , not decide yet */
523          MOD_ANALOG,            /* mode ,analog tv AND DIGITAL path */
524          NOT_SUPPORTED,         /* ts1_source, disable */
525          NOT_SUPPORTED,         /* ts2_source */
526          SOURCE_ANALOG,         /* analog source--analog */
527          0,                     /* digital_index  */
528          0,                     /* analog index */
529          0,                     /* dif_index */
530          0,                     /* external_index */
531          1,                     /* only one configuration */
532          {
533           {
534            0,                   /* config index */
535            {
536             0,                  /* interrupt ep index */
537             NOT_SUPPORTED,      /* ts1 index */
538             NOT_SUPPORTED,      /* TS2 index */
539             1,                  /* AUDIO */
540             2,                  /* VIDEO */
541             3,                  /* VANC */
542             4,                  /* HANC */
543             NOT_SUPPORTED       /* ir_index */
544             }
545            }
546           ,
547           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
548                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
549                            NOT_SUPPORTED}
550            }
551           ,
552           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
553                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
554                            NOT_SUPPORTED}
555            }
556           }
557          ,
558          {                      /* full-speed */
559           {
560            0,                   /* config index */
561            {
562             0,                  /* interrupt ep index */
563             NOT_SUPPORTED,      /* ts1 index */
564             NOT_SUPPORTED,      /* TS2 index */
565             1,                  /* AUDIO */
566             2,                  /* VIDEO */
567             NOT_SUPPORTED,      /* VANC */
568             NOT_SUPPORTED,      /* HANC */
569             NOT_SUPPORTED       /* ir_index */
570             }
571            }
572           ,
573           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
574                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
575                            NOT_SUPPORTED}
576            }
577           ,
578           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
579                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
580                            NOT_SUPPORTED}
581            }
582           }
583          }
584         ,
585         {
586          INDEX_BUSPOWER_DIF_ONLY,       /* index */
587          USB_BUS_POWER,         /* power_type */
588          0,                     /* speed , not decide yet */
589          /* mode ,analog tv AND DIGITAL path */
590          MOD_DIF | MOD_ANALOG | MOD_DIGITAL | MOD_EXTERNAL,
591          SOURCE_TS_BDA,         /* ts1_source, disable */
592          NOT_SUPPORTED,         /* ts2_source */
593          SOURCE_DIF | SOURCE_ANALOG | SOURCE_EXTERNAL,  /* analog source, dif */
594          0,                     /* digital_index  */
595          0,                     /* analog index */
596          0,                     /* dif_index */
597          0,                     /* external_index */
598          1,                     /* only one configuration */
599          {
600           {
601            0,                   /* config index */
602            {
603             0,                  /* interrupt ep index */
604             1,                  /* ts1 index */
605             NOT_SUPPORTED,      /* TS2 index */
606             2,                  /* AUDIO */
607             3,                  /* VIDEO */
608             4,                  /* VANC */
609             5,                  /* HANC */
610             NOT_SUPPORTED       /* ir_index */
611             }
612            }
613           ,
614           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
615                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
616                            NOT_SUPPORTED}
617            }
618           ,
619           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
620                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
621                            NOT_SUPPORTED}
622            }
623           }
624          ,
625          {                      /* full speed */
626           {
627            0,                   /* config index */
628            {
629             0,                  /* interrupt ep index */
630             1,                  /* ts1 index */
631             NOT_SUPPORTED,      /* TS2 index */
632             2,                  /* AUDIO */
633             3,                  /* VIDEO */
634             NOT_SUPPORTED,      /* VANC */
635             NOT_SUPPORTED,      /* HANC */
636             NOT_SUPPORTED       /* ir_index */
637             }
638            }
639           ,
640           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
641                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
642                            NOT_SUPPORTED}
643            }
644           ,
645           {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
646                            NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
647                            NOT_SUPPORTED}
648            }
649           }
650          }
651         ,
652
653 };
654
655 /*****************************************************************/
656
657 u32 initialize_cx231xx(struct cx231xx *dev)
658 {
659         u32 config_info = 0;
660         struct pcb_config *p_pcb_info;
661         u8 usb_speed = 1;       /* from register,1--HS, 0--FS  */
662         u8 data[4] = { 0, 0, 0, 0 };
663         u32 ts1_source = 0;
664         u32 ts2_source = 0;
665         u32 analog_source = 0;
666         u8 _current_scenario_idx = 0xff;
667
668         ts1_source = SOURCE_TS_BDA;
669         ts2_source = SOURCE_TS_BDA;
670
671         /* read board config register to find out which
672         pcb config it is related to */
673         cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT, data, 4);
674
675         config_info = *((u32 *) data);
676         usb_speed = (u8) (config_info & 0x1);
677
678         /* Verify this device belongs to Bus power or Self power device */
679         if (config_info & BUS_POWER) {  /* bus-power */
680                 switch (config_info & BUSPOWER_MASK) {
681                 case TS1_PORT | BUS_POWER:
682                         cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY].speed =
683                             usb_speed;
684                         p_pcb_info =
685                             &cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY];
686                         _current_scenario_idx = INDEX_BUSPOWER_DIGITAL_ONLY;
687                         break;
688                 case AVDEC_ENABLE | BUS_POWER:
689                         cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY].speed =
690                             usb_speed;
691                         p_pcb_info =
692                             &cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY];
693                         _current_scenario_idx = INDEX_BUSPOWER_ANALOG_ONLY;
694                         break;
695                 case AVDEC_ENABLE | BUS_POWER | TS1_PORT:
696                         cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY].speed =
697                             usb_speed;
698                         p_pcb_info = &cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY];
699                         _current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY;
700                         break;
701                 default:
702                         cx231xx_info("bad config in buspower!!!!\n");
703                         cx231xx_info("config_info=%x\n",
704                                      (config_info & BUSPOWER_MASK));
705                         return 1;
706                 }
707         } else {                /* self-power */
708
709                 switch (config_info & SELFPOWER_MASK) {
710                 case TS1_PORT | SELF_POWER:
711                         cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY].speed =
712                             usb_speed;
713                         p_pcb_info =
714                             &cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY];
715                         _current_scenario_idx = INDEX_SELFPOWER_DIGITAL_ONLY;
716                         break;
717                 case TS1_TS2_PORT | SELF_POWER:
718                         cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].speed =
719                             usb_speed;
720                         cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].
721                             ts2_source = ts2_source;
722                         p_pcb_info =
723                             &cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL];
724                         _current_scenario_idx = INDEX_SELFPOWER_DUAL_DIGITAL;
725                         break;
726                 case AVDEC_ENABLE | SELF_POWER:
727                         cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].speed =
728                             usb_speed;
729                         cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].
730                             analog_source = analog_source;
731                         p_pcb_info =
732                             &cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY];
733                         _current_scenario_idx = INDEX_SELFPOWER_ANALOG_ONLY;
734                         break;
735                 case AVDEC_ENABLE | TS1_PORT | SELF_POWER:
736                         cx231xx_Scenario[INDEX_SELFPOWER_DUAL].speed =
737                             usb_speed;
738                         cx231xx_Scenario[INDEX_SELFPOWER_DUAL].ts1_source =
739                             ts1_source;
740                         cx231xx_Scenario[INDEX_SELFPOWER_DUAL].analog_source =
741                             analog_source;
742                         p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_DUAL];
743                         _current_scenario_idx = INDEX_SELFPOWER_DUAL;
744                         break;
745                 case AVDEC_ENABLE | TS1_TS2_PORT | SELF_POWER:
746                         cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].speed =
747                             usb_speed;
748                         cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts1_source =
749                             ts1_source;
750                         cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts2_source =
751                             ts2_source;
752                         cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].analog_source =
753                             analog_source;
754                         p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE];
755                         _current_scenario_idx = INDEX_SELFPOWER_TRIPLE;
756                         break;
757                 case AVDEC_ENABLE | TS1VIP_TS2_PORT | SELF_POWER:
758                         cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].speed =
759                             usb_speed;
760                         cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].
761                             analog_source = analog_source;
762                         p_pcb_info =
763                             &cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR];
764                         _current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR;
765                         break;
766                 default:
767                         cx231xx_info("bad senario!!!!!\n");
768                         cx231xx_info("config_info=%x\n",
769                                      (config_info & SELFPOWER_MASK));
770                         return 1;
771                 }
772         }
773
774         dev->current_scenario_idx = _current_scenario_idx;
775
776         memcpy(&dev->current_pcb_config, p_pcb_info,
777                    sizeof(struct pcb_config));
778
779         if (pcb_debug) {
780                 cx231xx_info("SC(0x00) register = 0x%x\n", config_info);
781                 cx231xx_info("scenario %d\n",
782                             (dev->current_pcb_config.index) + 1);
783                 cx231xx_info("type=%x\n", dev->current_pcb_config.type);
784                 cx231xx_info("mode=%x\n", dev->current_pcb_config.mode);
785                 cx231xx_info("speed=%x\n", dev->current_pcb_config.speed);
786                 cx231xx_info("ts1_source=%x\n",
787                              dev->current_pcb_config.ts1_source);
788                 cx231xx_info("ts2_source=%x\n",
789                              dev->current_pcb_config.ts2_source);
790                 cx231xx_info("analog_source=%x\n",
791                              dev->current_pcb_config.analog_source);
792         }
793
794         return 0;
795 }