2 * $Id: cx88-cards.c,v 1.66 2005/03/04 09:12:23 kraxel Exp $
4 * device driver for Conexant 2388x based TV cards
7 * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/pci.h>
27 #include <linux/delay.h>
31 /* ------------------------------------------------------------------ */
32 /* board config info */
34 struct cx88_board cx88_boards
[] = {
35 [CX88_BOARD_UNKNOWN
] = {
36 .name
= "UNKNOWN/GENERIC",
39 .type
= CX88_VMUX_COMPOSITE1
,
42 .type
= CX88_VMUX_COMPOSITE2
,
45 .type
= CX88_VMUX_COMPOSITE3
,
48 .type
= CX88_VMUX_COMPOSITE4
,
52 [CX88_BOARD_HAUPPAUGE
] = {
53 .name
= "Hauppauge WinTV 34xxx models",
55 .tda9887_conf
= TDA9887_PRESENT
,
57 .type
= CX88_VMUX_TELEVISION
,
59 .gpio0
= 0xff00, // internal decoder
61 .type
= CX88_VMUX_DEBUG
,
63 .gpio0
= 0xff01, // mono from tuner chip
65 .type
= CX88_VMUX_COMPOSITE1
,
69 .type
= CX88_VMUX_SVIDEO
,
79 .name
= "GDI Black Gold",
82 .type
= CX88_VMUX_TELEVISION
,
86 [CX88_BOARD_PIXELVIEW
] = {
90 .type
= CX88_VMUX_TELEVISION
,
92 .gpio0
= 0xff00, // internal decoder
94 .type
= CX88_VMUX_COMPOSITE1
,
97 .type
= CX88_VMUX_SVIDEO
,
105 [CX88_BOARD_ATI_WONDER_PRO
] = {
106 .name
= "ATI TV Wonder Pro",
108 .tda9887_conf
= TDA9887_PRESENT
| TDA9887_INTERCARRIER
,
110 .type
= CX88_VMUX_TELEVISION
,
114 .type
= CX88_VMUX_COMPOSITE1
,
118 .type
= CX88_VMUX_SVIDEO
,
123 [CX88_BOARD_WINFAST2000XP_EXPERT
] = {
124 .name
= "Leadtek Winfast 2000XP Expert",
126 .tda9887_conf
= TDA9887_PRESENT
,
128 .type
= CX88_VMUX_TELEVISION
,
135 .type
= CX88_VMUX_COMPOSITE1
,
142 .type
= CX88_VMUX_SVIDEO
,
157 [CX88_BOARD_AVERTV_303
] = {
158 .name
= "AverTV Studio 303 (M126)",
160 .tda9887_conf
= TDA9887_PRESENT
,
162 .type
= CX88_VMUX_TELEVISION
,
166 .type
= CX88_VMUX_COMPOSITE1
,
170 .type
= CX88_VMUX_SVIDEO
,
178 [CX88_BOARD_MSI_TVANYWHERE_MASTER
] = {
179 // added gpio values thanks to Michal
180 // values for PAL from DScaler
181 .name
= "MSI TV-@nywhere Master",
183 .tda9887_conf
= TDA9887_PRESENT
,
185 .type
= CX88_VMUX_TELEVISION
,
191 .type
= CX88_VMUX_COMPOSITE1
,
197 .type
= CX88_VMUX_SVIDEO
,
207 [CX88_BOARD_WINFAST_DV2000
] = {
208 .name
= "Leadtek Winfast DV2000",
210 .tda9887_conf
= TDA9887_PRESENT
,
212 .type
= CX88_VMUX_TELEVISION
,
220 .type
= CX88_VMUX_COMPOSITE1
,
227 .type
= CX88_VMUX_SVIDEO
,
242 [CX88_BOARD_LEADTEK_PVR2000
] = {
243 // gpio values for PAL version from regspy by DScaler
244 .name
= "Leadtek PVR 2000",
246 .tda9887_conf
= TDA9887_PRESENT
,
248 .type
= CX88_VMUX_TELEVISION
,
252 .type
= CX88_VMUX_COMPOSITE1
,
256 .type
= CX88_VMUX_SVIDEO
,
266 [CX88_BOARD_IODATA_GVVCP3PCI
] = {
267 .name
= "IODATA GV-VCP3/PCI",
268 .tuner_type
= TUNER_ABSENT
,
270 .type
= CX88_VMUX_COMPOSITE1
,
273 .type
= CX88_VMUX_COMPOSITE2
,
276 .type
= CX88_VMUX_SVIDEO
,
280 [CX88_BOARD_PROLINK_PLAYTVPVR
] = {
281 .name
= "Prolink PlayTV PVR",
283 .tda9887_conf
= TDA9887_PRESENT
,
285 .type
= CX88_VMUX_TELEVISION
,
289 .type
= CX88_VMUX_COMPOSITE1
,
293 .type
= CX88_VMUX_SVIDEO
,
302 [CX88_BOARD_ASUS_PVR_416
] = {
303 .name
= "ASUS PVR-416",
305 .tda9887_conf
= TDA9887_PRESENT
,
307 .type
= CX88_VMUX_TELEVISION
,
311 .type
= CX88_VMUX_SVIDEO
,
313 .gpio0
= 0x0000fde6, // 0x0000fda6 L,R RCA audio in?
321 [CX88_BOARD_MSI_TVANYWHERE
] = {
322 .name
= "MSI TV-@nywhere",
324 .tda9887_conf
= TDA9887_PRESENT
,
326 .type
= CX88_VMUX_TELEVISION
,
331 .type
= CX88_VMUX_COMPOSITE1
,
336 .type
= CX88_VMUX_SVIDEO
,
342 [CX88_BOARD_KWORLD_DVB_T
] = {
343 .name
= "KWorld/VStream XPert DVB-T",
344 .tuner_type
= TUNER_ABSENT
,
346 .type
= CX88_VMUX_COMPOSITE1
,
351 .type
= CX88_VMUX_SVIDEO
,
358 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1
] = {
359 .name
= "DVICO FusionHDTV DVB-T1",
360 .tuner_type
= TUNER_ABSENT
, /* No analog tuner */
362 .type
= CX88_VMUX_COMPOSITE1
,
366 .type
= CX88_VMUX_SVIDEO
,
372 [CX88_BOARD_KWORLD_LTV883
] = {
373 .name
= "KWorld LTV883RF",
376 .type
= CX88_VMUX_TELEVISION
,
380 .type
= CX88_VMUX_DEBUG
,
382 .gpio0
= 0x07f9, // mono from tuner chip
384 .type
= CX88_VMUX_COMPOSITE1
,
388 .type
= CX88_VMUX_SVIDEO
,
397 [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD
] = {
398 .name
= "DViCO - FusionHDTV 3 Gold",
399 .tuner_type
= TUNER_MICROTUNE_4042FI5
,
401 GPIO[0] resets DT3302 DTV receiver
404 GPIO[1] mutes analog audio output connector
405 0 - enable selected source
407 GPIO[2] selects source for analog audio output connector
408 0 - analog audio input connector on tab
409 1 - analog DAC output from CX23881 chip
410 GPIO[3] selects RF input connector on tuner module
411 0 - RF connector labeled CABLE
412 1 - RF connector labeled ANT
415 .type
= CX88_VMUX_TELEVISION
,
419 .type
= CX88_VMUX_CABLE
,
423 .type
= CX88_VMUX_COMPOSITE1
,
427 .type
= CX88_VMUX_SVIDEO
,
432 [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T
] = {
433 .name
= "DViCO - FusionHDTV 3 Gold-T",
434 .tuner_type
= 52, /* Thomson DDT 7611 ATSC/NTSC */
435 /* See DViCO FusionHDTV 3 Gold for GPIO documentation. */
437 .type
= CX88_VMUX_TELEVISION
,
441 .type
= CX88_VMUX_CABLE
,
445 .type
= CX88_VMUX_COMPOSITE1
,
449 .type
= CX88_VMUX_SVIDEO
,
454 [CX88_BOARD_HAUPPAUGE_DVB_T1
] = {
455 .name
= "Hauppauge Nova-T DVB-T",
456 .tuner_type
= TUNER_ABSENT
,
458 .type
= CX88_VMUX_DVB
,
463 [CX88_BOARD_CONEXANT_DVB_T1
] = {
464 .name
= "Conexant DVB-T reference design",
465 .tuner_type
= TUNER_ABSENT
,
467 .type
= CX88_VMUX_DVB
,
472 [CX88_BOARD_PROVIDEO_PV259
] = {
473 .name
= "Provideo PV259",
474 .tuner_type
= TUNER_PHILIPS_FQ1216ME
,
476 .type
= CX88_VMUX_TELEVISION
,
481 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS
] = {
482 .name
= "DVICO FusionHDTV DVB-T Plus",
483 .tuner_type
= TUNER_ABSENT
, /* No analog tuner */
485 .type
= CX88_VMUX_COMPOSITE1
,
489 .type
= CX88_VMUX_SVIDEO
,
495 [CX88_BOARD_DNTV_LIVE_DVB_T
] = {
496 .name
= "digitalnow DNTV Live! DVB-T",
497 .tuner_type
= TUNER_ABSENT
,
499 .type
= CX88_VMUX_COMPOSITE1
,
504 .type
= CX88_VMUX_SVIDEO
,
511 [CX88_BOARD_PCHDTV_HD3000
] = {
512 .name
= "pcHDTV HD3000 HDTV",
513 .tuner_type
= TUNER_THOMSON_DTT7610
,
515 .type
= CX88_VMUX_TELEVISION
,
522 .type
= CX88_VMUX_COMPOSITE1
,
529 .type
= CX88_VMUX_SVIDEO
,
546 [CX88_BOARD_HAUPPAUGE_ROSLYN
] = {
547 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu>
548 // GPIO values obtained from regspy, courtesy Sean Covel
549 .name
= "Hauppauge WinTV 28xxx (Roslyn) models",
552 .type
= CX88_VMUX_TELEVISION
,
554 .gpio0
= 0xed12, // internal decoder
557 .type
= CX88_VMUX_DEBUG
,
559 .gpio0
= 0xff01, // mono from tuner chip
561 .type
= CX88_VMUX_COMPOSITE1
,
565 .type
= CX88_VMUX_SVIDEO
,
577 [CX88_BOARD_DIGITALLOGIC_MEC
] = {
578 /* params copied over from Leadtek PVR 2000 */
579 .name
= "Digital-Logic MICROSPACE Entertainment Center (MEC)",
580 /* not sure yet about the tuner type */
582 .tda9887_conf
= TDA9887_PRESENT
,
584 .type
= CX88_VMUX_TELEVISION
,
588 .type
= CX88_VMUX_COMPOSITE1
,
592 .type
= CX88_VMUX_SVIDEO
,
602 [CX88_BOARD_IODATA_GVBCTV7E
] = {
603 .name
= "IODATA GV/BCTV7E",
604 .tuner_type
= TUNER_PHILIPS_FQ1286
,
605 .tda9887_conf
= TDA9887_PRESENT
,
607 .type
= CX88_VMUX_TELEVISION
,
611 .type
= CX88_VMUX_COMPOSITE1
,
615 .type
= CX88_VMUX_SVIDEO
,
620 [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO
] = {
621 .name
= "PixelView PlayTV Ultra Pro (Stereo)",
624 .type
= CX88_VMUX_TELEVISION
,
626 .gpio0
= 0xbf61, // internal decoder
628 .type
= CX88_VMUX_COMPOSITE1
,
632 .type
= CX88_VMUX_SVIDEO
,
642 const unsigned int cx88_bcount
= ARRAY_SIZE(cx88_boards
);
644 /* ------------------------------------------------------------------ */
645 /* PCI subsystem IDs */
647 struct cx88_subid cx88_subids
[] = {
651 .card
= CX88_BOARD_HAUPPAUGE
,
655 .card
= CX88_BOARD_HAUPPAUGE
,
659 .card
= CX88_BOARD_GDI
,
662 .subdevice
= 0x0107, /* with mpeg encoder */
663 .card
= CX88_BOARD_GDI
,
665 .subvendor
= PCI_VENDOR_ID_ATI
,
667 .card
= CX88_BOARD_ATI_WONDER_PRO
,
671 .card
= CX88_BOARD_WINFAST2000XP_EXPERT
,
674 .subdevice
= 0x6613, /* NTSC */
675 .card
= CX88_BOARD_WINFAST2000XP_EXPERT
,
679 .card
= CX88_BOARD_WINFAST_DV2000
,
683 .card
= CX88_BOARD_LEADTEK_PVR2000
,
687 .card
= CX88_BOARD_LEADTEK_PVR2000
,
691 .card
= CX88_BOARD_AVERTV_303
,
695 .card
= CX88_BOARD_MSI_TVANYWHERE_MASTER
,
699 .card
= CX88_BOARD_IODATA_GVVCP3PCI
,
702 .subdevice
= 0x4823, /* with mpeg encoder */
703 .card
= CX88_BOARD_ASUS_PVR_416
,
707 .card
= CX88_BOARD_KWORLD_DVB_T
,
711 .card
= CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD
,
715 .card
= CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T
,
719 .card
= CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1
,
723 .card
= CX88_BOARD_HAUPPAUGE_DVB_T1
,
727 .card
= CX88_BOARD_CONEXANT_DVB_T1
,
731 .card
= CX88_BOARD_PROVIDEO_PV259
,
735 .card
= CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS
,
739 .card
= CX88_BOARD_PIXELVIEW
,
742 .subdevice
= 0x3000, /* HD-3000 card */
743 .card
= CX88_BOARD_PCHDTV_HD3000
,
747 .card
= CX88_BOARD_DNTV_LIVE_DVB_T
,
751 .card
= CX88_BOARD_HAUPPAUGE_ROSLYN
,
755 .card
= CX88_BOARD_DIGITALLOGIC_MEC
,
759 .card
= CX88_BOARD_IODATA_GVBCTV7E
,
762 const unsigned int cx88_idcount
= ARRAY_SIZE(cx88_subids
);
764 /* ----------------------------------------------------------------------- */
765 /* some leadtek specific stuff */
767 static void __devinit
leadtek_eeprom(struct cx88_core
*core
, u8
*eeprom_data
)
769 /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
772 * Byte 0 is 1 on the NTSC board.
775 if (eeprom_data
[4] != 0x7d ||
776 eeprom_data
[5] != 0x10 ||
777 eeprom_data
[7] != 0x66) {
778 printk(KERN_WARNING
"%s: Leadtek eeprom invalid.\n",
784 core
->tuner_type
= (eeprom_data
[6] == 0x13) ? 43 : 38;
786 printk(KERN_INFO
"%s: Leadtek Winfast 2000XP Expert config: "
787 "tuner=%d, eeprom[0]=0x%02x\n",
788 core
->name
, core
->tuner_type
, eeprom_data
[0]);
792 /* ----------------------------------------------------------------------- */
794 static void hauppauge_eeprom(struct cx88_core
*core
, u8
*eeprom_data
)
798 tveeprom_hauppauge_analog(&tv
, eeprom_data
);
799 core
->tuner_type
= tv
.tuner_type
;
800 core
->has_radio
= tv
.has_radio
;
803 static int hauppauge_eeprom_dvb(struct cx88_core
*core
, u8
*ee
)
808 /* Make sure we support the board model */
809 model
= ee
[0x1f] << 24 | ee
[0x1e] << 16 | ee
[0x1d] << 8 | ee
[0x1c];
817 printk("%s: warning: unknown hauppauge model #%d\n",
822 /* Make sure we support the tuner */
825 case 0x4B: /* dtt 7595 */
826 case 0x4C: /* dtt 7592 */
829 printk("%s: error: unknown hauppauge tuner 0x%02x\n",
833 printk(KERN_INFO
"%s: hauppauge eeprom: model=%d, tuner=%d\n",
834 core
->name
, model
, tuner
);
838 /* ----------------------------------------------------------------------- */
839 /* some GDI (was: Modular Technology) specific stuff */
846 [ 0x01 ] = { .id
= TUNER_ABSENT
,
848 [ 0x02 ] = { .id
= TUNER_ABSENT
,
850 [ 0x03 ] = { .id
= TUNER_ABSENT
,
852 [ 0x04 ] = { .id
= TUNER_ABSENT
,
854 [ 0x05 ] = { .id
= TUNER_ABSENT
,
857 [ 0x10 ] = { .id
= TUNER_ABSENT
,
859 .name
= "TEMIC_4049" },
860 [ 0x11 ] = { .id
= TUNER_TEMIC_4136FY5
,
861 .name
= "TEMIC_4136" },
862 [ 0x12 ] = { .id
= TUNER_ABSENT
,
863 .name
= "TEMIC_4146" },
865 [ 0x20 ] = { .id
= TUNER_PHILIPS_FQ1216ME
,
867 .name
= "PHILIPS_FQ1216_MK3" },
868 [ 0x21 ] = { .id
= TUNER_ABSENT
, .fm
= 1,
869 .name
= "PHILIPS_FQ1236_MK3" },
870 [ 0x22 ] = { .id
= TUNER_ABSENT
,
871 .name
= "PHILIPS_FI1236_MK3" },
872 [ 0x23 ] = { .id
= TUNER_ABSENT
,
873 .name
= "PHILIPS_FI1216_MK3" },
876 static void gdi_eeprom(struct cx88_core
*core
, u8
*eeprom_data
)
878 char *name
= (eeprom_data
[0x0d] < ARRAY_SIZE(gdi_tuner
))
879 ? gdi_tuner
[eeprom_data
[0x0d]].name
: NULL
;
881 printk(KERN_INFO
"%s: GDI: tuner=%s\n", core
->name
,
882 name
? name
: "unknown");
885 core
->tuner_type
= gdi_tuner
[eeprom_data
[0x0d]].id
;
886 core
->has_radio
= gdi_tuner
[eeprom_data
[0x0d]].fm
;
889 /* ----------------------------------------------------------------------- */
891 void cx88_card_list(struct cx88_core
*core
, struct pci_dev
*pci
)
895 if (0 == pci
->subsystem_vendor
&&
896 0 == pci
->subsystem_device
) {
897 printk("%s: Your board has no valid PCI Subsystem ID and thus can't\n"
898 "%s: be autodetected. Please pass card=<n> insmod option to\n"
899 "%s: workaround that. Redirect complaints to the vendor of\n"
900 "%s: the TV card. Best regards,\n"
902 core
->name
,core
->name
,core
->name
,core
->name
,core
->name
);
904 printk("%s: Your board isn't known (yet) to the driver. You can\n"
905 "%s: try to pick one of the existing card configs via\n"
906 "%s: card=<n> insmod option. Updating to the latest\n"
907 "%s: version might help as well.\n",
908 core
->name
,core
->name
,core
->name
,core
->name
);
910 printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n",
912 for (i
= 0; i
< cx88_bcount
; i
++)
913 printk("%s: card=%d -> %s\n",
914 core
->name
, i
, cx88_boards
[i
].name
);
917 void cx88_card_setup(struct cx88_core
*core
)
919 static u8 eeprom
[128];
921 if (0 == core
->i2c_rc
) {
922 core
->i2c_client
.addr
= 0xa0 >> 1;
923 tveeprom_read(&core
->i2c_client
,eeprom
,sizeof(eeprom
));
926 switch (core
->board
) {
927 case CX88_BOARD_HAUPPAUGE
:
928 case CX88_BOARD_HAUPPAUGE_ROSLYN
:
929 if (0 == core
->i2c_rc
)
930 hauppauge_eeprom(core
,eeprom
+8);
933 if (0 == core
->i2c_rc
)
934 gdi_eeprom(core
,eeprom
);
936 case CX88_BOARD_WINFAST2000XP_EXPERT
:
937 if (0 == core
->i2c_rc
)
938 leadtek_eeprom(core
,eeprom
);
940 case CX88_BOARD_HAUPPAUGE_DVB_T1
:
941 if (0 == core
->i2c_rc
)
942 hauppauge_eeprom_dvb(core
,eeprom
);
944 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1
:
945 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS
:
946 /* GPIO0:0 is hooked to mt352 reset pin */
947 cx_set(MO_GP0_IO
, 0x00000101);
948 cx_clear(MO_GP0_IO
, 0x00000001);
950 cx_set(MO_GP0_IO
, 0x00000101);
952 case CX88_BOARD_KWORLD_DVB_T
:
953 case CX88_BOARD_DNTV_LIVE_DVB_T
:
954 cx_set(MO_GP0_IO
, 0x00000707);
955 cx_set(MO_GP2_IO
, 0x00000101);
956 cx_clear(MO_GP2_IO
, 0x00000001);
958 cx_clear(MO_GP0_IO
, 0x00000007);
959 cx_set(MO_GP2_IO
, 0x00000101);
962 if (cx88_boards
[core
->board
].radio
.type
== CX88_RADIO
)
966 /* ------------------------------------------------------------------ */
968 EXPORT_SYMBOL(cx88_boards
);
969 EXPORT_SYMBOL(cx88_bcount
);
970 EXPORT_SYMBOL(cx88_subids
);
971 EXPORT_SYMBOL(cx88_idcount
);
972 EXPORT_SYMBOL(cx88_card_list
);
973 EXPORT_SYMBOL(cx88_card_setup
);