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 = 1;
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\tTeVii S470 (reported unsafe)\n"
50 "\t\t This can cause an interrupt storm with some cards.\n"
51 "\t\t Default: 0 [Disabled]");
53 /* ------------------------------------------------------------------ */
54 /* board config info */
56 struct cx23885_board cx23885_boards[] = {
57 [CX23885_BOARD_UNKNOWN] = {
58 .name = "UNKNOWN/GENERIC",
59 /* Ensure safe default for unknown boards */
62 .type = CX23885_VMUX_COMPOSITE1,
65 .type = CX23885_VMUX_COMPOSITE2,
68 .type = CX23885_VMUX_COMPOSITE3,
71 .type = CX23885_VMUX_COMPOSITE4,
75 [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
76 .name = "Hauppauge WinTV-HVR1800lp",
77 .portc = CX23885_MPEG_DVB,
79 .type = CX23885_VMUX_TELEVISION,
83 .type = CX23885_VMUX_DEBUG,
87 .type = CX23885_VMUX_COMPOSITE1,
91 .type = CX23885_VMUX_SVIDEO,
96 [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
97 .name = "Hauppauge WinTV-HVR1800",
98 .porta = CX23885_ANALOG_VIDEO,
99 .portb = CX23885_MPEG_ENCODER,
100 .portc = CX23885_MPEG_DVB,
101 .tuner_type = TUNER_PHILIPS_TDA8290,
102 .tuner_addr = 0x42, /* 0x84 >> 1 */
105 .type = CX23885_VMUX_TELEVISION,
106 .vmux = CX25840_VIN7_CH3 |
109 .amux = CX25840_AUDIO8,
112 .type = CX23885_VMUX_COMPOSITE1,
113 .vmux = CX25840_VIN7_CH3 |
116 .amux = CX25840_AUDIO7,
119 .type = CX23885_VMUX_SVIDEO,
120 .vmux = CX25840_VIN7_CH3 |
124 .amux = CX25840_AUDIO7,
128 [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
129 .name = "Hauppauge WinTV-HVR1250",
130 .porta = CX23885_ANALOG_VIDEO,
131 .portc = CX23885_MPEG_DVB,
132 #ifdef MT2131_NO_ANALOG_SUPPORT_YET
133 .tuner_type = TUNER_PHILIPS_TDA8290,
134 .tuner_addr = 0x42, /* 0x84 >> 1 */
139 #ifdef MT2131_NO_ANALOG_SUPPORT_YET
140 .type = CX23885_VMUX_TELEVISION,
141 .vmux = CX25840_VIN7_CH3 |
144 .amux = CX25840_AUDIO8,
148 .type = CX23885_VMUX_COMPOSITE1,
149 .vmux = CX25840_VIN7_CH3 |
152 .amux = CX25840_AUDIO7,
155 .type = CX23885_VMUX_SVIDEO,
156 .vmux = CX25840_VIN7_CH3 |
160 .amux = CX25840_AUDIO7,
164 [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = {
165 .name = "DViCO FusionHDTV5 Express",
166 .portb = CX23885_MPEG_DVB,
168 [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = {
169 .name = "Hauppauge WinTV-HVR1500Q",
170 .portc = CX23885_MPEG_DVB,
172 [CX23885_BOARD_HAUPPAUGE_HVR1500] = {
173 .name = "Hauppauge WinTV-HVR1500",
174 .porta = CX23885_ANALOG_VIDEO,
175 .portc = CX23885_MPEG_DVB,
176 .tuner_type = TUNER_XC2028,
177 .tuner_addr = 0x61, /* 0xc2 >> 1 */
179 .type = CX23885_VMUX_TELEVISION,
180 .vmux = CX25840_VIN7_CH3 |
185 .type = CX23885_VMUX_COMPOSITE1,
186 .vmux = CX25840_VIN7_CH3 |
191 .type = CX23885_VMUX_SVIDEO,
192 .vmux = CX25840_VIN7_CH3 |
199 [CX23885_BOARD_HAUPPAUGE_HVR1200] = {
200 .name = "Hauppauge WinTV-HVR1200",
201 .portc = CX23885_MPEG_DVB,
203 [CX23885_BOARD_HAUPPAUGE_HVR1700] = {
204 .name = "Hauppauge WinTV-HVR1700",
205 .portc = CX23885_MPEG_DVB,
207 [CX23885_BOARD_HAUPPAUGE_HVR1400] = {
208 .name = "Hauppauge WinTV-HVR1400",
209 .portc = CX23885_MPEG_DVB,
211 [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = {
212 .name = "DViCO FusionHDTV7 Dual Express",
213 .portb = CX23885_MPEG_DVB,
214 .portc = CX23885_MPEG_DVB,
216 [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = {
217 .name = "DViCO FusionHDTV DVB-T Dual Express",
218 .portb = CX23885_MPEG_DVB,
219 .portc = CX23885_MPEG_DVB,
221 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = {
222 .name = "Leadtek Winfast PxDVR3200 H",
223 .portc = CX23885_MPEG_DVB,
225 [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000] = {
226 .name = "Leadtek Winfast PxDVR3200 H XC4000",
227 .porta = CX23885_ANALOG_VIDEO,
228 .portc = CX23885_MPEG_DVB,
229 .tuner_type = TUNER_XC4000,
232 .radio_addr = ADDR_UNSET,
234 .type = CX23885_VMUX_TELEVISION,
235 .vmux = CX25840_VIN2_CH1 |
239 .type = CX23885_VMUX_COMPOSITE1,
240 .vmux = CX25840_COMPOSITE1,
242 .type = CX23885_VMUX_SVIDEO,
243 .vmux = CX25840_SVIDEO_LUMA3 |
244 CX25840_SVIDEO_CHROMA4,
246 .type = CX23885_VMUX_COMPONENT,
247 .vmux = CX25840_VIN7_CH1 |
250 CX25840_COMPONENT_ON,
253 [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = {
254 .name = "Compro VideoMate E650F",
255 .portc = CX23885_MPEG_DVB,
257 [CX23885_BOARD_TBS_6920] = {
258 .name = "TurboSight TBS 6920",
259 .portb = CX23885_MPEG_DVB,
261 [CX23885_BOARD_TEVII_S470] = {
262 .name = "TeVii S470",
263 .portb = CX23885_MPEG_DVB,
265 [CX23885_BOARD_DVBWORLD_2005] = {
266 .name = "DVBWorld DVB-S2 2005",
267 .portb = CX23885_MPEG_DVB,
269 [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
271 .name = "NetUP Dual DVB-S2 CI",
272 .portb = CX23885_MPEG_DVB,
273 .portc = CX23885_MPEG_DVB,
275 [CX23885_BOARD_HAUPPAUGE_HVR1270] = {
276 .name = "Hauppauge WinTV-HVR1270",
277 .portc = CX23885_MPEG_DVB,
279 [CX23885_BOARD_HAUPPAUGE_HVR1275] = {
280 .name = "Hauppauge WinTV-HVR1275",
281 .portc = CX23885_MPEG_DVB,
283 [CX23885_BOARD_HAUPPAUGE_HVR1255] = {
284 .name = "Hauppauge WinTV-HVR1255",
285 .porta = CX23885_ANALOG_VIDEO,
286 .portc = CX23885_MPEG_DVB,
287 .tuner_type = TUNER_ABSENT,
288 .tuner_addr = 0x42, /* 0x84 >> 1 */
291 .type = CX23885_VMUX_TELEVISION,
292 .vmux = CX25840_VIN7_CH3 |
296 .amux = CX25840_AUDIO8,
298 .type = CX23885_VMUX_COMPOSITE1,
299 .vmux = CX25840_VIN7_CH3 |
302 .amux = CX25840_AUDIO7,
304 .type = CX23885_VMUX_SVIDEO,
305 .vmux = CX25840_VIN7_CH3 |
309 .amux = CX25840_AUDIO7,
312 [CX23885_BOARD_HAUPPAUGE_HVR1255_22111] = {
313 .name = "Hauppauge WinTV-HVR1255",
314 .porta = CX23885_ANALOG_VIDEO,
315 .portc = CX23885_MPEG_DVB,
316 .tuner_type = TUNER_ABSENT,
317 .tuner_addr = 0x42, /* 0x84 >> 1 */
320 .type = CX23885_VMUX_TELEVISION,
321 .vmux = CX25840_VIN7_CH3 |
325 .amux = CX25840_AUDIO8,
327 .type = CX23885_VMUX_SVIDEO,
328 .vmux = CX25840_VIN7_CH3 |
332 .amux = CX25840_AUDIO7,
335 [CX23885_BOARD_HAUPPAUGE_HVR1210] = {
336 .name = "Hauppauge WinTV-HVR1210",
337 .portc = CX23885_MPEG_DVB,
339 [CX23885_BOARD_MYGICA_X8506] = {
340 .name = "Mygica X8506 DMB-TH",
341 .tuner_type = TUNER_XC5000,
344 .porta = CX23885_ANALOG_VIDEO,
345 .portb = CX23885_MPEG_DVB,
348 .type = CX23885_VMUX_TELEVISION,
349 .vmux = CX25840_COMPOSITE2,
352 .type = CX23885_VMUX_COMPOSITE1,
353 .vmux = CX25840_COMPOSITE8,
356 .type = CX23885_VMUX_SVIDEO,
357 .vmux = CX25840_SVIDEO_LUMA3 |
358 CX25840_SVIDEO_CHROMA4,
361 .type = CX23885_VMUX_COMPONENT,
362 .vmux = CX25840_COMPONENT_ON |
369 [CX23885_BOARD_MAGICPRO_PROHDTVE2] = {
370 .name = "Magic-Pro ProHDTV Extreme 2",
371 .tuner_type = TUNER_XC5000,
374 .porta = CX23885_ANALOG_VIDEO,
375 .portb = CX23885_MPEG_DVB,
378 .type = CX23885_VMUX_TELEVISION,
379 .vmux = CX25840_COMPOSITE2,
382 .type = CX23885_VMUX_COMPOSITE1,
383 .vmux = CX25840_COMPOSITE8,
386 .type = CX23885_VMUX_SVIDEO,
387 .vmux = CX25840_SVIDEO_LUMA3 |
388 CX25840_SVIDEO_CHROMA4,
391 .type = CX23885_VMUX_COMPONENT,
392 .vmux = CX25840_COMPONENT_ON |
399 [CX23885_BOARD_HAUPPAUGE_HVR1850] = {
400 .name = "Hauppauge WinTV-HVR1850",
401 .porta = CX23885_ANALOG_VIDEO,
402 .portb = CX23885_MPEG_ENCODER,
403 .portc = CX23885_MPEG_DVB,
404 .tuner_type = TUNER_ABSENT,
405 .tuner_addr = 0x42, /* 0x84 >> 1 */
408 .type = CX23885_VMUX_TELEVISION,
409 .vmux = CX25840_VIN7_CH3 |
413 .amux = CX25840_AUDIO8,
415 .type = CX23885_VMUX_COMPOSITE1,
416 .vmux = CX25840_VIN7_CH3 |
419 .amux = CX25840_AUDIO7,
421 .type = CX23885_VMUX_SVIDEO,
422 .vmux = CX25840_VIN7_CH3 |
426 .amux = CX25840_AUDIO7,
429 [CX23885_BOARD_COMPRO_VIDEOMATE_E800] = {
430 .name = "Compro VideoMate E800",
431 .portc = CX23885_MPEG_DVB,
433 [CX23885_BOARD_HAUPPAUGE_HVR1290] = {
434 .name = "Hauppauge WinTV-HVR1290",
435 .portc = CX23885_MPEG_DVB,
437 [CX23885_BOARD_MYGICA_X8558PRO] = {
438 .name = "Mygica X8558 PRO DMB-TH",
439 .portb = CX23885_MPEG_DVB,
440 .portc = CX23885_MPEG_DVB,
442 [CX23885_BOARD_LEADTEK_WINFAST_PXTV1200] = {
443 .name = "LEADTEK WinFast PxTV1200",
444 .porta = CX23885_ANALOG_VIDEO,
445 .tuner_type = TUNER_XC2028,
449 .type = CX23885_VMUX_TELEVISION,
450 .vmux = CX25840_VIN2_CH1 |
454 .type = CX23885_VMUX_COMPOSITE1,
455 .vmux = CX25840_COMPOSITE1,
457 .type = CX23885_VMUX_SVIDEO,
458 .vmux = CX25840_SVIDEO_LUMA3 |
459 CX25840_SVIDEO_CHROMA4,
461 .type = CX23885_VMUX_COMPONENT,
462 .vmux = CX25840_VIN7_CH1 |
465 CX25840_COMPONENT_ON,
468 [CX23885_BOARD_GOTVIEW_X5_3D_HYBRID] = {
469 .name = "GoTView X5 3D Hybrid",
470 .tuner_type = TUNER_XC5000,
473 .porta = CX23885_ANALOG_VIDEO,
474 .portb = CX23885_MPEG_DVB,
476 .type = CX23885_VMUX_TELEVISION,
477 .vmux = CX25840_VIN2_CH1 |
481 .type = CX23885_VMUX_COMPOSITE1,
482 .vmux = CX23885_VMUX_COMPOSITE1,
484 .type = CX23885_VMUX_SVIDEO,
485 .vmux = CX25840_SVIDEO_LUMA3 |
486 CX25840_SVIDEO_CHROMA4,
489 [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
491 .name = "NetUP Dual DVB-T/C-CI RF",
492 .porta = CX23885_ANALOG_VIDEO,
493 .portb = CX23885_MPEG_DVB,
494 .portc = CX23885_MPEG_DVB,
497 .tuner_type = TUNER_XC5000,
500 .type = CX23885_VMUX_TELEVISION,
501 .vmux = CX25840_COMPOSITE1,
504 [CX23885_BOARD_MPX885] = {
506 .porta = CX23885_ANALOG_VIDEO,
508 .type = CX23885_VMUX_COMPOSITE1,
509 .vmux = CX25840_COMPOSITE1,
510 .amux = CX25840_AUDIO6,
513 .type = CX23885_VMUX_COMPOSITE2,
514 .vmux = CX25840_COMPOSITE2,
515 .amux = CX25840_AUDIO6,
518 .type = CX23885_VMUX_COMPOSITE3,
519 .vmux = CX25840_COMPOSITE3,
520 .amux = CX25840_AUDIO7,
523 .type = CX23885_VMUX_COMPOSITE4,
524 .vmux = CX25840_COMPOSITE4,
525 .amux = CX25840_AUDIO7,
529 [CX23885_BOARD_MYGICA_X8507] = {
530 .name = "Mygica X8507",
531 .tuner_type = TUNER_XC5000,
534 .porta = CX23885_ANALOG_VIDEO,
537 .type = CX23885_VMUX_TELEVISION,
538 .vmux = CX25840_COMPOSITE2,
539 .amux = CX25840_AUDIO8,
542 .type = CX23885_VMUX_COMPOSITE1,
543 .vmux = CX25840_COMPOSITE8,
546 .type = CX23885_VMUX_SVIDEO,
547 .vmux = CX25840_SVIDEO_LUMA3 |
548 CX25840_SVIDEO_CHROMA4,
551 .type = CX23885_VMUX_COMPONENT,
552 .vmux = CX25840_COMPONENT_ON |
559 [CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL] = {
560 .name = "TerraTec Cinergy T PCIe Dual",
561 .portb = CX23885_MPEG_DVB,
562 .portc = CX23885_MPEG_DVB,
564 [CX23885_BOARD_TEVII_S471] = {
565 .name = "TeVii S471",
566 .portb = CX23885_MPEG_DVB,
569 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
571 /* ------------------------------------------------------------------ */
572 /* PCI subsystem IDs */
574 struct cx23885_subid cx23885_subids[] = {
578 .card = CX23885_BOARD_UNKNOWN,
582 .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
586 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
590 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
594 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
598 .card = CX23885_BOARD_HAUPPAUGE_HVR1250,
602 .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
606 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
610 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
614 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
618 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
622 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
626 .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
630 .card = CX23885_BOARD_HAUPPAUGE_HVR1700,
634 .card = CX23885_BOARD_HAUPPAUGE_HVR1400,
638 .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP,
642 .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP,
646 .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H,
650 .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000,
654 .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F,
658 .card = CX23885_BOARD_TBS_6920,
662 .card = CX23885_BOARD_TEVII_S470,
666 .card = CX23885_BOARD_DVBWORLD_2005,
670 .card = CX23885_BOARD_NETUP_DUAL_DVBS2_CI,
674 .card = CX23885_BOARD_HAUPPAUGE_HVR1270,
678 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
682 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
686 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
690 .card = CX23885_BOARD_HAUPPAUGE_HVR1255_22111,
694 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
698 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
702 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
706 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
710 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
714 .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
718 .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
722 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
726 .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
730 .card = CX23885_BOARD_HAUPPAUGE_HVR1210, /* HVR1215 */
734 .card = CX23885_BOARD_MYGICA_X8506,
738 .card = CX23885_BOARD_MAGICPRO_PROHDTVE2,
742 .card = CX23885_BOARD_HAUPPAUGE_HVR1850,
746 .card = CX23885_BOARD_COMPRO_VIDEOMATE_E800,
750 .card = CX23885_BOARD_HAUPPAUGE_HVR1290,
754 .card = CX23885_BOARD_MYGICA_X8558PRO,
758 .card = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200,
762 .card = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
766 .card = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
770 .card = CX23885_BOARD_MYGICA_X8507,
774 .card = CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL,
778 .card = CX23885_BOARD_TEVII_S471,
781 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
783 void cx23885_card_list(struct cx23885_dev *dev)
787 if (0 == dev->pci->subsystem_vendor &&
788 0 == dev->pci->subsystem_device) {
790 "%s: Board has no valid PCIe Subsystem ID and can't\n"
791 "%s: be autodetected. Pass card=<n> insmod option\n"
792 "%s: to workaround that. Redirect complaints to the\n"
793 "%s: vendor of the TV card. Best regards,\n"
795 dev->name, dev->name, dev->name, dev->name, dev->name);
798 "%s: Your board isn't known (yet) to the driver.\n"
799 "%s: Try to pick one of the existing card configs via\n"
800 "%s: card=<n> insmod option. Updating to the latest\n"
801 "%s: version might help as well.\n",
802 dev->name, dev->name, dev->name, dev->name);
804 printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n",
806 for (i = 0; i < cx23885_bcount; i++)
807 printk(KERN_INFO "%s: card=%d -> %s\n",
808 dev->name, i, cx23885_boards[i].name);
811 static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
815 tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv,
818 /* Make sure we support the board model */
821 /* WinTV-HVR1270 (PCIe, Retail, half height)
822 * ATSC/QAM and basic analog, IR Blast */
824 /* WinTV-HVR1210 (PCIe, Retail, half height)
825 * DVB-T and basic analog, IR Blast */
827 /* WinTV-HVR1270 (PCIe, Retail, half height)
828 * ATSC/QAM and basic analog, IR Recv */
830 /* WinTV-HVR1210 (PCIe, Retail, half height)
831 * DVB-T and basic analog, IR Recv */
833 /* WinTV-HVR1275 (PCIe, Retail, half height)
834 * ATSC/QAM and basic analog, IR Recv */
836 /* WinTV-HVR1210 (PCIe, Retail, half height)
837 * DVB-T and basic analog, IR Recv */
839 /* WinTV-HVR1270 (PCIe, Retail, full height)
840 * ATSC/QAM and basic analog, IR Blast */
842 /* WinTV-HVR1210 (PCIe, Retail, full height)
843 * DVB-T and basic analog, IR Blast */
845 /* WinTV-HVR1270 (PCIe, Retail, full height)
846 * ATSC/QAM and basic analog, IR Recv */
848 /* WinTV-HVR1210 (PCIe, Retail, full height)
849 * DVB-T and basic analog, IR Recv */
851 /* WinTV-HVR1275 (PCIe, Retail, full height)
852 * ATSC/QAM and basic analog, IR Recv */
854 /* WinTV-HVR1210 (PCIe, Retail, full height)
855 * DVB-T and basic analog, IR Recv */
857 /* WinTV-HVR1200 (PCIe, Retail, full height)
858 * DVB-T and basic analog */
860 /* WinTV-HVR1200 (PCIe, OEM, half height)
861 * DVB-T and basic analog */
863 /* WinTV-HVR1200 (PCIe, OEM, half height)
864 * DVB-T and basic analog */
866 /* WinTV-HVR1200 (PCIe, OEM, full height)
867 * DVB-T and basic analog */
869 /* WinTV-HVR1200 (PCIe, OEM, half height)
870 * DVB-T and basic analog */
872 /* WinTV-HVR1200 (PCIe, OEM, full height)
873 * DVB-T and basic analog */
875 /* WinTV-HVR1200 (PCIe, OEM, full height)
876 * DVB-T and basic analog */
878 /* WinTV-HVR1200 (PCIe, OEM, half height)
879 * DVB-T and basic analog */
881 /* WinTV-HVR1200 (PCIe, OEM, full height)
882 * DVB-T and basic analog */
884 /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
885 channel ATSC and MPEG2 HW Encoder */
887 /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
890 /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
893 /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
896 /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
899 /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
900 Dual channel ATSC and MPEG2 HW Encoder */
902 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
903 Dual channel ATSC and MPEG2 HW Encoder */
905 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
906 Dual channel ATSC and MPEG2 HW Encoder */
908 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
909 Dual channel ATSC and MPEG2 HW Encoder */
911 /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
912 Dual channel ATSC and MPEG2 HW Encoder */
914 /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
915 ATSC and Basic analog */
917 /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
918 ATSC and Basic analog */
920 /* WinTV-HVR1250 (PCIe, No IR, half height,
921 ATSC [at least] and Basic analog) */
923 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
924 ATSC and Basic analog */
926 /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
927 ATSC and Basic analog */
929 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
930 ATSC and Basic analog */
932 /* WinTV-HVR1400 (Express Card, Retail, IR,
933 * DVB-T and Basic analog */
935 /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
936 * DVB-T and MPEG2 HW Encoder */
938 /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
939 * DVB-T and MPEG2 HW Encoder */
942 /* WinTV-HVR1850 (PCIe, Retail, 3.5mm in, IR, FM,
943 Dual channel ATSC and MPEG2 HW Encoder */
946 /* WinTV-HVR1290 (PCIe, OEM, RCA in, IR,
947 Dual channel ATSC and Basic analog */
950 printk(KERN_WARNING "%s: warning: "
951 "unknown hauppauge model #%d\n",
952 dev->name, tv.model);
956 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
957 dev->name, tv.model);
960 int cx23885_tuner_callback(void *priv, int component, int command, int arg)
962 struct cx23885_tsport *port = priv;
963 struct cx23885_dev *dev = port->dev;
966 if ((command == XC2028_RESET_CLK) || (command == XC2028_I2C_FLUSH))
970 printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
975 switch (dev->board) {
976 case CX23885_BOARD_HAUPPAUGE_HVR1400:
977 case CX23885_BOARD_HAUPPAUGE_HVR1500:
978 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
979 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
980 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
981 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
982 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
983 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
984 /* Tuner Reset Command */
987 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
988 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
989 /* Two identical tuners on two different i2c buses,
990 * we need to reset the correct gpio. */
993 else if (port->nr == 2)
996 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
997 /* Tuner Reset Command */
1000 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1001 altera_ci_tuner_reset(dev, port->nr);
1006 /* Drive the tuner into reset and back out */
1007 cx_clear(GP0_IO, bitmask);
1009 cx_set(GP0_IO, bitmask);
1015 void cx23885_gpio_setup(struct cx23885_dev *dev)
1017 switch (dev->board) {
1018 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1019 /* GPIO-0 cx24227 demodulator reset */
1020 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1022 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1023 /* GPIO-0 cx24227 demodulator */
1024 /* GPIO-2 xc3028 tuner */
1026 /* Put the parts into reset */
1027 cx_set(GP0_IO, 0x00050000);
1028 cx_clear(GP0_IO, 0x00000005);
1031 /* Bring the parts out of reset */
1032 cx_set(GP0_IO, 0x00050005);
1034 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
1035 /* GPIO-0 cx24227 demodulator reset */
1036 /* GPIO-2 xc5000 tuner reset */
1037 cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */
1039 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1040 /* GPIO-0 656_CLK */
1042 /* GPIO-2 8295A Reset */
1043 /* GPIO-3-10 cx23417 data0-7 */
1044 /* GPIO-11-14 cx23417 addr0-3 */
1045 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1048 /* CX23417 GPIO's */
1049 /* EIO15 Zilog Reset */
1050 /* EIO14 S5H1409/CX24227 Reset */
1051 mc417_gpio_enable(dev, GPIO_15 | GPIO_14, 1);
1053 /* Put the demod into reset and protect the eeprom */
1054 mc417_gpio_clear(dev, GPIO_15 | GPIO_14);
1057 /* Bring the demod and blaster out of reset */
1058 mc417_gpio_set(dev, GPIO_15 | GPIO_14);
1061 /* Force the TDA8295A into reset and back */
1062 cx23885_gpio_enable(dev, GPIO_2, 1);
1063 cx23885_gpio_set(dev, GPIO_2);
1065 cx23885_gpio_clear(dev, GPIO_2);
1067 cx23885_gpio_set(dev, GPIO_2);
1070 case CX23885_BOARD_HAUPPAUGE_HVR1200:
1071 /* GPIO-0 tda10048 demodulator reset */
1072 /* GPIO-2 tda18271 tuner reset */
1074 /* Put the parts into reset and back */
1075 cx_set(GP0_IO, 0x00050000);
1077 cx_clear(GP0_IO, 0x00000005);
1079 cx_set(GP0_IO, 0x00050005);
1081 case CX23885_BOARD_HAUPPAUGE_HVR1700:
1082 /* GPIO-0 TDA10048 demodulator reset */
1083 /* GPIO-2 TDA8295A Reset */
1084 /* GPIO-3-10 cx23417 data0-7 */
1085 /* GPIO-11-14 cx23417 addr0-3 */
1086 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1088 /* The following GPIO's are on the interna AVCore (cx25840) */
1090 /* GPIO-20 IR_TX 416/DVBT Select */
1091 /* GPIO-21 IIS DAT */
1092 /* GPIO-22 IIS WCLK */
1093 /* GPIO-23 IIS BCLK */
1095 /* Put the parts into reset and back */
1096 cx_set(GP0_IO, 0x00050000);
1098 cx_clear(GP0_IO, 0x00000005);
1100 cx_set(GP0_IO, 0x00050005);
1102 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1103 /* GPIO-0 Dibcom7000p demodulator reset */
1104 /* GPIO-2 xc3028L tuner reset */
1107 /* Put the parts into reset and back */
1108 cx_set(GP0_IO, 0x00050000);
1110 cx_clear(GP0_IO, 0x00000005);
1112 cx_set(GP0_IO, 0x00050005);
1114 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
1115 /* GPIO-0 xc5000 tuner reset i2c bus 0 */
1116 /* GPIO-1 s5h1409 demod reset i2c bus 0 */
1117 /* GPIO-2 xc5000 tuner reset i2c bus 1 */
1118 /* GPIO-3 s5h1409 demod reset i2c bus 0 */
1120 /* Put the parts into reset and back */
1121 cx_set(GP0_IO, 0x000f0000);
1123 cx_clear(GP0_IO, 0x0000000f);
1125 cx_set(GP0_IO, 0x000f000f);
1127 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
1128 /* GPIO-0 portb xc3028 reset */
1129 /* GPIO-1 portb zl10353 reset */
1130 /* GPIO-2 portc xc3028 reset */
1131 /* GPIO-3 portc zl10353 reset */
1133 /* Put the parts into reset and back */
1134 cx_set(GP0_IO, 0x000f0000);
1136 cx_clear(GP0_IO, 0x0000000f);
1138 cx_set(GP0_IO, 0x000f000f);
1140 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
1141 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
1142 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
1143 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
1144 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
1145 /* GPIO-2 xc3028 tuner reset */
1147 /* The following GPIO's are on the internal AVCore (cx25840) */
1148 /* GPIO-? zl10353 demod reset */
1150 /* Put the parts into reset and back */
1151 cx_set(GP0_IO, 0x00040000);
1153 cx_clear(GP0_IO, 0x00000004);
1155 cx_set(GP0_IO, 0x00040004);
1157 case CX23885_BOARD_TBS_6920:
1158 cx_write(MC417_CTL, 0x00000036);
1159 cx_write(MC417_OEN, 0x00001000);
1160 cx_set(MC417_RWD, 0x00000002);
1162 cx_clear(MC417_RWD, 0x00000800);
1164 cx_set(MC417_RWD, 0x00000800);
1167 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1168 /* GPIO-0 INTA from CiMax1
1169 GPIO-1 INTB from CiMax2
1171 GPIO-3 to GPIO-10 data/addr for CA
1172 GPIO-11 ~CS0 to CiMax1
1173 GPIO-12 ~CS1 to CiMax2
1174 GPIO-13 ADL0 load LSB addr
1175 GPIO-14 ADL1 load MSB addr
1176 GPIO-15 ~RDY from CiMax
1177 GPIO-17 ~RD to CiMax
1178 GPIO-18 ~WR to CiMax
1180 cx_set(GP0_IO, 0x00040000); /* GPIO as out */
1181 /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */
1182 cx_clear(GP0_IO, 0x00030004);
1183 mdelay(100);/* reset delay */
1184 cx_set(GP0_IO, 0x00040004); /* GPIO as out, reset high */
1185 cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */
1186 /* GPIO-15 IN as ~ACK, rest as OUT */
1187 cx_write(MC417_OEN, 0x00001000);
1188 /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */
1189 cx_write(MC417_RWD, 0x0000c300);
1191 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1193 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1194 case CX23885_BOARD_HAUPPAUGE_HVR1275:
1195 case CX23885_BOARD_HAUPPAUGE_HVR1255:
1196 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
1197 case CX23885_BOARD_HAUPPAUGE_HVR1210:
1198 /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */
1199 /* GPIO-6 I2C Gate which can isolate the demod from the bus */
1200 /* GPIO-9 Demod reset */
1202 /* Put the parts into reset and back */
1203 cx23885_gpio_enable(dev, GPIO_9 | GPIO_6 | GPIO_5, 1);
1204 cx23885_gpio_set(dev, GPIO_9 | GPIO_6 | GPIO_5);
1205 cx23885_gpio_clear(dev, GPIO_9);
1207 cx23885_gpio_set(dev, GPIO_9);
1209 case CX23885_BOARD_MYGICA_X8506:
1210 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
1211 case CX23885_BOARD_MYGICA_X8507:
1212 /* GPIO-0 (0)Analog / (1)Digital TV */
1213 /* GPIO-1 reset XC5000 */
1214 /* GPIO-2 reset LGS8GL5 / LGS8G75 */
1215 cx23885_gpio_enable(dev, GPIO_0 | GPIO_1 | GPIO_2, 1);
1216 cx23885_gpio_clear(dev, GPIO_1 | GPIO_2);
1218 cx23885_gpio_set(dev, GPIO_0 | GPIO_1 | GPIO_2);
1221 case CX23885_BOARD_MYGICA_X8558PRO:
1222 /* GPIO-0 reset first ATBM8830 */
1223 /* GPIO-1 reset second ATBM8830 */
1224 cx23885_gpio_enable(dev, GPIO_0 | GPIO_1, 1);
1225 cx23885_gpio_clear(dev, GPIO_0 | GPIO_1);
1227 cx23885_gpio_set(dev, GPIO_0 | GPIO_1);
1230 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1231 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1232 /* GPIO-0 656_CLK */
1235 /* GPIO-3-10 cx23417 data0-7 */
1236 /* GPIO-11-14 cx23417 addr0-3 */
1237 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
1239 /* GPIO-20 C_IR_TX */
1240 /* GPIO-21 I2S DAT */
1241 /* GPIO-22 I2S WCLK */
1242 /* GPIO-23 I2S BCLK */
1243 /* ALT GPIO: EXP GPIO LATCH */
1245 /* CX23417 GPIO's */
1246 /* GPIO-14 S5H1411/CX24228 Reset */
1247 /* GPIO-13 EEPROM write protect */
1248 mc417_gpio_enable(dev, GPIO_14 | GPIO_13, 1);
1250 /* Put the demod into reset and protect the eeprom */
1251 mc417_gpio_clear(dev, GPIO_14 | GPIO_13);
1254 /* Bring the demod out of reset */
1255 mc417_gpio_set(dev, GPIO_14);
1259 /* Connected to IF / Mux */
1261 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
1262 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
1264 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1267 GPIO-2 ~reset chips out
1268 GPIO-3 to GPIO-10 data/addr for CA in/out
1278 cx_set(GP0_IO, 0x00060000); /* GPIO-1,2 as out */
1279 /* GPIO-0 as INT, reset & TMS low */
1280 cx_clear(GP0_IO, 0x00010006);
1281 mdelay(100);/* reset delay */
1282 cx_set(GP0_IO, 0x00000004); /* reset high */
1283 cx_write(MC417_CTL, 0x00000037);/* enable GPIO-3..18 pins */
1284 /* GPIO-17 is TDO in, GPIO-15 is ~RDY in, rest is out */
1285 cx_write(MC417_OEN, 0x00005000);
1286 /* ~RD, ~WR high; ADDR low; ~CS high */
1287 cx_write(MC417_RWD, 0x00000d00);
1289 cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
1294 int cx23885_ir_init(struct cx23885_dev *dev)
1296 static struct v4l2_subdev_io_pin_config ir_rxtx_pin_cfg[] = {
1298 .flags = V4L2_SUBDEV_IO_PIN_INPUT,
1299 .pin = CX23885_PIN_IR_RX_GPIO19,
1300 .function = CX23885_PAD_IR_RX,
1302 .strength = CX25840_PIN_DRIVE_MEDIUM,
1304 .flags = V4L2_SUBDEV_IO_PIN_OUTPUT,
1305 .pin = CX23885_PIN_IR_TX_GPIO20,
1306 .function = CX23885_PAD_IR_TX,
1308 .strength = CX25840_PIN_DRIVE_MEDIUM,
1311 const size_t ir_rxtx_pin_cfg_count = ARRAY_SIZE(ir_rxtx_pin_cfg);
1313 static struct v4l2_subdev_io_pin_config ir_rx_pin_cfg[] = {
1315 .flags = V4L2_SUBDEV_IO_PIN_INPUT,
1316 .pin = CX23885_PIN_IR_RX_GPIO19,
1317 .function = CX23885_PAD_IR_RX,
1319 .strength = CX25840_PIN_DRIVE_MEDIUM,
1322 const size_t ir_rx_pin_cfg_count = ARRAY_SIZE(ir_rx_pin_cfg);
1324 struct v4l2_subdev_ir_parameters params;
1326 switch (dev->board) {
1327 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1328 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
1329 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1330 case CX23885_BOARD_HAUPPAUGE_HVR1200:
1331 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1332 case CX23885_BOARD_HAUPPAUGE_HVR1275:
1333 case CX23885_BOARD_HAUPPAUGE_HVR1255:
1334 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
1335 case CX23885_BOARD_HAUPPAUGE_HVR1210:
1336 /* FIXME: Implement me */
1338 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1339 ret = cx23888_ir_probe(dev);
1342 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
1343 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1344 ir_rx_pin_cfg_count, ir_rx_pin_cfg);
1346 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1347 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1348 ret = cx23888_ir_probe(dev);
1351 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
1352 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1353 ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg);
1355 * For these boards we need to invert the Tx output via the
1356 * IR controller to have the LED off while idle
1358 v4l2_subdev_call(dev->sd_ir, ir, tx_g_parameters, ¶ms);
1359 params.enable = false;
1360 params.shutdown = false;
1361 params.invert_level = true;
1362 v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, ¶ms);
1363 params.shutdown = true;
1364 v4l2_subdev_call(dev->sd_ir, ir, tx_s_parameters, ¶ms);
1366 case CX23885_BOARD_TEVII_S470:
1369 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
1370 if (dev->sd_ir == NULL) {
1374 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1375 ir_rx_pin_cfg_count, ir_rx_pin_cfg);
1377 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1380 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
1381 if (dev->sd_ir == NULL) {
1385 v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config,
1386 ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg);
1388 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
1389 request_module("ir-kbd-i2c");
1396 void cx23885_ir_fini(struct cx23885_dev *dev)
1398 switch (dev->board) {
1399 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1400 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1401 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1402 cx23885_irq_remove(dev, PCI_MSK_IR);
1403 cx23888_ir_remove(dev);
1406 case CX23885_BOARD_TEVII_S470:
1407 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1408 cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
1409 /* sd_ir is a duplicate pointer to the AV Core, just clear it */
1415 int netup_jtag_io(void *device, int tms, int tdi, int read_tdo)
1419 struct cx23885_dev *dev = (struct cx23885_dev *)device;
1421 data = ((cx_read(GP0_IO)) & (~0x00000002));
1422 data |= (tms ? 0x00020002 : 0x00020000);
1423 cx_write(GP0_IO, data);
1426 data = ((cx_read(MC417_RWD)) & (~0x0000a000));
1427 data |= (tdi ? 0x00008000 : 0);
1428 cx_write(MC417_RWD, data);
1430 tdo = (data & 0x00004000) ? 1 : 0; /*TDO*/
1432 cx_write(MC417_RWD, data | 0x00002000);
1435 cx_write(MC417_RWD, data);
1440 void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1442 switch (dev->board) {
1443 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1444 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1445 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1447 cx23885_irq_add_enable(dev, PCI_MSK_IR);
1449 case CX23885_BOARD_TEVII_S470:
1450 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1452 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
1457 void cx23885_card_setup(struct cx23885_dev *dev)
1459 struct cx23885_tsport *ts1 = &dev->ts1;
1460 struct cx23885_tsport *ts2 = &dev->ts2;
1462 static u8 eeprom[256];
1464 if (dev->i2c_bus[0].i2c_rc == 0) {
1465 dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
1466 tveeprom_read(&dev->i2c_bus[0].i2c_client,
1467 eeprom, sizeof(eeprom));
1470 switch (dev->board) {
1471 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1472 if (dev->i2c_bus[0].i2c_rc == 0) {
1473 if (eeprom[0x80] != 0x84)
1474 hauppauge_eeprom(dev, eeprom+0xc0);
1476 hauppauge_eeprom(dev, eeprom+0x80);
1479 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1480 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
1481 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1482 if (dev->i2c_bus[0].i2c_rc == 0)
1483 hauppauge_eeprom(dev, eeprom+0x80);
1485 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1486 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
1487 case CX23885_BOARD_HAUPPAUGE_HVR1200:
1488 case CX23885_BOARD_HAUPPAUGE_HVR1700:
1489 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1490 case CX23885_BOARD_HAUPPAUGE_HVR1275:
1491 case CX23885_BOARD_HAUPPAUGE_HVR1255:
1492 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
1493 case CX23885_BOARD_HAUPPAUGE_HVR1210:
1494 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1495 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1496 if (dev->i2c_bus[0].i2c_rc == 0)
1497 hauppauge_eeprom(dev, eeprom+0xc0);
1501 switch (dev->board) {
1502 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
1503 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
1504 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1505 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1506 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1507 /* break omitted intentionally */
1508 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
1509 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1510 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1511 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1513 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1514 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1515 /* Defaults for VID B - Analog encoder */
1516 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
1517 ts1->gen_ctrl_val = 0x10e;
1518 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1519 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1521 /* APB_TSVALERR_POL (active low)*/
1522 ts1->vld_misc_val = 0x2000;
1523 ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc);
1524 cx_write(0x130184, 0xc);
1526 /* Defaults for VID C */
1527 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1528 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1529 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1531 case CX23885_BOARD_TBS_6920:
1532 ts1->gen_ctrl_val = 0x4; /* Parallel */
1533 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1534 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1536 case CX23885_BOARD_TEVII_S470:
1537 case CX23885_BOARD_TEVII_S471:
1538 case CX23885_BOARD_DVBWORLD_2005:
1539 ts1->gen_ctrl_val = 0x5; /* Parallel */
1540 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1541 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1543 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1544 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1545 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
1546 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1547 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1548 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1549 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1550 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1551 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1553 case CX23885_BOARD_MYGICA_X8506:
1554 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
1555 ts1->gen_ctrl_val = 0x5; /* Parallel */
1556 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1557 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1559 case CX23885_BOARD_MYGICA_X8558PRO:
1560 ts1->gen_ctrl_val = 0x5; /* Parallel */
1561 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1562 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1563 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1564 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1565 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1567 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1568 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1569 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
1570 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
1571 case CX23885_BOARD_HAUPPAUGE_HVR1200:
1572 case CX23885_BOARD_HAUPPAUGE_HVR1700:
1573 case CX23885_BOARD_HAUPPAUGE_HVR1400:
1574 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
1575 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
1576 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
1577 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1578 case CX23885_BOARD_HAUPPAUGE_HVR1275:
1579 case CX23885_BOARD_HAUPPAUGE_HVR1255:
1580 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
1581 case CX23885_BOARD_HAUPPAUGE_HVR1210:
1582 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
1583 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1584 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
1586 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1587 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1588 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1591 /* Certain boards support analog, or require the avcore to be
1592 * loaded, ensure this happens.
1594 switch (dev->board) {
1595 case CX23885_BOARD_TEVII_S470:
1596 /* Currently only enabled for the integrated IR controller */
1599 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1600 case CX23885_BOARD_HAUPPAUGE_HVR1800:
1601 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
1602 case CX23885_BOARD_HAUPPAUGE_HVR1700:
1603 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
1604 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
1605 case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
1606 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1607 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
1608 case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
1609 case CX23885_BOARD_HAUPPAUGE_HVR1255:
1610 case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
1611 case CX23885_BOARD_HAUPPAUGE_HVR1270:
1612 case CX23885_BOARD_HAUPPAUGE_HVR1850:
1613 case CX23885_BOARD_MYGICA_X8506:
1614 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
1615 case CX23885_BOARD_HAUPPAUGE_HVR1290:
1616 case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
1617 case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
1618 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1619 case CX23885_BOARD_MPX885:
1620 case CX23885_BOARD_MYGICA_X8507:
1621 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
1622 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
1623 &dev->i2c_bus[2].i2c_adap,
1624 "cx25840", 0x88 >> 1, NULL);
1625 if (dev->sd_cx25840) {
1626 dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE;
1627 v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
1632 /* AUX-PLL 27MHz CLK */
1633 switch (dev->board) {
1634 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
1635 netup_initialize(dev);
1637 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: {
1639 const struct firmware *fw;
1640 const char *filename = "dvb-netup-altera-01.fw";
1641 char *action = "configure";
1642 static struct netup_card_info cinfo;
1643 struct altera_config netup_config = {
1646 .jtag_io = netup_jtag_io,
1649 netup_initialize(dev);
1651 netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo);
1653 cinfo.rev = netup_card_rev;
1655 switch (cinfo.rev) {
1657 filename = "dvb-netup-altera-04.fw";
1660 filename = "dvb-netup-altera-01.fw";
1663 printk(KERN_INFO "NetUP card rev=0x%x fw_filename=%s\n",
1664 cinfo.rev, filename);
1666 ret = request_firmware(&fw, filename, &dev->pci->dev);
1668 printk(KERN_ERR "did not find the firmware file. (%s) "
1669 "Please see linux/Documentation/dvb/ for more details "
1670 "on firmware-problems.", filename);
1672 altera_init(&netup_config, fw);
1674 release_firmware(fw);
1680 /* ------------------------------------------------------------------ */