treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / media / usb / cx231xx / cx231xx-pcb-cfg.c
blobbba4cfdb869c027d131e4cdec2174802b304a782
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 cx231xx-pcb-config.c - driver for Conexant
4 Cx23100/101/102 USB video capture devices
6 Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
8 */
10 #include "cx231xx.h"
11 #include "cx231xx-conf-reg.h"
13 static unsigned int pcb_debug;
14 module_param(pcb_debug, int, 0644);
15 MODULE_PARM_DESC(pcb_debug, "enable pcb config debug messages [video]");
17 /******************************************************************************/
19 static struct pcb_config cx231xx_Scenario[] = {
21 INDEX_SELFPOWER_DIGITAL_ONLY, /* index */
22 USB_SELF_POWER, /* power_type */
23 0, /* speed , not decide yet */
24 MOD_DIGITAL, /* mode */
25 SOURCE_TS_BDA, /* ts1_source, digital tv only */
26 NOT_SUPPORTED, /* ts2_source */
27 NOT_SUPPORTED, /* analog source */
29 0, /* digital_index */
30 0, /* analog index */
31 0, /* dif_index */
32 0, /* external_index */
34 1, /* only one configuration */
37 0, /* config index */
39 0, /* interrupt ep index */
40 1, /* ts1 index */
41 NOT_SUPPORTED, /* TS2 index */
42 NOT_SUPPORTED, /* AUDIO */
43 NOT_SUPPORTED, /* VIDEO */
44 NOT_SUPPORTED, /* VANC */
45 NOT_SUPPORTED, /* HANC */
46 NOT_SUPPORTED /* ir_index */
51 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
52 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
53 NOT_SUPPORTED}
56 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
57 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
58 NOT_SUPPORTED}
62 /* full-speed config */
65 0, /* config index */
67 0, /* interrupt ep index */
68 1, /* ts1 index */
69 NOT_SUPPORTED, /* TS2 index */
70 NOT_SUPPORTED, /* AUDIO */
71 NOT_SUPPORTED, /* VIDEO */
72 NOT_SUPPORTED, /* VANC */
73 NOT_SUPPORTED, /* HANC */
74 NOT_SUPPORTED /* ir_index */
78 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
79 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
80 NOT_SUPPORTED}
83 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
84 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
85 NOT_SUPPORTED}
92 INDEX_SELFPOWER_DUAL_DIGITAL, /* index */
93 USB_SELF_POWER, /* power_type */
94 0, /* speed , not decide yet */
95 MOD_DIGITAL, /* mode */
96 SOURCE_TS_BDA, /* ts1_source, digital tv only */
97 0, /* ts2_source,need update from register */
98 NOT_SUPPORTED, /* analog source */
99 0, /* digital_index */
100 0, /* analog index */
101 0, /* dif_index */
102 0, /* external_index */
104 1, /* only one configuration */
107 0, /* config index */
109 0, /* interrupt ep index */
110 1, /* ts1 index */
111 2, /* TS2 index */
112 NOT_SUPPORTED, /* AUDIO */
113 NOT_SUPPORTED, /* VIDEO */
114 NOT_SUPPORTED, /* VANC */
115 NOT_SUPPORTED, /* HANC */
116 NOT_SUPPORTED /* ir_index */
120 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
121 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
122 NOT_SUPPORTED}
125 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
126 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
127 NOT_SUPPORTED}
131 /* full-speed */
134 0, /* config index */
136 0, /* interrupt ep index */
137 1, /* ts1 index */
138 2, /* TS2 index */
139 NOT_SUPPORTED, /* AUDIO */
140 NOT_SUPPORTED, /* VIDEO */
141 NOT_SUPPORTED, /* VANC */
142 NOT_SUPPORTED, /* HANC */
143 NOT_SUPPORTED /* ir_index */
147 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
148 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
149 NOT_SUPPORTED}
152 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
153 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
154 NOT_SUPPORTED}
161 INDEX_SELFPOWER_ANALOG_ONLY, /* index */
162 USB_SELF_POWER, /* power_type */
163 0, /* speed , not decide yet */
164 MOD_ANALOG | MOD_DIF | MOD_EXTERNAL, /* mode ,analog tv only */
165 NOT_SUPPORTED, /* ts1_source, NOT SUPPORT */
166 NOT_SUPPORTED, /* ts2_source,NOT SUPPORT */
167 0, /* analog source, need update */
169 0, /* digital_index */
170 0, /* analog index */
171 0, /* dif_index */
172 0, /* external_index */
174 1, /* only one configuration */
177 0, /* config index */
179 0, /* interrupt ep index */
180 NOT_SUPPORTED, /* ts1 index */
181 NOT_SUPPORTED, /* TS2 index */
182 1, /* AUDIO */
183 2, /* VIDEO */
184 3, /* VANC */
185 4, /* HANC */
186 NOT_SUPPORTED /* ir_index */
190 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
191 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
192 NOT_SUPPORTED}
195 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
196 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
197 NOT_SUPPORTED}
201 /* full-speed */
204 0, /* config index */
206 0, /* interrupt ep index */
207 NOT_SUPPORTED, /* ts1 index */
208 NOT_SUPPORTED, /* TS2 index */
209 1, /* AUDIO */
210 2, /* VIDEO */
211 NOT_SUPPORTED, /* VANC */
212 NOT_SUPPORTED, /* HANC */
213 NOT_SUPPORTED /* ir_index */
217 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
218 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
219 NOT_SUPPORTED}
222 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
223 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
224 NOT_SUPPORTED}
231 INDEX_SELFPOWER_DUAL, /* index */
232 USB_SELF_POWER, /* power_type */
233 0, /* speed , not decide yet */
234 /* mode ,analog tv and digital path */
235 MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
236 0, /* ts1_source,will update in register */
237 NOT_SUPPORTED, /* ts2_source,NOT SUPPORT */
238 0, /* analog source need update */
239 0, /* digital_index */
240 0, /* analog index */
241 0, /* dif_index */
242 0, /* external_index */
243 1, /* only one configuration */
246 0, /* config index */
248 0, /* interrupt ep index */
249 1, /* ts1 index */
250 NOT_SUPPORTED, /* TS2 index */
251 2, /* AUDIO */
252 3, /* VIDEO */
253 4, /* VANC */
254 5, /* HANC */
255 NOT_SUPPORTED /* ir_index */
259 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
260 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
261 NOT_SUPPORTED}
264 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
265 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
266 NOT_SUPPORTED}
270 /* full-speed */
273 0, /* config index */
275 0, /* interrupt ep index */
276 1, /* ts1 index */
277 NOT_SUPPORTED, /* TS2 index */
278 2, /* AUDIO */
279 3, /* VIDEO */
280 NOT_SUPPORTED, /* VANC */
281 NOT_SUPPORTED, /* HANC */
282 NOT_SUPPORTED /* ir_index */
286 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
287 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
288 NOT_SUPPORTED}
291 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
292 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
293 NOT_SUPPORTED}
300 INDEX_SELFPOWER_TRIPLE, /* index */
301 USB_SELF_POWER, /* power_type */
302 0, /* speed , not decide yet */
303 /* mode ,analog tv and digital path */
304 MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
305 0, /* ts1_source, update in register */
306 0, /* ts2_source,update in register */
307 0, /* analog source, need update */
309 0, /* digital_index */
310 0, /* analog index */
311 0, /* dif_index */
312 0, /* external_index */
313 1, /* only one configuration */
316 0, /* config index */
318 0, /* interrupt ep index */
319 1, /* ts1 index */
320 2, /* TS2 index */
321 3, /* AUDIO */
322 4, /* VIDEO */
323 5, /* VANC */
324 6, /* HANC */
325 NOT_SUPPORTED /* ir_index */
329 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
330 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
331 NOT_SUPPORTED}
334 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
335 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
336 NOT_SUPPORTED}
340 /* full-speed */
343 0, /* config index */
345 0, /* interrupt ep index */
346 1, /* ts1 index */
347 2, /* TS2 index */
348 3, /* AUDIO */
349 4, /* VIDEO */
350 NOT_SUPPORTED, /* VANC */
351 NOT_SUPPORTED, /* HANC */
352 NOT_SUPPORTED /* ir_index */
356 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
357 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
358 NOT_SUPPORTED}
361 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
362 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
363 NOT_SUPPORTED}
370 INDEX_SELFPOWER_COMPRESSOR, /* index */
371 USB_SELF_POWER, /* power_type */
372 0, /* speed , not decide yet */
373 /* mode ,analog tv AND DIGITAL path */
374 MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
375 NOT_SUPPORTED, /* ts1_source, disable */
376 SOURCE_TS_BDA, /* ts2_source */
377 0, /* analog source,need update */
378 0, /* digital_index */
379 0, /* analog index */
380 0, /* dif_index */
381 0, /* external_index */
382 1, /* only one configuration */
385 0, /* config index */
387 0, /* interrupt ep index */
388 NOT_SUPPORTED, /* ts1 index */
389 1, /* TS2 index */
390 2, /* AUDIO */
391 3, /* VIDEO */
392 4, /* VANC */
393 5, /* HANC */
394 NOT_SUPPORTED /* ir_index */
398 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
399 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
400 NOT_SUPPORTED}
403 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
404 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
405 NOT_SUPPORTED}
409 /* full-speed */
412 0, /* config index */
414 0, /* interrupt ep index */
415 NOT_SUPPORTED, /* ts1 index */
416 1, /* TS2 index */
417 2, /* AUDIO */
418 3, /* VIDEO */
419 NOT_SUPPORTED, /* VANC */
420 NOT_SUPPORTED, /* HANC */
421 NOT_SUPPORTED /* ir_index */
425 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
426 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
427 NOT_SUPPORTED}
430 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
431 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
432 NOT_SUPPORTED}
439 INDEX_BUSPOWER_DIGITAL_ONLY, /* index */
440 USB_BUS_POWER, /* power_type */
441 0, /* speed , not decide yet */
442 MOD_DIGITAL, /* mode ,analog tv AND DIGITAL path */
443 SOURCE_TS_BDA, /* ts1_source, disable */
444 NOT_SUPPORTED, /* ts2_source */
445 NOT_SUPPORTED, /* analog source */
447 0, /* digital_index */
448 0, /* analog index */
449 0, /* dif_index */
450 0, /* external_index */
452 1, /* only one configuration */
455 0, /* config index */
457 0, /* interrupt ep index = 2 */
458 1, /* ts1 index */
459 NOT_SUPPORTED, /* TS2 index */
460 NOT_SUPPORTED, /* AUDIO */
461 NOT_SUPPORTED, /* VIDEO */
462 NOT_SUPPORTED, /* VANC */
463 NOT_SUPPORTED, /* HANC */
464 NOT_SUPPORTED /* ir_index */
468 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
469 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
470 NOT_SUPPORTED}
473 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
474 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
475 NOT_SUPPORTED}
479 /* full-speed */
482 0, /* config index */
484 0, /* interrupt ep index = 2 */
485 1, /* ts1 index */
486 NOT_SUPPORTED, /* TS2 index */
487 NOT_SUPPORTED, /* AUDIO */
488 NOT_SUPPORTED, /* VIDEO */
489 NOT_SUPPORTED, /* VANC */
490 NOT_SUPPORTED, /* HANC */
491 NOT_SUPPORTED /* ir_index */
495 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
496 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
497 NOT_SUPPORTED}
500 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
501 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
502 NOT_SUPPORTED}
508 INDEX_BUSPOWER_ANALOG_ONLY, /* index */
509 USB_BUS_POWER, /* power_type */
510 0, /* speed , not decide yet */
511 MOD_ANALOG, /* mode ,analog tv AND DIGITAL path */
512 NOT_SUPPORTED, /* ts1_source, disable */
513 NOT_SUPPORTED, /* ts2_source */
514 SOURCE_ANALOG, /* analog source--analog */
515 0, /* digital_index */
516 0, /* analog index */
517 0, /* dif_index */
518 0, /* external_index */
519 1, /* only one configuration */
522 0, /* config index */
524 0, /* interrupt ep index */
525 NOT_SUPPORTED, /* ts1 index */
526 NOT_SUPPORTED, /* TS2 index */
527 1, /* AUDIO */
528 2, /* VIDEO */
529 3, /* VANC */
530 4, /* HANC */
531 NOT_SUPPORTED /* ir_index */
535 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
536 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
537 NOT_SUPPORTED}
540 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
541 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
542 NOT_SUPPORTED}
546 { /* full-speed */
548 0, /* config index */
550 0, /* interrupt ep index */
551 NOT_SUPPORTED, /* ts1 index */
552 NOT_SUPPORTED, /* TS2 index */
553 1, /* AUDIO */
554 2, /* VIDEO */
555 NOT_SUPPORTED, /* VANC */
556 NOT_SUPPORTED, /* HANC */
557 NOT_SUPPORTED /* ir_index */
561 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
562 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
563 NOT_SUPPORTED}
566 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
567 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
568 NOT_SUPPORTED}
574 INDEX_BUSPOWER_DIF_ONLY, /* index */
575 USB_BUS_POWER, /* power_type */
576 0, /* speed , not decide yet */
577 /* mode ,analog tv AND DIGITAL path */
578 MOD_DIF | MOD_ANALOG | MOD_DIGITAL | MOD_EXTERNAL,
579 SOURCE_TS_BDA, /* ts1_source, disable */
580 NOT_SUPPORTED, /* ts2_source */
581 SOURCE_DIF | SOURCE_ANALOG | SOURCE_EXTERNAL, /* analog source, dif */
582 0, /* digital_index */
583 0, /* analog index */
584 0, /* dif_index */
585 0, /* external_index */
586 1, /* only one configuration */
589 0, /* config index */
591 0, /* interrupt ep index */
592 1, /* ts1 index */
593 NOT_SUPPORTED, /* TS2 index */
594 2, /* AUDIO */
595 3, /* VIDEO */
596 4, /* VANC */
597 5, /* HANC */
598 NOT_SUPPORTED /* ir_index */
602 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
603 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
604 NOT_SUPPORTED}
607 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
608 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
609 NOT_SUPPORTED}
613 { /* full speed */
615 0, /* config index */
617 0, /* interrupt ep index */
618 1, /* ts1 index */
619 NOT_SUPPORTED, /* TS2 index */
620 2, /* AUDIO */
621 3, /* VIDEO */
622 NOT_SUPPORTED, /* VANC */
623 NOT_SUPPORTED, /* HANC */
624 NOT_SUPPORTED /* ir_index */
628 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
629 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
630 NOT_SUPPORTED}
633 {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
634 NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
635 NOT_SUPPORTED}
643 /*****************************************************************/
645 int initialize_cx231xx(struct cx231xx *dev)
647 int retval;
648 u32 config_info = 0;
649 struct pcb_config *p_pcb_info;
650 u8 usb_speed = 1; /* from register,1--HS, 0--FS */
651 u8 data[4] = { 0, 0, 0, 0 };
652 u32 ts1_source = 0;
653 u32 ts2_source = 0;
654 u32 analog_source = 0;
655 u8 _current_scenario_idx = 0xff;
657 ts1_source = SOURCE_TS_BDA;
658 ts2_source = SOURCE_TS_BDA;
660 /* read board config register to find out which
661 pcb config it is related to */
662 retval = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT,
663 data, 4);
664 if (retval < 0)
665 return retval;
667 config_info = le32_to_cpu(*((__le32 *)data));
668 usb_speed = (u8) (config_info & 0x1);
670 /* Verify this device belongs to Bus power or Self power device */
671 if (config_info & BUS_POWER) { /* bus-power */
672 switch (config_info & BUSPOWER_MASK) {
673 case TS1_PORT | BUS_POWER:
674 cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY].speed =
675 usb_speed;
676 p_pcb_info =
677 &cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY];
678 _current_scenario_idx = INDEX_BUSPOWER_DIGITAL_ONLY;
679 break;
680 case AVDEC_ENABLE | BUS_POWER:
681 cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY].speed =
682 usb_speed;
683 p_pcb_info =
684 &cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY];
685 _current_scenario_idx = INDEX_BUSPOWER_ANALOG_ONLY;
686 break;
687 case AVDEC_ENABLE | BUS_POWER | TS1_PORT:
688 cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY].speed =
689 usb_speed;
690 p_pcb_info = &cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY];
691 _current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY;
692 break;
693 default:
694 dev_err(dev->dev,
695 "bad config in buspower!!!!\nconfig_info=%x\n",
696 config_info & BUSPOWER_MASK);
697 return 1;
699 } else { /* self-power */
701 switch (config_info & SELFPOWER_MASK) {
702 case TS1_PORT | SELF_POWER:
703 cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY].speed =
704 usb_speed;
705 p_pcb_info =
706 &cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY];
707 _current_scenario_idx = INDEX_SELFPOWER_DIGITAL_ONLY;
708 break;
709 case TS1_TS2_PORT | SELF_POWER:
710 cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].speed =
711 usb_speed;
712 cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].
713 ts2_source = ts2_source;
714 p_pcb_info =
715 &cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL];
716 _current_scenario_idx = INDEX_SELFPOWER_DUAL_DIGITAL;
717 break;
718 case AVDEC_ENABLE | SELF_POWER:
719 cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].speed =
720 usb_speed;
721 cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].
722 analog_source = analog_source;
723 p_pcb_info =
724 &cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY];
725 _current_scenario_idx = INDEX_SELFPOWER_ANALOG_ONLY;
726 break;
727 case AVDEC_ENABLE | TS1_PORT | SELF_POWER:
728 cx231xx_Scenario[INDEX_SELFPOWER_DUAL].speed =
729 usb_speed;
730 cx231xx_Scenario[INDEX_SELFPOWER_DUAL].ts1_source =
731 ts1_source;
732 cx231xx_Scenario[INDEX_SELFPOWER_DUAL].analog_source =
733 analog_source;
734 p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_DUAL];
735 _current_scenario_idx = INDEX_SELFPOWER_DUAL;
736 break;
737 case AVDEC_ENABLE | TS1_TS2_PORT | SELF_POWER:
738 cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].speed =
739 usb_speed;
740 cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts1_source =
741 ts1_source;
742 cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts2_source =
743 ts2_source;
744 cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].analog_source =
745 analog_source;
746 p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE];
747 _current_scenario_idx = INDEX_SELFPOWER_TRIPLE;
748 break;
749 case AVDEC_ENABLE | TS1VIP_TS2_PORT | SELF_POWER:
750 cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].speed =
751 usb_speed;
752 cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].
753 analog_source = analog_source;
754 p_pcb_info =
755 &cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR];
756 _current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR;
757 break;
758 default:
759 dev_err(dev->dev,
760 "bad scenario!!!!!\nconfig_info=%x\n",
761 config_info & SELFPOWER_MASK);
762 return -ENODEV;
766 dev->current_scenario_idx = _current_scenario_idx;
768 memcpy(&dev->current_pcb_config, p_pcb_info,
769 sizeof(struct pcb_config));
771 if (pcb_debug) {
772 dev_info(dev->dev,
773 "SC(0x00) register = 0x%x\n", config_info);
774 dev_info(dev->dev,
775 "scenario %d\n",
776 (dev->current_pcb_config.index) + 1);
777 dev_info(dev->dev,
778 "type=%x\n",
779 dev->current_pcb_config.type);
780 dev_info(dev->dev,
781 "mode=%x\n",
782 dev->current_pcb_config.mode);
783 dev_info(dev->dev,
784 "speed=%x\n",
785 dev->current_pcb_config.speed);
786 dev_info(dev->dev,
787 "ts1_source=%x\n",
788 dev->current_pcb_config.ts1_source);
789 dev_info(dev->dev,
790 "ts2_source=%x\n",
791 dev->current_pcb_config.ts2_source);
792 dev_info(dev->dev,
793 "analog_source=%x\n",
794 dev->current_pcb_config.analog_source);
797 return 0;