Linux 2.6.34-rc3
[pohmelfs.git] / drivers / media / video / cx231xx / cx231xx-pcb-cfg.c
blob7473c33e823ef0f1a343c59a7051a117de109067
1 /*
2 cx231xx-pcb-config.c - driver for Conexant
3 Cx23100/101/102 USB video capture devices
5 Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
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.
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.
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.
22 #include "cx231xx.h"
23 #include "cx231xx-conf-reg.h"
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]");
29 /******************************************************************************/
31 struct pcb_config cx231xx_Scenario[] = {
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 */
41 0, /* digital_index */
42 0, /* analog index */
43 0, /* dif_index */
44 0, /* external_index */
46 1, /* only one configuration */
49 0, /* config index */
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 */
63 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
64 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
65 NOT_SUPPORTED}
68 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
69 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
70 NOT_SUPPORTED}
74 /* full-speed config */
77 0, /* config index */
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 */
90 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
91 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
92 NOT_SUPPORTED}
95 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
96 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
97 NOT_SUPPORTED}
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 */
116 1, /* only one configuration */
119 0, /* config index */
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 */
132 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
133 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
134 NOT_SUPPORTED}
137 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
138 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
139 NOT_SUPPORTED}
143 /* full-speed */
146 0, /* config index */
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 */
159 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
160 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
161 NOT_SUPPORTED}
164 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
165 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
166 NOT_SUPPORTED}
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 */
181 0, /* digital_index */
182 0, /* analog index */
183 0, /* dif_index */
184 0, /* external_index */
186 1, /* only one configuration */
189 0, /* config index */
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 */
202 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
203 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
204 NOT_SUPPORTED}
207 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
208 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
209 NOT_SUPPORTED}
213 /* full-speed */
216 0, /* config index */
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 */
229 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
230 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
231 NOT_SUPPORTED}
234 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
235 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
236 NOT_SUPPORTED}
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 */
258 0, /* config index */
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 */
271 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
272 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
273 NOT_SUPPORTED}
276 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
277 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
278 NOT_SUPPORTED}
282 /* full-speed */
285 0, /* config index */
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 */
298 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
299 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
300 NOT_SUPPORTED}
303 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
304 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
305 NOT_SUPPORTED}
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 */
321 0, /* digital_index */
322 0, /* analog index */
323 0, /* dif_index */
324 0, /* external_index */
325 1, /* only one configuration */
328 0, /* config index */
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 */
341 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
342 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
343 NOT_SUPPORTED}
346 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
347 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
348 NOT_SUPPORTED}
352 /* full-speed */
355 0, /* config index */
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 */
368 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
369 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
370 NOT_SUPPORTED}
373 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
374 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
375 NOT_SUPPORTED}
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 */
397 0, /* config index */
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 */
410 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
411 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
412 NOT_SUPPORTED}
415 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
416 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
417 NOT_SUPPORTED}
421 /* full-speed */
424 0, /* config index */
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 */
437 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
438 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
439 NOT_SUPPORTED}
442 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
443 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
444 NOT_SUPPORTED}
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 */
459 0, /* digital_index */
460 0, /* analog index */
461 0, /* dif_index */
462 0, /* external_index */
464 1, /* only one configuration */
467 0, /* config index */
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 */
480 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
481 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
482 NOT_SUPPORTED}
485 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
486 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
487 NOT_SUPPORTED}
491 /* full-speed */
494 0, /* config index */
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 */
507 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
508 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
509 NOT_SUPPORTED}
512 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
513 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
514 NOT_SUPPORTED}
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 */
534 0, /* config index */
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 */
547 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
548 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
549 NOT_SUPPORTED}
552 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
553 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
554 NOT_SUPPORTED}
558 { /* full-speed */
560 0, /* config index */
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 */
573 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
574 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
575 NOT_SUPPORTED}
578 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
579 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
580 NOT_SUPPORTED}
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 */
601 0, /* config index */
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 */
614 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
615 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
616 NOT_SUPPORTED}
619 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
620 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
621 NOT_SUPPORTED}
625 { /* full speed */
627 0, /* config index */
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 */
640 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
641 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
642 NOT_SUPPORTED}
645 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
646 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
647 NOT_SUPPORTED}
655 /*****************************************************************/
657 u32 initialize_cx231xx(struct cx231xx *dev)
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;
668 ts1_source = SOURCE_TS_BDA;
669 ts2_source = SOURCE_TS_BDA;
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);
675 config_info = *((u32 *) data);
676 usb_speed = (u8) (config_info & 0x1);
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;
707 } else { /* self-power */
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;
774 dev->current_scenario_idx = _current_scenario_idx;
776 memcpy(&dev->current_pcb_config, p_pcb_info,
777 sizeof(struct pcb_config));
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);
794 return 0;