2 * Driver for the Conexant CX23885 PCIe bridge
4 * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * 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 <linux/init.h>
23 #include <linux/module.h>
24 #include <linux/pci.h>
25 #include <linux/delay.h>
26 #include <media/cx25840.h>
27 #include <linux/firmware.h>
28 #include <misc/altera.h>
31 #include "tuner-xc2028.h"
32 #include "netup-eeprom.h"
33 #include "netup-init.h"
34 #include "altera-ci.h"
37 #include "cx23888-ir.h"
39 static unsigned int netup_card_rev
= 4;
40 module_param(netup_card_rev
, int, 0644);
41 MODULE_PARM_DESC(netup_card_rev
,
42 "NetUP Dual DVB-T/C CI card revision");
43 static unsigned int enable_885_ir
;
44 module_param(enable_885_ir
, int, 0644);
45 MODULE_PARM_DESC(enable_885_ir
,
46 "Enable integrated IR controller for supported\n"
47 "\t\t CX2388[57] boards that are wired for it:\n"
48 "\t\t\tHVR-1250 (reported safe)\n"
49 "\t\t\tTerraTec Cinergy T PCIe Dual (not well tested, appears to be safe)\n"
50 "\t\t\tTeVii S470 (reported unsafe)\n"
51 "\t\t This can cause an interrupt storm with some cards.\n"
52 "\t\t Default: 0 [Disabled]");
54 /* ------------------------------------------------------------------ */
55 /* board config info */
57 struct cx23885_board cx23885_boards
[] = {
58 [CX23885_BOARD_UNKNOWN
] = {
59 .name
= "UNKNOWN/GENERIC",
60 /* Ensure safe default for unknown boards */
63 .type
= CX23885_VMUX_COMPOSITE1
,
66 .type
= CX23885_VMUX_COMPOSITE2
,
69 .type
= CX23885_VMUX_COMPOSITE3
,
72 .type
= CX23885_VMUX_COMPOSITE4
,
76 [CX23885_BOARD_HAUPPAUGE_HVR1800lp
] = {
77 .name
= "Hauppauge WinTV-HVR1800lp",
78 .portc
= CX23885_MPEG_DVB
,
80 .type
= CX23885_VMUX_TELEVISION
,
84 .type
= CX23885_VMUX_DEBUG
,
88 .type
= CX23885_VMUX_COMPOSITE1
,
92 .type
= CX23885_VMUX_SVIDEO
,
97 [CX23885_BOARD_HAUPPAUGE_HVR1800
] = {
98 .name
= "Hauppauge WinTV-HVR1800",
99 .porta
= CX23885_ANALOG_VIDEO
,
100 .portb
= CX23885_MPEG_ENCODER
,
101 .portc
= CX23885_MPEG_DVB
,
102 .tuner_type
= TUNER_PHILIPS_TDA8290
,
103 .tuner_addr
= 0x42, /* 0x84 >> 1 */
106 .type
= CX23885_VMUX_TELEVISION
,
107 .vmux
= CX25840_VIN7_CH3
|
110 .amux
= CX25840_AUDIO8
,
113 .type
= CX23885_VMUX_COMPOSITE1
,
114 .vmux
= CX25840_VIN7_CH3
|
117 .amux
= CX25840_AUDIO7
,
120 .type
= CX23885_VMUX_SVIDEO
,
121 .vmux
= CX25840_VIN7_CH3
|
125 .amux
= CX25840_AUDIO7
,
129 [CX23885_BOARD_HAUPPAUGE_HVR1250
] = {
130 .name
= "Hauppauge WinTV-HVR1250",
131 .porta
= CX23885_ANALOG_VIDEO
,
132 .portc
= CX23885_MPEG_DVB
,
133 #ifdef MT2131_NO_ANALOG_SUPPORT_YET
134 .tuner_type
= TUNER_PHILIPS_TDA8290
,
135 .tuner_addr
= 0x42, /* 0x84 >> 1 */
140 #ifdef MT2131_NO_ANALOG_SUPPORT_YET
141 .type
= CX23885_VMUX_TELEVISION
,
142 .vmux
= CX25840_VIN7_CH3
|
145 .amux
= CX25840_AUDIO8
,
149 .type
= CX23885_VMUX_COMPOSITE1
,
150 .vmux
= CX25840_VIN7_CH3
|
153 .amux
= CX25840_AUDIO7
,
156 .type
= CX23885_VMUX_SVIDEO
,
157 .vmux
= CX25840_VIN7_CH3
|
161 .amux
= CX25840_AUDIO7
,
165 [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP
] = {
166 .name
= "DViCO FusionHDTV5 Express",
167 .portb
= CX23885_MPEG_DVB
,
169 [CX23885_BOARD_HAUPPAUGE_HVR1500Q
] = {
170 .name
= "Hauppauge WinTV-HVR1500Q",
171 .portc
= CX23885_MPEG_DVB
,
173 [CX23885_BOARD_HAUPPAUGE_HVR1500
] = {
174 .name
= "Hauppauge WinTV-HVR1500",
175 .porta
= CX23885_ANALOG_VIDEO
,
176 .portc
= CX23885_MPEG_DVB
,
177 .tuner_type
= TUNER_XC2028
,
178 .tuner_addr
= 0x61, /* 0xc2 >> 1 */
180 .type
= CX23885_VMUX_TELEVISION
,
181 .vmux
= CX25840_VIN7_CH3
|
186 .type
= CX23885_VMUX_COMPOSITE1
,
187 .vmux
= CX25840_VIN7_CH3
|
192 .type
= CX23885_VMUX_SVIDEO
,
193 .vmux
= CX25840_VIN7_CH3
|
200 [CX23885_BOARD_HAUPPAUGE_HVR1200
] = {
201 .name
= "Hauppauge WinTV-HVR1200",
202 .portc
= CX23885_MPEG_DVB
,
204 [CX23885_BOARD_HAUPPAUGE_HVR1700
] = {
205 .name
= "Hauppauge WinTV-HVR1700",
206 .portc
= CX23885_MPEG_DVB
,
208 [CX23885_BOARD_HAUPPAUGE_HVR1400
] = {
209 .name
= "Hauppauge WinTV-HVR1400",
210 .portc
= CX23885_MPEG_DVB
,
212 [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP
] = {
213 .name
= "DViCO FusionHDTV7 Dual Express",
214 .portb
= CX23885_MPEG_DVB
,
215 .portc
= CX23885_MPEG_DVB
,
217 [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
] = {
218 .name
= "DViCO FusionHDTV DVB-T Dual Express",
219 .portb
= CX23885_MPEG_DVB
,
220 .portc
= CX23885_MPEG_DVB
,
222 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
] = {
223 .name
= "Leadtek Winfast PxDVR3200 H",
224 .portc
= CX23885_MPEG_DVB
,
226 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
] = {
227 .name
= "Leadtek Winfast PxDVR3200 H XC4000",
228 .porta
= CX23885_ANALOG_VIDEO
,
229 .portc
= CX23885_MPEG_DVB
,
230 .tuner_type
= TUNER_XC4000
,
233 .radio_addr
= ADDR_UNSET
,
235 .type
= CX23885_VMUX_TELEVISION
,
236 .vmux
= CX25840_VIN2_CH1
|
240 .type
= CX23885_VMUX_COMPOSITE1
,
241 .vmux
= CX25840_COMPOSITE1
,
243 .type
= CX23885_VMUX_SVIDEO
,
244 .vmux
= CX25840_SVIDEO_LUMA3
|
245 CX25840_SVIDEO_CHROMA4
,
247 .type
= CX23885_VMUX_COMPONENT
,
248 .vmux
= CX25840_VIN7_CH1
|
251 CX25840_COMPONENT_ON
,
254 [CX23885_BOARD_COMPRO_VIDEOMATE_E650F
] = {
255 .name
= "Compro VideoMate E650F",
256 .portc
= CX23885_MPEG_DVB
,
258 [CX23885_BOARD_TBS_6920
] = {
259 .name
= "TurboSight TBS 6920",
260 .portb
= CX23885_MPEG_DVB
,
262 [CX23885_BOARD_TEVII_S470
] = {
263 .name
= "TeVii S470",
264 .portb
= CX23885_MPEG_DVB
,
266 [CX23885_BOARD_DVBWORLD_2005
] = {
267 .name
= "DVBWorld DVB-S2 2005",
268 .portb
= CX23885_MPEG_DVB
,
270 [CX23885_BOARD_NETUP_DUAL_DVBS2_CI
] = {
272 .name
= "NetUP Dual DVB-S2 CI",
273 .portb
= CX23885_MPEG_DVB
,
274 .portc
= CX23885_MPEG_DVB
,
276 [CX23885_BOARD_HAUPPAUGE_HVR1270
] = {
277 .name
= "Hauppauge WinTV-HVR1270",
278 .portc
= CX23885_MPEG_DVB
,
280 [CX23885_BOARD_HAUPPAUGE_HVR1275
] = {
281 .name
= "Hauppauge WinTV-HVR1275",
282 .portc
= CX23885_MPEG_DVB
,
284 [CX23885_BOARD_HAUPPAUGE_HVR1255
] = {
285 .name
= "Hauppauge WinTV-HVR1255",
286 .porta
= CX23885_ANALOG_VIDEO
,
287 .portc
= CX23885_MPEG_DVB
,
288 .tuner_type
= TUNER_ABSENT
,
289 .tuner_addr
= 0x42, /* 0x84 >> 1 */
292 .type
= CX23885_VMUX_TELEVISION
,
293 .vmux
= CX25840_VIN7_CH3
|
297 .amux
= CX25840_AUDIO8
,
299 .type
= CX23885_VMUX_COMPOSITE1
,
300 .vmux
= CX25840_VIN7_CH3
|
303 .amux
= CX25840_AUDIO7
,
305 .type
= CX23885_VMUX_SVIDEO
,
306 .vmux
= CX25840_VIN7_CH3
|
310 .amux
= CX25840_AUDIO7
,
313 [CX23885_BOARD_HAUPPAUGE_HVR1255_22111
] = {
314 .name
= "Hauppauge WinTV-HVR1255",
315 .porta
= CX23885_ANALOG_VIDEO
,
316 .portc
= CX23885_MPEG_DVB
,
317 .tuner_type
= TUNER_ABSENT
,
318 .tuner_addr
= 0x42, /* 0x84 >> 1 */
321 .type
= CX23885_VMUX_TELEVISION
,
322 .vmux
= CX25840_VIN7_CH3
|
326 .amux
= CX25840_AUDIO8
,
328 .type
= CX23885_VMUX_SVIDEO
,
329 .vmux
= CX25840_VIN7_CH3
|
333 .amux
= CX25840_AUDIO7
,
336 [CX23885_BOARD_HAUPPAUGE_HVR1210
] = {
337 .name
= "Hauppauge WinTV-HVR1210",
338 .portc
= CX23885_MPEG_DVB
,
340 [CX23885_BOARD_MYGICA_X8506
] = {
341 .name
= "Mygica X8506 DMB-TH",
342 .tuner_type
= TUNER_XC5000
,
345 .porta
= CX23885_ANALOG_VIDEO
,
346 .portb
= CX23885_MPEG_DVB
,
349 .type
= CX23885_VMUX_TELEVISION
,
350 .vmux
= CX25840_COMPOSITE2
,
353 .type
= CX23885_VMUX_COMPOSITE1
,
354 .vmux
= CX25840_COMPOSITE8
,
357 .type
= CX23885_VMUX_SVIDEO
,
358 .vmux
= CX25840_SVIDEO_LUMA3
|
359 CX25840_SVIDEO_CHROMA4
,
362 .type
= CX23885_VMUX_COMPONENT
,
363 .vmux
= CX25840_COMPONENT_ON
|
370 [CX23885_BOARD_MAGICPRO_PROHDTVE2
] = {
371 .name
= "Magic-Pro ProHDTV Extreme 2",
372 .tuner_type
= TUNER_XC5000
,
375 .porta
= CX23885_ANALOG_VIDEO
,
376 .portb
= CX23885_MPEG_DVB
,
379 .type
= CX23885_VMUX_TELEVISION
,
380 .vmux
= CX25840_COMPOSITE2
,
383 .type
= CX23885_VMUX_COMPOSITE1
,
384 .vmux
= CX25840_COMPOSITE8
,
387 .type
= CX23885_VMUX_SVIDEO
,
388 .vmux
= CX25840_SVIDEO_LUMA3
|
389 CX25840_SVIDEO_CHROMA4
,
392 .type
= CX23885_VMUX_COMPONENT
,
393 .vmux
= CX25840_COMPONENT_ON
|
400 [CX23885_BOARD_HAUPPAUGE_HVR1850
] = {
401 .name
= "Hauppauge WinTV-HVR1850",
402 .porta
= CX23885_ANALOG_VIDEO
,
403 .portb
= CX23885_MPEG_ENCODER
,
404 .portc
= CX23885_MPEG_DVB
,
405 .tuner_type
= TUNER_ABSENT
,
406 .tuner_addr
= 0x42, /* 0x84 >> 1 */
409 .type
= CX23885_VMUX_TELEVISION
,
410 .vmux
= CX25840_VIN7_CH3
|
414 .amux
= CX25840_AUDIO8
,
416 .type
= CX23885_VMUX_COMPOSITE1
,
417 .vmux
= CX25840_VIN7_CH3
|
420 .amux
= CX25840_AUDIO7
,
422 .type
= CX23885_VMUX_SVIDEO
,
423 .vmux
= CX25840_VIN7_CH3
|
427 .amux
= CX25840_AUDIO7
,
430 [CX23885_BOARD_COMPRO_VIDEOMATE_E800
] = {
431 .name
= "Compro VideoMate E800",
432 .portc
= CX23885_MPEG_DVB
,
434 [CX23885_BOARD_HAUPPAUGE_HVR1290
] = {
435 .name
= "Hauppauge WinTV-HVR1290",
436 .portc
= CX23885_MPEG_DVB
,
438 [CX23885_BOARD_MYGICA_X8558PRO
] = {
439 .name
= "Mygica X8558 PRO DMB-TH",
440 .portb
= CX23885_MPEG_DVB
,
441 .portc
= CX23885_MPEG_DVB
,
443 [CX23885_BOARD_LEADTEK_WINFAST_PXTV1200
] = {
444 .name
= "LEADTEK WinFast PxTV1200",
445 .porta
= CX23885_ANALOG_VIDEO
,
446 .tuner_type
= TUNER_XC2028
,
450 .type
= CX23885_VMUX_TELEVISION
,
451 .vmux
= CX25840_VIN2_CH1
|
455 .type
= CX23885_VMUX_COMPOSITE1
,
456 .vmux
= CX25840_COMPOSITE1
,
458 .type
= CX23885_VMUX_SVIDEO
,
459 .vmux
= CX25840_SVIDEO_LUMA3
|
460 CX25840_SVIDEO_CHROMA4
,
462 .type
= CX23885_VMUX_COMPONENT
,
463 .vmux
= CX25840_VIN7_CH1
|
466 CX25840_COMPONENT_ON
,
469 [CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
] = {
470 .name
= "GoTView X5 3D Hybrid",
471 .tuner_type
= TUNER_XC5000
,
474 .porta
= CX23885_ANALOG_VIDEO
,
475 .portb
= CX23885_MPEG_DVB
,
477 .type
= CX23885_VMUX_TELEVISION
,
478 .vmux
= CX25840_VIN2_CH1
|
482 .type
= CX23885_VMUX_COMPOSITE1
,
483 .vmux
= CX23885_VMUX_COMPOSITE1
,
485 .type
= CX23885_VMUX_SVIDEO
,
486 .vmux
= CX25840_SVIDEO_LUMA3
|
487 CX25840_SVIDEO_CHROMA4
,
490 [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
] = {
492 .name
= "NetUP Dual DVB-T/C-CI RF",
493 .porta
= CX23885_ANALOG_VIDEO
,
494 .portb
= CX23885_MPEG_DVB
,
495 .portc
= CX23885_MPEG_DVB
,
498 .tuner_type
= TUNER_XC5000
,
501 .type
= CX23885_VMUX_TELEVISION
,
502 .vmux
= CX25840_COMPOSITE1
,
505 [CX23885_BOARD_MPX885
] = {
507 .porta
= CX23885_ANALOG_VIDEO
,
509 .type
= CX23885_VMUX_COMPOSITE1
,
510 .vmux
= CX25840_COMPOSITE1
,
511 .amux
= CX25840_AUDIO6
,
514 .type
= CX23885_VMUX_COMPOSITE2
,
515 .vmux
= CX25840_COMPOSITE2
,
516 .amux
= CX25840_AUDIO6
,
519 .type
= CX23885_VMUX_COMPOSITE3
,
520 .vmux
= CX25840_COMPOSITE3
,
521 .amux
= CX25840_AUDIO7
,
524 .type
= CX23885_VMUX_COMPOSITE4
,
525 .vmux
= CX25840_COMPOSITE4
,
526 .amux
= CX25840_AUDIO7
,
530 [CX23885_BOARD_MYGICA_X8507
] = {
531 .name
= "Mygica X8507",
532 .tuner_type
= TUNER_XC5000
,
535 .porta
= CX23885_ANALOG_VIDEO
,
538 .type
= CX23885_VMUX_TELEVISION
,
539 .vmux
= CX25840_COMPOSITE2
,
540 .amux
= CX25840_AUDIO8
,
543 .type
= CX23885_VMUX_COMPOSITE1
,
544 .vmux
= CX25840_COMPOSITE8
,
545 .amux
= CX25840_AUDIO7
,
548 .type
= CX23885_VMUX_SVIDEO
,
549 .vmux
= CX25840_SVIDEO_LUMA3
|
550 CX25840_SVIDEO_CHROMA4
,
551 .amux
= CX25840_AUDIO7
,
554 .type
= CX23885_VMUX_COMPONENT
,
555 .vmux
= CX25840_COMPONENT_ON
|
559 .amux
= CX25840_AUDIO7
,
563 [CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
] = {
564 .name
= "TerraTec Cinergy T PCIe Dual",
565 .portb
= CX23885_MPEG_DVB
,
566 .portc
= CX23885_MPEG_DVB
,
568 [CX23885_BOARD_TEVII_S471
] = {
569 .name
= "TeVii S471",
570 .portb
= CX23885_MPEG_DVB
,
572 [CX23885_BOARD_PROF_8000
] = {
573 .name
= "Prof Revolution DVB-S2 8000",
574 .portb
= CX23885_MPEG_DVB
,
576 [CX23885_BOARD_HAUPPAUGE_HVR4400
] = {
577 .name
= "Hauppauge WinTV-HVR4400",
578 .portb
= CX23885_MPEG_DVB
,
580 [CX23885_BOARD_AVERMEDIA_HC81R
] = {
581 .name
= "AVerTV Hybrid Express Slim HC81R",
582 .tuner_type
= TUNER_XC2028
,
583 .tuner_addr
= 0x61, /* 0xc2 >> 1 */
585 .porta
= CX23885_ANALOG_VIDEO
,
587 .type
= CX23885_VMUX_TELEVISION
,
588 .vmux
= CX25840_VIN2_CH1
|
592 .amux
= CX25840_AUDIO8
,
594 .type
= CX23885_VMUX_SVIDEO
,
595 .vmux
= CX25840_VIN8_CH1
|
599 .amux
= CX25840_AUDIO6
,
601 .type
= CX23885_VMUX_COMPONENT
,
602 .vmux
= CX25840_VIN1_CH1
|
606 .amux
= CX25840_AUDIO6
,
610 const unsigned int cx23885_bcount
= ARRAY_SIZE(cx23885_boards
);
612 /* ------------------------------------------------------------------ */
613 /* PCI subsystem IDs */
615 struct cx23885_subid cx23885_subids
[] = {
619 .card
= CX23885_BOARD_UNKNOWN
,
623 .card
= CX23885_BOARD_HAUPPAUGE_HVR1800lp
,
627 .card
= CX23885_BOARD_HAUPPAUGE_HVR1800
,
631 .card
= CX23885_BOARD_HAUPPAUGE_HVR1800
,
635 .card
= CX23885_BOARD_HAUPPAUGE_HVR1800
,
639 .card
= CX23885_BOARD_HAUPPAUGE_HVR1250
,
643 .card
= CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP
,
647 .card
= CX23885_BOARD_HAUPPAUGE_HVR1500Q
,
651 .card
= CX23885_BOARD_HAUPPAUGE_HVR1500Q
,
655 .card
= CX23885_BOARD_HAUPPAUGE_HVR1500
,
659 .card
= CX23885_BOARD_HAUPPAUGE_HVR1500
,
663 .card
= CX23885_BOARD_HAUPPAUGE_HVR1200
,
667 .card
= CX23885_BOARD_HAUPPAUGE_HVR1200
,
671 .card
= CX23885_BOARD_HAUPPAUGE_HVR1700
,
675 .card
= CX23885_BOARD_HAUPPAUGE_HVR1400
,
679 .card
= CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP
,
683 .card
= CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
,
687 .card
= CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
,
691 .card
= CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
,
695 .card
= CX23885_BOARD_COMPRO_VIDEOMATE_E650F
,
699 .card
= CX23885_BOARD_TBS_6920
,
703 .card
= CX23885_BOARD_TEVII_S470
,
707 .card
= CX23885_BOARD_DVBWORLD_2005
,
711 .card
= CX23885_BOARD_NETUP_DUAL_DVBS2_CI
,
715 .card
= CX23885_BOARD_HAUPPAUGE_HVR1270
,
719 .card
= CX23885_BOARD_HAUPPAUGE_HVR1275
,
723 .card
= CX23885_BOARD_HAUPPAUGE_HVR1275
,
727 .card
= CX23885_BOARD_HAUPPAUGE_HVR1255
,
731 .card
= CX23885_BOARD_HAUPPAUGE_HVR1255_22111
,
735 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
,
739 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
,
743 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
,
747 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
, /* HVR1215 */
751 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
,
755 .card
= CX23885_BOARD_HAUPPAUGE_HVR1255
,
759 .card
= CX23885_BOARD_HAUPPAUGE_HVR1275
,
763 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
, /* HVR1215 */
767 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
,
771 .card
= CX23885_BOARD_HAUPPAUGE_HVR1210
, /* HVR1215 */
775 .card
= CX23885_BOARD_MYGICA_X8506
,
779 .card
= CX23885_BOARD_MAGICPRO_PROHDTVE2
,
783 .card
= CX23885_BOARD_HAUPPAUGE_HVR1850
,
787 .card
= CX23885_BOARD_COMPRO_VIDEOMATE_E800
,
791 .card
= CX23885_BOARD_HAUPPAUGE_HVR1290
,
795 .card
= CX23885_BOARD_MYGICA_X8558PRO
,
799 .card
= CX23885_BOARD_LEADTEK_WINFAST_PXTV1200
,
803 .card
= CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
,
807 .card
= CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
,
811 .card
= CX23885_BOARD_MYGICA_X8507
,
815 .card
= CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
,
819 .card
= CX23885_BOARD_TEVII_S471
,
823 .card
= CX23885_BOARD_PROF_8000
,
827 .card
= CX23885_BOARD_HAUPPAUGE_HVR4400
,
831 .card
= CX23885_BOARD_HAUPPAUGE_HVR4400
,
835 .card
= CX23885_BOARD_HAUPPAUGE_HVR4400
,
839 .card
= CX23885_BOARD_HAUPPAUGE_HVR4400
,
843 .card
= CX23885_BOARD_AVERMEDIA_HC81R
,
846 const unsigned int cx23885_idcount
= ARRAY_SIZE(cx23885_subids
);
848 void cx23885_card_list(struct cx23885_dev
*dev
)
852 if (0 == dev
->pci
->subsystem_vendor
&&
853 0 == dev
->pci
->subsystem_device
) {
855 "%s: Board has no valid PCIe Subsystem ID and can't\n"
856 "%s: be autodetected. Pass card=<n> insmod option\n"
857 "%s: to workaround that. Redirect complaints to the\n"
858 "%s: vendor of the TV card. Best regards,\n"
860 dev
->name
, dev
->name
, dev
->name
, dev
->name
, dev
->name
);
863 "%s: Your board isn't known (yet) to the driver.\n"
864 "%s: Try to pick one of the existing card configs via\n"
865 "%s: card=<n> insmod option. Updating to the latest\n"
866 "%s: version might help as well.\n",
867 dev
->name
, dev
->name
, dev
->name
, dev
->name
);
869 printk(KERN_INFO
"%s: Here is a list of valid choices for the card=<n> insmod option:\n",
871 for (i
= 0; i
< cx23885_bcount
; i
++)
872 printk(KERN_INFO
"%s: card=%d -> %s\n",
873 dev
->name
, i
, cx23885_boards
[i
].name
);
876 static void hauppauge_eeprom(struct cx23885_dev
*dev
, u8
*eeprom_data
)
880 tveeprom_hauppauge_analog(&dev
->i2c_bus
[0].i2c_client
, &tv
,
883 /* Make sure we support the board model */
886 /* WinTV-HVR1270 (PCIe, Retail, half height)
887 * ATSC/QAM and basic analog, IR Blast */
889 /* WinTV-HVR1210 (PCIe, Retail, half height)
890 * DVB-T and basic analog, IR Blast */
892 /* WinTV-HVR1270 (PCIe, Retail, half height)
893 * ATSC/QAM and basic analog, IR Recv */
895 /* WinTV-HVR1210 (PCIe, Retail, half height)
896 * DVB-T and basic analog, IR Recv */
898 /* WinTV-HVR1275 (PCIe, Retail, half height)
899 * ATSC/QAM and basic analog, IR Recv */
901 /* WinTV-HVR1210 (PCIe, Retail, half height)
902 * DVB-T and basic analog, IR Recv */
904 /* WinTV-HVR1270 (PCIe, Retail, full height)
905 * ATSC/QAM and basic analog, IR Blast */
907 /* WinTV-HVR1210 (PCIe, Retail, full height)
908 * DVB-T and basic analog, IR Blast */
910 /* WinTV-HVR1270 (PCIe, Retail, full height)
911 * ATSC/QAM and basic analog, IR Recv */
913 /* WinTV-HVR1210 (PCIe, Retail, full height)
914 * DVB-T and basic analog, IR Recv */
916 /* WinTV-HVR1275 (PCIe, Retail, full height)
917 * ATSC/QAM and basic analog, IR Recv */
919 /* WinTV-HVR1210 (PCIe, Retail, full height)
920 * DVB-T and basic analog, IR Recv */
922 /* WinTV-HVR1200 (PCIe, Retail, full height)
923 * DVB-T and basic analog */
925 /* WinTV-HVR1200 (PCIe, OEM, half height)
926 * DVB-T and basic analog */
928 /* WinTV-HVR1200 (PCIe, OEM, half height)
929 * DVB-T and basic analog */
931 /* WinTV-HVR1200 (PCIe, OEM, full height)
932 * DVB-T and basic analog */
934 /* WinTV-HVR1200 (PCIe, OEM, half height)
935 * DVB-T and basic analog */
937 /* WinTV-HVR1200 (PCIe, OEM, full height)
938 * DVB-T and basic analog */
940 /* WinTV-HVR1200 (PCIe, OEM, full height)
941 * DVB-T and basic analog */
943 /* WinTV-HVR1200 (PCIe, OEM, half height)
944 * DVB-T and basic analog */
946 /* WinTV-HVR1200 (PCIe, OEM, full height)
947 * DVB-T and basic analog */
949 /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
950 channel ATSC and MPEG2 HW Encoder */
952 /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
955 /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
958 /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
961 /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
964 /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
965 Dual channel ATSC and MPEG2 HW Encoder */
967 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
968 Dual channel ATSC and MPEG2 HW Encoder */
970 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
971 Dual channel ATSC and MPEG2 HW Encoder */
973 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
974 Dual channel ATSC and MPEG2 HW Encoder */
976 /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
977 Dual channel ATSC and MPEG2 HW Encoder */
979 /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
980 ATSC and Basic analog */
982 /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
983 ATSC and Basic analog */
985 /* WinTV-HVR1250 (PCIe, No IR, half height,
986 ATSC [at least] and Basic analog) */
988 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
989 ATSC and Basic analog */
991 /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
992 ATSC and Basic analog */
994 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
995 ATSC and Basic analog */
997 /* WinTV-HVR1400 (Express Card, Retail, IR,
998 * DVB-T and Basic analog */
1000 /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
1001 * DVB-T and MPEG2 HW Encoder */
1003 /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
1004 * DVB-T and MPEG2 HW Encoder */
1007 /* WinTV-HVR1850 (PCIe, Retail, 3.5mm in, IR, FM,
1008 Dual channel ATSC and MPEG2 HW Encoder */
1011 /* WinTV-HVR1290 (PCIe, OEM, RCA in, IR,
1012 Dual channel ATSC and Basic analog */
1015 printk(KERN_WARNING
"%s: warning: "
1016 "unknown hauppauge model #%d\n",
1017 dev
->name
, tv
.model
);
1021 printk(KERN_INFO
"%s: hauppauge eeprom: model=%d\n",
1022 dev
->name
, tv
.model
);
1025 int cx23885_tuner_callback(void *priv
, int component
, int command
, int arg
)
1027 struct cx23885_tsport
*port
= priv
;
1028 struct cx23885_dev
*dev
= port
->dev
;
1031 if ((command
== XC2028_RESET_CLK
) || (command
== XC2028_I2C_FLUSH
))
1035 printk(KERN_ERR
"%s(): Unknown command 0x%x.\n",
1040 switch (dev
->board
) {
1041 case CX23885_BOARD_HAUPPAUGE_HVR1400
:
1042 case CX23885_BOARD_HAUPPAUGE_HVR1500
:
1043 case CX23885_BOARD_HAUPPAUGE_HVR1500Q
:
1044 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
:
1045 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
:
1046 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F
:
1047 case CX23885_BOARD_COMPRO_VIDEOMATE_E800
:
1048 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200
:
1049 /* Tuner Reset Command */
1052 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP
:
1053 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
:
1054 /* Two identical tuners on two different i2c buses,
1055 * we need to reset the correct gpio. */
1058 else if (port
->nr
== 2)
1061 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
:
1062 /* Tuner Reset Command */
1065 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
:
1066 altera_ci_tuner_reset(dev
, port
->nr
);
1068 case CX23885_BOARD_AVERMEDIA_HC81R
:
1069 /* XC3028L Reset Command */
1075 /* Drive the tuner into reset and back out */
1076 cx_clear(GP0_IO
, bitmask
);
1078 cx_set(GP0_IO
, bitmask
);
1084 void cx23885_gpio_setup(struct cx23885_dev
*dev
)
1086 switch (dev
->board
) {
1087 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1088 /* GPIO-0 cx24227 demodulator reset */
1089 cx_set(GP0_IO
, 0x00010001); /* Bring the part out of reset */
1091 case CX23885_BOARD_HAUPPAUGE_HVR1500
:
1092 /* GPIO-0 cx24227 demodulator */
1093 /* GPIO-2 xc3028 tuner */
1095 /* Put the parts into reset */
1096 cx_set(GP0_IO
, 0x00050000);
1097 cx_clear(GP0_IO
, 0x00000005);
1100 /* Bring the parts out of reset */
1101 cx_set(GP0_IO
, 0x00050005);
1103 case CX23885_BOARD_HAUPPAUGE_HVR1500Q
:
1104 /* GPIO-0 cx24227 demodulator reset */
1105 /* GPIO-2 xc5000 tuner reset */
1106 cx_set(GP0_IO
, 0x00050005); /* Bring the part out of reset */
1108 case CX23885_BOARD_HAUPPAUGE_HVR1800
:
1109 /* GPIO-0 656_CLK */
1111 /* GPIO-2 8295A Reset */
1112 /* GPIO-3-10 cx23417 data0-7 */
1113 /* GPIO-11-14 cx23417 addr0-3 */
1114 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1117 /* CX23417 GPIO's */
1118 /* EIO15 Zilog Reset */
1119 /* EIO14 S5H1409/CX24227 Reset */
1120 mc417_gpio_enable(dev
, GPIO_15
| GPIO_14
, 1);
1122 /* Put the demod into reset and protect the eeprom */
1123 mc417_gpio_clear(dev
, GPIO_15
| GPIO_14
);
1126 /* Bring the demod and blaster out of reset */
1127 mc417_gpio_set(dev
, GPIO_15
| GPIO_14
);
1130 /* Force the TDA8295A into reset and back */
1131 cx23885_gpio_enable(dev
, GPIO_2
, 1);
1132 cx23885_gpio_set(dev
, GPIO_2
);
1134 cx23885_gpio_clear(dev
, GPIO_2
);
1136 cx23885_gpio_set(dev
, GPIO_2
);
1139 case CX23885_BOARD_HAUPPAUGE_HVR1200
:
1140 /* GPIO-0 tda10048 demodulator reset */
1141 /* GPIO-2 tda18271 tuner reset */
1143 /* Put the parts into reset and back */
1144 cx_set(GP0_IO
, 0x00050000);
1146 cx_clear(GP0_IO
, 0x00000005);
1148 cx_set(GP0_IO
, 0x00050005);
1150 case CX23885_BOARD_HAUPPAUGE_HVR1700
:
1151 /* GPIO-0 TDA10048 demodulator reset */
1152 /* GPIO-2 TDA8295A Reset */
1153 /* GPIO-3-10 cx23417 data0-7 */
1154 /* GPIO-11-14 cx23417 addr0-3 */
1155 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1157 /* The following GPIO's are on the interna AVCore (cx25840) */
1159 /* GPIO-20 IR_TX 416/DVBT Select */
1160 /* GPIO-21 IIS DAT */
1161 /* GPIO-22 IIS WCLK */
1162 /* GPIO-23 IIS BCLK */
1164 /* Put the parts into reset and back */
1165 cx_set(GP0_IO
, 0x00050000);
1167 cx_clear(GP0_IO
, 0x00000005);
1169 cx_set(GP0_IO
, 0x00050005);
1171 case CX23885_BOARD_HAUPPAUGE_HVR1400
:
1172 /* GPIO-0 Dibcom7000p demodulator reset */
1173 /* GPIO-2 xc3028L tuner reset */
1176 /* Put the parts into reset and back */
1177 cx_set(GP0_IO
, 0x00050000);
1179 cx_clear(GP0_IO
, 0x00000005);
1181 cx_set(GP0_IO
, 0x00050005);
1183 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP
:
1184 /* GPIO-0 xc5000 tuner reset i2c bus 0 */
1185 /* GPIO-1 s5h1409 demod reset i2c bus 0 */
1186 /* GPIO-2 xc5000 tuner reset i2c bus 1 */
1187 /* GPIO-3 s5h1409 demod reset i2c bus 0 */
1189 /* Put the parts into reset and back */
1190 cx_set(GP0_IO
, 0x000f0000);
1192 cx_clear(GP0_IO
, 0x0000000f);
1194 cx_set(GP0_IO
, 0x000f000f);
1196 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
:
1197 /* GPIO-0 portb xc3028 reset */
1198 /* GPIO-1 portb zl10353 reset */
1199 /* GPIO-2 portc xc3028 reset */
1200 /* GPIO-3 portc zl10353 reset */
1202 /* Put the parts into reset and back */
1203 cx_set(GP0_IO
, 0x000f0000);
1205 cx_clear(GP0_IO
, 0x0000000f);
1207 cx_set(GP0_IO
, 0x000f000f);
1209 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
:
1210 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
:
1211 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F
:
1212 case CX23885_BOARD_COMPRO_VIDEOMATE_E800
:
1213 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200
:
1214 /* GPIO-2 xc3028 tuner reset */
1216 /* The following GPIO's are on the internal AVCore (cx25840) */
1217 /* GPIO-? zl10353 demod reset */
1219 /* Put the parts into reset and back */
1220 cx_set(GP0_IO
, 0x00040000);
1222 cx_clear(GP0_IO
, 0x00000004);
1224 cx_set(GP0_IO
, 0x00040004);
1226 case CX23885_BOARD_TBS_6920
:
1227 case CX23885_BOARD_PROF_8000
:
1228 cx_write(MC417_CTL
, 0x00000036);
1229 cx_write(MC417_OEN
, 0x00001000);
1230 cx_set(MC417_RWD
, 0x00000002);
1232 cx_clear(MC417_RWD
, 0x00000800);
1234 cx_set(MC417_RWD
, 0x00000800);
1237 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI
:
1238 /* GPIO-0 INTA from CiMax1
1239 GPIO-1 INTB from CiMax2
1241 GPIO-3 to GPIO-10 data/addr for CA
1242 GPIO-11 ~CS0 to CiMax1
1243 GPIO-12 ~CS1 to CiMax2
1244 GPIO-13 ADL0 load LSB addr
1245 GPIO-14 ADL1 load MSB addr
1246 GPIO-15 ~RDY from CiMax
1247 GPIO-17 ~RD to CiMax
1248 GPIO-18 ~WR to CiMax
1250 cx_set(GP0_IO
, 0x00040000); /* GPIO as out */
1251 /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */
1252 cx_clear(GP0_IO
, 0x00030004);
1253 mdelay(100);/* reset delay */
1254 cx_set(GP0_IO
, 0x00040004); /* GPIO as out, reset high */
1255 cx_write(MC417_CTL
, 0x00000037);/* enable GPIO3-18 pins */
1256 /* GPIO-15 IN as ~ACK, rest as OUT */
1257 cx_write(MC417_OEN
, 0x00001000);
1258 /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */
1259 cx_write(MC417_RWD
, 0x0000c300);
1261 cx_write(GPIO_ISM
, 0x00000000);/* INTERRUPTS active low*/
1263 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1264 case CX23885_BOARD_HAUPPAUGE_HVR1275
:
1265 case CX23885_BOARD_HAUPPAUGE_HVR1255
:
1266 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111
:
1267 case CX23885_BOARD_HAUPPAUGE_HVR1210
:
1268 /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */
1269 /* GPIO-6 I2C Gate which can isolate the demod from the bus */
1270 /* GPIO-9 Demod reset */
1272 /* Put the parts into reset and back */
1273 cx23885_gpio_enable(dev
, GPIO_9
| GPIO_6
| GPIO_5
, 1);
1274 cx23885_gpio_set(dev
, GPIO_9
| GPIO_6
| GPIO_5
);
1275 cx23885_gpio_clear(dev
, GPIO_9
);
1277 cx23885_gpio_set(dev
, GPIO_9
);
1279 case CX23885_BOARD_MYGICA_X8506
:
1280 case CX23885_BOARD_MAGICPRO_PROHDTVE2
:
1281 case CX23885_BOARD_MYGICA_X8507
:
1282 /* GPIO-0 (0)Analog / (1)Digital TV */
1283 /* GPIO-1 reset XC5000 */
1284 /* GPIO-2 reset LGS8GL5 / LGS8G75 */
1285 cx23885_gpio_enable(dev
, GPIO_0
| GPIO_1
| GPIO_2
, 1);
1286 cx23885_gpio_clear(dev
, GPIO_1
| GPIO_2
);
1288 cx23885_gpio_set(dev
, GPIO_0
| GPIO_1
| GPIO_2
);
1291 case CX23885_BOARD_MYGICA_X8558PRO
:
1292 /* GPIO-0 reset first ATBM8830 */
1293 /* GPIO-1 reset second ATBM8830 */
1294 cx23885_gpio_enable(dev
, GPIO_0
| GPIO_1
, 1);
1295 cx23885_gpio_clear(dev
, GPIO_0
| GPIO_1
);
1297 cx23885_gpio_set(dev
, GPIO_0
| GPIO_1
);
1300 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1301 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1302 /* GPIO-0 656_CLK */
1305 /* GPIO-3-10 cx23417 data0-7 */
1306 /* GPIO-11-14 cx23417 addr0-3 */
1307 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1309 /* GPIO-20 C_IR_TX */
1310 /* GPIO-21 I2S DAT */
1311 /* GPIO-22 I2S WCLK */
1312 /* GPIO-23 I2S BCLK */
1313 /* ALT GPIO: EXP GPIO LATCH */
1315 /* CX23417 GPIO's */
1316 /* GPIO-14 S5H1411/CX24228 Reset */
1317 /* GPIO-13 EEPROM write protect */
1318 mc417_gpio_enable(dev
, GPIO_14
| GPIO_13
, 1);
1320 /* Put the demod into reset and protect the eeprom */
1321 mc417_gpio_clear(dev
, GPIO_14
| GPIO_13
);
1324 /* Bring the demod out of reset */
1325 mc417_gpio_set(dev
, GPIO_14
);
1329 /* Connected to IF / Mux */
1331 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
:
1332 cx_set(GP0_IO
, 0x00010001); /* Bring the part out of reset */
1334 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
:
1337 GPIO-2 ~reset chips out
1338 GPIO-3 to GPIO-10 data/addr for CA in/out
1348 cx_set(GP0_IO
, 0x00060000); /* GPIO-1,2 as out */
1349 /* GPIO-0 as INT, reset & TMS low */
1350 cx_clear(GP0_IO
, 0x00010006);
1351 mdelay(100);/* reset delay */
1352 cx_set(GP0_IO
, 0x00000004); /* reset high */
1353 cx_write(MC417_CTL
, 0x00000037);/* enable GPIO-3..18 pins */
1354 /* GPIO-17 is TDO in, GPIO-15 is ~RDY in, rest is out */
1355 cx_write(MC417_OEN
, 0x00005000);
1356 /* ~RD, ~WR high; ADDR low; ~CS high */
1357 cx_write(MC417_RWD
, 0x00000d00);
1359 cx_write(GPIO_ISM
, 0x00000000);/* INTERRUPTS active low*/
1361 case CX23885_BOARD_HAUPPAUGE_HVR4400
:
1362 /* GPIO-8 tda10071 demod reset */
1364 /* Put the parts into reset and back */
1365 cx23885_gpio_enable(dev
, GPIO_8
, 1);
1366 cx23885_gpio_clear(dev
, GPIO_8
);
1368 cx23885_gpio_set(dev
, GPIO_8
);
1371 case CX23885_BOARD_AVERMEDIA_HC81R
:
1372 cx_clear(MC417_CTL
, 1);
1373 /* GPIO-0,1,2 setup direction as output */
1374 cx_set(GP0_IO
, 0x00070000);
1376 /* AF9013 demod reset */
1377 cx_set(GP0_IO
, 0x00010001);
1379 cx_clear(GP0_IO
, 0x00010001);
1381 cx_set(GP0_IO
, 0x00010001);
1384 cx_clear(GP0_IO
, 0x00030003);
1386 cx_set(GP0_IO
, 0x00020002);
1388 cx_set(GP0_IO
, 0x00010001);
1390 cx_clear(GP0_IO
, 0x00020002);
1391 /* XC3028L tuner reset */
1392 cx_set(GP0_IO
, 0x00040004);
1393 cx_clear(GP0_IO
, 0x00040004);
1394 cx_set(GP0_IO
, 0x00040004);
1400 int cx23885_ir_init(struct cx23885_dev
*dev
)
1402 static struct v4l2_subdev_io_pin_config ir_rxtx_pin_cfg
[] = {
1404 .flags
= V4L2_SUBDEV_IO_PIN_INPUT
,
1405 .pin
= CX23885_PIN_IR_RX_GPIO19
,
1406 .function
= CX23885_PAD_IR_RX
,
1408 .strength
= CX25840_PIN_DRIVE_MEDIUM
,
1410 .flags
= V4L2_SUBDEV_IO_PIN_OUTPUT
,
1411 .pin
= CX23885_PIN_IR_TX_GPIO20
,
1412 .function
= CX23885_PAD_IR_TX
,
1414 .strength
= CX25840_PIN_DRIVE_MEDIUM
,
1417 const size_t ir_rxtx_pin_cfg_count
= ARRAY_SIZE(ir_rxtx_pin_cfg
);
1419 static struct v4l2_subdev_io_pin_config ir_rx_pin_cfg
[] = {
1421 .flags
= V4L2_SUBDEV_IO_PIN_INPUT
,
1422 .pin
= CX23885_PIN_IR_RX_GPIO19
,
1423 .function
= CX23885_PAD_IR_RX
,
1425 .strength
= CX25840_PIN_DRIVE_MEDIUM
,
1428 const size_t ir_rx_pin_cfg_count
= ARRAY_SIZE(ir_rx_pin_cfg
);
1430 struct v4l2_subdev_ir_parameters params
;
1432 switch (dev
->board
) {
1433 case CX23885_BOARD_HAUPPAUGE_HVR1500
:
1434 case CX23885_BOARD_HAUPPAUGE_HVR1500Q
:
1435 case CX23885_BOARD_HAUPPAUGE_HVR1800
:
1436 case CX23885_BOARD_HAUPPAUGE_HVR1200
:
1437 case CX23885_BOARD_HAUPPAUGE_HVR1400
:
1438 case CX23885_BOARD_HAUPPAUGE_HVR1275
:
1439 case CX23885_BOARD_HAUPPAUGE_HVR1255
:
1440 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111
:
1441 case CX23885_BOARD_HAUPPAUGE_HVR1210
:
1442 /* FIXME: Implement me */
1444 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1445 ret
= cx23888_ir_probe(dev
);
1448 dev
->sd_ir
= cx23885_find_hw(dev
, CX23885_HW_888_IR
);
1449 v4l2_subdev_call(dev
->sd_cx25840
, core
, s_io_pin_config
,
1450 ir_rx_pin_cfg_count
, ir_rx_pin_cfg
);
1452 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1453 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1454 ret
= cx23888_ir_probe(dev
);
1457 dev
->sd_ir
= cx23885_find_hw(dev
, CX23885_HW_888_IR
);
1458 v4l2_subdev_call(dev
->sd_cx25840
, core
, s_io_pin_config
,
1459 ir_rxtx_pin_cfg_count
, ir_rxtx_pin_cfg
);
1461 * For these boards we need to invert the Tx output via the
1462 * IR controller to have the LED off while idle
1464 v4l2_subdev_call(dev
->sd_ir
, ir
, tx_g_parameters
, ¶ms
);
1465 params
.enable
= false;
1466 params
.shutdown
= false;
1467 params
.invert_level
= true;
1468 v4l2_subdev_call(dev
->sd_ir
, ir
, tx_s_parameters
, ¶ms
);
1469 params
.shutdown
= true;
1470 v4l2_subdev_call(dev
->sd_ir
, ir
, tx_s_parameters
, ¶ms
);
1472 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
:
1473 case CX23885_BOARD_TEVII_S470
:
1474 case CX23885_BOARD_MYGICA_X8507
:
1477 dev
->sd_ir
= cx23885_find_hw(dev
, CX23885_HW_AV_CORE
);
1478 if (dev
->sd_ir
== NULL
) {
1482 v4l2_subdev_call(dev
->sd_cx25840
, core
, s_io_pin_config
,
1483 ir_rx_pin_cfg_count
, ir_rx_pin_cfg
);
1485 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1488 dev
->sd_ir
= cx23885_find_hw(dev
, CX23885_HW_AV_CORE
);
1489 if (dev
->sd_ir
== NULL
) {
1493 v4l2_subdev_call(dev
->sd_cx25840
, core
, s_io_pin_config
,
1494 ir_rxtx_pin_cfg_count
, ir_rxtx_pin_cfg
);
1496 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
:
1497 request_module("ir-kbd-i2c");
1504 void cx23885_ir_fini(struct cx23885_dev
*dev
)
1506 switch (dev
->board
) {
1507 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1508 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1509 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1510 cx23885_irq_remove(dev
, PCI_MSK_IR
);
1511 cx23888_ir_remove(dev
);
1514 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
:
1515 case CX23885_BOARD_TEVII_S470
:
1516 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1517 case CX23885_BOARD_MYGICA_X8507
:
1518 cx23885_irq_remove(dev
, PCI_MSK_AV_CORE
);
1519 /* sd_ir is a duplicate pointer to the AV Core, just clear it */
1525 static int netup_jtag_io(void *device
, int tms
, int tdi
, int read_tdo
)
1529 struct cx23885_dev
*dev
= (struct cx23885_dev
*)device
;
1531 data
= ((cx_read(GP0_IO
)) & (~0x00000002));
1532 data
|= (tms
? 0x00020002 : 0x00020000);
1533 cx_write(GP0_IO
, data
);
1536 data
= ((cx_read(MC417_RWD
)) & (~0x0000a000));
1537 data
|= (tdi
? 0x00008000 : 0);
1538 cx_write(MC417_RWD
, data
);
1540 tdo
= (data
& 0x00004000) ? 1 : 0; /*TDO*/
1542 cx_write(MC417_RWD
, data
| 0x00002000);
1545 cx_write(MC417_RWD
, data
);
1550 void cx23885_ir_pci_int_enable(struct cx23885_dev
*dev
)
1552 switch (dev
->board
) {
1553 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1554 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1555 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1557 cx23885_irq_add_enable(dev
, PCI_MSK_IR
);
1559 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
:
1560 case CX23885_BOARD_TEVII_S470
:
1561 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1562 case CX23885_BOARD_MYGICA_X8507
:
1564 cx23885_irq_add_enable(dev
, PCI_MSK_AV_CORE
);
1569 void cx23885_card_setup(struct cx23885_dev
*dev
)
1571 struct cx23885_tsport
*ts1
= &dev
->ts1
;
1572 struct cx23885_tsport
*ts2
= &dev
->ts2
;
1574 static u8 eeprom
[256];
1576 if (dev
->i2c_bus
[0].i2c_rc
== 0) {
1577 dev
->i2c_bus
[0].i2c_client
.addr
= 0xa0 >> 1;
1578 tveeprom_read(&dev
->i2c_bus
[0].i2c_client
,
1579 eeprom
, sizeof(eeprom
));
1582 switch (dev
->board
) {
1583 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1584 if (dev
->i2c_bus
[0].i2c_rc
== 0) {
1585 if (eeprom
[0x80] != 0x84)
1586 hauppauge_eeprom(dev
, eeprom
+0xc0);
1588 hauppauge_eeprom(dev
, eeprom
+0x80);
1591 case CX23885_BOARD_HAUPPAUGE_HVR1500
:
1592 case CX23885_BOARD_HAUPPAUGE_HVR1500Q
:
1593 case CX23885_BOARD_HAUPPAUGE_HVR1400
:
1594 if (dev
->i2c_bus
[0].i2c_rc
== 0)
1595 hauppauge_eeprom(dev
, eeprom
+0x80);
1597 case CX23885_BOARD_HAUPPAUGE_HVR1800
:
1598 case CX23885_BOARD_HAUPPAUGE_HVR1800lp
:
1599 case CX23885_BOARD_HAUPPAUGE_HVR1200
:
1600 case CX23885_BOARD_HAUPPAUGE_HVR1700
:
1601 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1602 case CX23885_BOARD_HAUPPAUGE_HVR1275
:
1603 case CX23885_BOARD_HAUPPAUGE_HVR1255
:
1604 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111
:
1605 case CX23885_BOARD_HAUPPAUGE_HVR1210
:
1606 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1607 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1608 case CX23885_BOARD_HAUPPAUGE_HVR4400
:
1609 if (dev
->i2c_bus
[0].i2c_rc
== 0)
1610 hauppauge_eeprom(dev
, eeprom
+0xc0);
1614 switch (dev
->board
) {
1615 case CX23885_BOARD_AVERMEDIA_HC81R
:
1616 /* Defaults for VID B */
1617 ts1
->gen_ctrl_val
= 0x4; /* Parallel */
1618 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1619 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1620 /* Defaults for VID C */
1621 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
1622 ts2
->gen_ctrl_val
= 0x10e;
1623 ts2
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1624 ts2
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1626 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP
:
1627 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
:
1628 ts2
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1629 ts2
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1630 ts2
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1631 /* break omitted intentionally */
1632 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP
:
1633 ts1
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1634 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1635 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1637 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1638 case CX23885_BOARD_HAUPPAUGE_HVR1800
:
1639 /* Defaults for VID B - Analog encoder */
1640 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
1641 ts1
->gen_ctrl_val
= 0x10e;
1642 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1643 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1645 /* APB_TSVALERR_POL (active low)*/
1646 ts1
->vld_misc_val
= 0x2000;
1647 ts1
->hw_sop_ctrl_val
= (0x47 << 16 | 188 << 4 | 0xc);
1648 cx_write(0x130184, 0xc);
1650 /* Defaults for VID C */
1651 ts2
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1652 ts2
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1653 ts2
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1655 case CX23885_BOARD_TBS_6920
:
1656 ts1
->gen_ctrl_val
= 0x4; /* Parallel */
1657 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1658 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1660 case CX23885_BOARD_TEVII_S470
:
1661 case CX23885_BOARD_TEVII_S471
:
1662 case CX23885_BOARD_DVBWORLD_2005
:
1663 case CX23885_BOARD_PROF_8000
:
1664 ts1
->gen_ctrl_val
= 0x5; /* Parallel */
1665 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1666 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1668 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI
:
1669 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
:
1670 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
:
1671 ts1
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1672 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1673 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1674 ts2
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1675 ts2
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1676 ts2
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1678 case CX23885_BOARD_MYGICA_X8506
:
1679 case CX23885_BOARD_MAGICPRO_PROHDTVE2
:
1680 ts1
->gen_ctrl_val
= 0x5; /* Parallel */
1681 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1682 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1684 case CX23885_BOARD_MYGICA_X8558PRO
:
1685 ts1
->gen_ctrl_val
= 0x5; /* Parallel */
1686 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1687 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1688 ts2
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1689 ts2
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1690 ts2
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1692 case CX23885_BOARD_HAUPPAUGE_HVR4400
:
1693 ts1
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1694 ts1
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1695 ts1
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1697 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1698 case CX23885_BOARD_HAUPPAUGE_HVR1500
:
1699 case CX23885_BOARD_HAUPPAUGE_HVR1500Q
:
1700 case CX23885_BOARD_HAUPPAUGE_HVR1800lp
:
1701 case CX23885_BOARD_HAUPPAUGE_HVR1200
:
1702 case CX23885_BOARD_HAUPPAUGE_HVR1700
:
1703 case CX23885_BOARD_HAUPPAUGE_HVR1400
:
1704 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
:
1705 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
:
1706 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F
:
1707 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1708 case CX23885_BOARD_HAUPPAUGE_HVR1275
:
1709 case CX23885_BOARD_HAUPPAUGE_HVR1255
:
1710 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111
:
1711 case CX23885_BOARD_HAUPPAUGE_HVR1210
:
1712 case CX23885_BOARD_COMPRO_VIDEOMATE_E800
:
1713 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1714 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
:
1716 ts2
->gen_ctrl_val
= 0xc; /* Serial bus + punctured clock */
1717 ts2
->ts_clk_en_val
= 0x1; /* Enable TS_CLK */
1718 ts2
->src_sel_val
= CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO
;
1721 /* Certain boards support analog, or require the avcore to be
1722 * loaded, ensure this happens.
1724 switch (dev
->board
) {
1725 case CX23885_BOARD_TEVII_S470
:
1726 /* Currently only enabled for the integrated IR controller */
1729 case CX23885_BOARD_HAUPPAUGE_HVR1250
:
1730 case CX23885_BOARD_HAUPPAUGE_HVR1800
:
1731 case CX23885_BOARD_HAUPPAUGE_HVR1800lp
:
1732 case CX23885_BOARD_HAUPPAUGE_HVR1700
:
1733 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
:
1734 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
:
1735 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F
:
1736 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI
:
1737 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
:
1738 case CX23885_BOARD_COMPRO_VIDEOMATE_E800
:
1739 case CX23885_BOARD_HAUPPAUGE_HVR1255
:
1740 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111
:
1741 case CX23885_BOARD_HAUPPAUGE_HVR1270
:
1742 case CX23885_BOARD_HAUPPAUGE_HVR1850
:
1743 case CX23885_BOARD_MYGICA_X8506
:
1744 case CX23885_BOARD_MAGICPRO_PROHDTVE2
:
1745 case CX23885_BOARD_HAUPPAUGE_HVR1290
:
1746 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200
:
1747 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
:
1748 case CX23885_BOARD_HAUPPAUGE_HVR1500
:
1749 case CX23885_BOARD_MPX885
:
1750 case CX23885_BOARD_MYGICA_X8507
:
1751 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
:
1752 case CX23885_BOARD_AVERMEDIA_HC81R
:
1753 dev
->sd_cx25840
= v4l2_i2c_new_subdev(&dev
->v4l2_dev
,
1754 &dev
->i2c_bus
[2].i2c_adap
,
1755 "cx25840", 0x88 >> 1, NULL
);
1756 if (dev
->sd_cx25840
) {
1757 dev
->sd_cx25840
->grp_id
= CX23885_HW_AV_CORE
;
1758 v4l2_subdev_call(dev
->sd_cx25840
, core
, load_fw
);
1763 /* AUX-PLL 27MHz CLK */
1764 switch (dev
->board
) {
1765 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI
:
1766 netup_initialize(dev
);
1768 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
: {
1770 const struct firmware
*fw
;
1771 const char *filename
= "dvb-netup-altera-01.fw";
1772 char *action
= "configure";
1773 static struct netup_card_info cinfo
;
1774 struct altera_config netup_config
= {
1777 .jtag_io
= netup_jtag_io
,
1780 netup_initialize(dev
);
1782 netup_get_card_info(&dev
->i2c_bus
[0].i2c_adap
, &cinfo
);
1784 cinfo
.rev
= netup_card_rev
;
1786 switch (cinfo
.rev
) {
1788 filename
= "dvb-netup-altera-04.fw";
1791 filename
= "dvb-netup-altera-01.fw";
1794 printk(KERN_INFO
"NetUP card rev=0x%x fw_filename=%s\n",
1795 cinfo
.rev
, filename
);
1797 ret
= request_firmware(&fw
, filename
, &dev
->pci
->dev
);
1799 printk(KERN_ERR
"did not find the firmware file. (%s) "
1800 "Please see linux/Documentation/dvb/ for more details "
1801 "on firmware-problems.", filename
);
1803 altera_init(&netup_config
, fw
);
1805 release_firmware(fw
);
1811 /* ------------------------------------------------------------------ */