aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bttv-cards.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bttv-cards.c')
-rw-r--r--drivers/media/video/bttv-cards.c260
1 files changed, 130 insertions, 130 deletions
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 3937da065e4f..92bb515fbe4d 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -6,7 +6,7 @@
6 like the big tvcards array for the most part 6 like the big tvcards array for the most part
7 7
8 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) 8 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
9 & Marcus Metzler (mocm@thp.uni-koeln.de) 9 & Marcus Metzler (mocm@thp.uni-koeln.de)
10 (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de> 10 (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
@@ -163,10 +163,10 @@ static struct CARD {
163 { 0x6609107d, BTTV_BOARD_WINFAST2000, "Leadtek TV 2000 XP" }, 163 { 0x6609107d, BTTV_BOARD_WINFAST2000, "Leadtek TV 2000 XP" },
164 { 0x263610b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, 164 { 0x263610b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
165 { 0x264510b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, 165 { 0x264510b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" },
166 { 0x402010fc, BTTV_BOARD_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" }, 166 { 0x402010fc, BTTV_BOARD_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" },
167 { 0x405010fc, BTTV_BOARD_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" }, 167 { 0x405010fc, BTTV_BOARD_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" },
168 { 0x407010fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, 168 { 0x407010fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
169 { 0xd01810fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, 169 { 0xd01810fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" },
170 170
171 { 0x001211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" }, 171 { 0x001211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" },
172 /* some cards ship with byteswapped IDs ... */ 172 /* some cards ship with byteswapped IDs ... */
@@ -277,7 +277,7 @@ static struct CARD {
277 { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"}, 277 { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"},
278 { 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" }, 278 { 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" },
279 { 0x146caa0c, BTTV_BOARD_PV951, "ituner spectra8" }, 279 { 0x146caa0c, BTTV_BOARD_PV951, "ituner spectra8" },
280 { 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" }, 280 { 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" },
281 281
282 { 0x40111554, BTTV_BOARD_PV_BT878P_9B, "Prolink Pixelview PV-BT" }, 282 { 0x40111554, BTTV_BOARD_PV_BT878P_9B, "Prolink Pixelview PV-BT" },
283 { 0x17de0a01, BTTV_BOARD_KWORLD, "Mecer TV/FM/Video Tuner" }, 283 { 0x17de0a01, BTTV_BOARD_KWORLD, "Mecer TV/FM/Video Tuner" },
@@ -1346,17 +1346,17 @@ struct tvcard bttv_tvcards[] = {
1346 }, 1346 },
1347 [BTTV_BOARD_GMV1] = { 1347 [BTTV_BOARD_GMV1] = {
1348 /* Adrian Cox <adrian@humboldt.co.uk */ 1348 /* Adrian Cox <adrian@humboldt.co.uk */
1349 .name = "AG Electronics GMV1", 1349 .name = "AG Electronics GMV1",
1350 .video_inputs = 2, 1350 .video_inputs = 2,
1351 .audio_inputs = 0, 1351 .audio_inputs = 0,
1352 .tuner = -1, 1352 .tuner = -1,
1353 .svhs = 1, 1353 .svhs = 1,
1354 .gpiomask = 0xF, 1354 .gpiomask = 0xF,
1355 .muxsel = { 2, 2}, 1355 .muxsel = { 2, 2},
1356 .audiomux = { }, 1356 .audiomux = { },
1357 .no_msp34xx = 1, 1357 .no_msp34xx = 1,
1358 .needs_tvaudio = 0, 1358 .needs_tvaudio = 0,
1359 .pll = PLL_28, 1359 .pll = PLL_28,
1360 .tuner_type = -1, 1360 .tuner_type = -1,
1361 .tuner_addr = ADDR_UNSET, 1361 .tuner_addr = ADDR_UNSET,
1362 .radio_addr = ADDR_UNSET, 1362 .radio_addr = ADDR_UNSET,
@@ -2895,7 +2895,7 @@ void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
2895 else if (0 == strncmp(eeprom_data+20,"Picolo",7)) 2895 else if (0 == strncmp(eeprom_data+20,"Picolo",7))
2896 type = BTTV_BOARD_EURESYS_PICOLO; 2896 type = BTTV_BOARD_EURESYS_PICOLO;
2897 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0) 2897 else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
2898 type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */ 2898 type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */
2899 2899
2900 if (-1 != type) { 2900 if (-1 != type) {
2901 btv->c.type = type; 2901 btv->c.type = type;
@@ -2929,7 +2929,7 @@ static void flyvideo_gpio(struct bttv *btv)
2929 switch(ttype) { 2929 switch(ttype) {
2930 case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */ 2930 case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */
2931 break; 2931 break;
2932 case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */ 2932 case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */
2933 break; 2933 break;
2934 case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */ 2934 case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
2935 break; 2935 break;
@@ -2945,7 +2945,7 @@ static void flyvideo_gpio(struct bttv *btv)
2945 has_radio = gpio & 0x400000; 2945 has_radio = gpio & 0x400000;
2946 /* unknown 0x200000; 2946 /* unknown 0x200000;
2947 * unknown2 0x100000; */ 2947 * unknown2 0x100000; */
2948 is_capture_only = !(gpio & 0x008000); /* GPIO15 */ 2948 is_capture_only = !(gpio & 0x008000); /* GPIO15 */
2949 has_tda9820_tda9821 = !(gpio & 0x004000); 2949 has_tda9820_tda9821 = !(gpio & 0x004000);
2950 is_lr90 = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */ 2950 is_lr90 = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */
2951 /* 2951 /*
@@ -2982,7 +2982,7 @@ static void miro_pinnacle_gpio(struct bttv *btv)
2982 char *info; 2982 char *info;
2983 2983
2984 gpio_inout(0xffffff, 0); 2984 gpio_inout(0xffffff, 0);
2985 gpio = gpio_read(); 2985 gpio = gpio_read();
2986 id = ((gpio>>10) & 63) -1; 2986 id = ((gpio>>10) & 63) -1;
2987 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx"); 2987 msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx");
2988 if (id < 32) { 2988 if (id < 32) {
@@ -3093,7 +3093,7 @@ static void eagle_muxsel(struct bttv *btv, unsigned int input)
3093 3093
3094static void gvc1100_muxsel(struct bttv *btv, unsigned int input) 3094static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
3095{ 3095{
3096 static const int masks[] = {0x30, 0x01, 0x12, 0x23}; 3096 static const int masks[] = {0x30, 0x01, 0x12, 0x23};
3097 gpio_write(masks[input%4]); 3097 gpio_write(masks[input%4]);
3098} 3098}
3099 3099
@@ -3161,10 +3161,10 @@ void __devinit bttv_init_card1(struct bttv *btv)
3161 switch (btv->c.type) { 3161 switch (btv->c.type) {
3162 case BTTV_BOARD_HAUPPAUGE: 3162 case BTTV_BOARD_HAUPPAUGE:
3163 case BTTV_BOARD_HAUPPAUGE878: 3163 case BTTV_BOARD_HAUPPAUGE878:
3164 boot_msp34xx(btv,5); 3164 boot_msp34xx(btv,5);
3165 break; 3165 break;
3166 case BTTV_BOARD_VOODOOTV_FM: 3166 case BTTV_BOARD_VOODOOTV_FM:
3167 boot_msp34xx(btv,20); 3167 boot_msp34xx(btv,20);
3168 break; 3168 break;
3169 case BTTV_BOARD_AVERMEDIA98: 3169 case BTTV_BOARD_AVERMEDIA98:
3170 boot_msp34xx(btv,11); 3170 boot_msp34xx(btv,11);
@@ -3192,7 +3192,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
3192 int tda9887; 3192 int tda9887;
3193 int addr=ADDR_UNSET, radio_addr=ADDR_UNSET; 3193 int addr=ADDR_UNSET, radio_addr=ADDR_UNSET;
3194 3194
3195 btv->tuner_type = -1; 3195 btv->tuner_type = -1;
3196 3196
3197 if (BTTV_BOARD_UNKNOWN == btv->c.type) { 3197 if (BTTV_BOARD_UNKNOWN == btv->c.type) {
3198 bttv_readee(btv,eeprom_data,0xa0); 3198 bttv_readee(btv,eeprom_data,0xa0);
@@ -3225,7 +3225,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
3225 case BTTV_BOARD_HAUPPAUGEPVR: 3225 case BTTV_BOARD_HAUPPAUGEPVR:
3226 /* pick up some config infos from the eeprom */ 3226 /* pick up some config infos from the eeprom */
3227 bttv_readee(btv,eeprom_data,0xa0); 3227 bttv_readee(btv,eeprom_data,0xa0);
3228 hauppauge_eeprom(btv); 3228 hauppauge_eeprom(btv);
3229 break; 3229 break;
3230 case BTTV_BOARD_AVERMEDIA98: 3230 case BTTV_BOARD_AVERMEDIA98:
3231 case BTTV_BOARD_AVPHONE98: 3231 case BTTV_BOARD_AVPHONE98:
@@ -3258,7 +3258,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
3258 } 3258 }
3259 break; 3259 break;
3260 case BTTV_BOARD_STB2: 3260 case BTTV_BOARD_STB2:
3261 if (btv->cardid == 0x3060121a) { 3261 if (btv->cardid == 0x3060121a) {
3262 /* Fix up entry for 3DFX VoodooTV 100, 3262 /* Fix up entry for 3DFX VoodooTV 100,
3263 which is an OEM STB card variant. */ 3263 which is an OEM STB card variant. */
3264 btv->has_radio=0; 3264 btv->has_radio=0;
@@ -3277,7 +3277,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
3277 case BTTV_BOARD_OSPREY540: 3277 case BTTV_BOARD_OSPREY540:
3278 case BTTV_BOARD_OSPREY2000: 3278 case BTTV_BOARD_OSPREY2000:
3279 bttv_readee(btv,eeprom_data,0xa0); 3279 bttv_readee(btv,eeprom_data,0xa0);
3280 osprey_eeprom(btv); 3280 osprey_eeprom(btv);
3281 break; 3281 break;
3282 case BTTV_BOARD_IDS_EAGLE: 3282 case BTTV_BOARD_IDS_EAGLE:
3283 init_ids_eagle(btv); 3283 init_ids_eagle(btv);
@@ -3298,7 +3298,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
3298 } 3298 }
3299 3299
3300 /* pll configuration */ 3300 /* pll configuration */
3301 if (!(btv->id==848 && btv->revision==0x11)) { 3301 if (!(btv->id==848 && btv->revision==0x11)) {
3302 /* defaults from card list */ 3302 /* defaults from card list */
3303 if (PLL_28 == bttv_tvcards[btv->c.type].pll) { 3303 if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
3304 btv->pll.pll_ifreq=28636363; 3304 btv->pll.pll_ifreq=28636363;
@@ -3309,26 +3309,26 @@ void __devinit bttv_init_card2(struct bttv *btv)
3309 btv->pll.pll_crystal=BT848_IFORM_XT1; 3309 btv->pll.pll_crystal=BT848_IFORM_XT1;
3310 } 3310 }
3311 /* insmod options can override */ 3311 /* insmod options can override */
3312 switch (pll[btv->c.nr]) { 3312 switch (pll[btv->c.nr]) {
3313 case 0: /* none */ 3313 case 0: /* none */
3314 btv->pll.pll_crystal = 0; 3314 btv->pll.pll_crystal = 0;
3315 btv->pll.pll_ifreq = 0; 3315 btv->pll.pll_ifreq = 0;
3316 btv->pll.pll_ofreq = 0; 3316 btv->pll.pll_ofreq = 0;
3317 break; 3317 break;
3318 case 1: /* 28 MHz */ 3318 case 1: /* 28 MHz */
3319 case 28: 3319 case 28:
3320 btv->pll.pll_ifreq = 28636363; 3320 btv->pll.pll_ifreq = 28636363;
3321 btv->pll.pll_ofreq = 0; 3321 btv->pll.pll_ofreq = 0;
3322 btv->pll.pll_crystal = BT848_IFORM_XT0; 3322 btv->pll.pll_crystal = BT848_IFORM_XT0;
3323 break; 3323 break;
3324 case 2: /* 35 MHz */ 3324 case 2: /* 35 MHz */
3325 case 35: 3325 case 35:
3326 btv->pll.pll_ifreq = 35468950; 3326 btv->pll.pll_ifreq = 35468950;
3327 btv->pll.pll_ofreq = 0; 3327 btv->pll.pll_ofreq = 0;
3328 btv->pll.pll_crystal = BT848_IFORM_XT1; 3328 btv->pll.pll_crystal = BT848_IFORM_XT1;
3329 break; 3329 break;
3330 } 3330 }
3331 } 3331 }
3332 btv->pll.pll_current = -1; 3332 btv->pll.pll_current = -1;
3333 3333
3334 /* tuner configuration (from card list / autodetect / insmod option) */ 3334 /* tuner configuration (from card list / autodetect / insmod option) */
@@ -3340,7 +3340,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
3340 3340
3341 if (UNSET != bttv_tvcards[btv->c.type].tuner_type) 3341 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
3342 if(UNSET == btv->tuner_type) 3342 if(UNSET == btv->tuner_type)
3343 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; 3343 btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
3344 if (UNSET != tuner[btv->c.nr]) 3344 if (UNSET != tuner[btv->c.nr])
3345 btv->tuner_type = tuner[btv->c.nr]; 3345 btv->tuner_type = tuner[btv->c.nr];
3346 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); 3346 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
@@ -3348,14 +3348,14 @@ void __devinit bttv_init_card2(struct bttv *btv)
3348 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE, 3348 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
3349 &btv->pinnacle_id); 3349 &btv->pinnacle_id);
3350 if (btv->tuner_type != UNSET) { 3350 if (btv->tuner_type != UNSET) {
3351 struct tuner_setup tun_setup; 3351 struct tuner_setup tun_setup;
3352 3352
3353 tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; 3353 tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
3354 tun_setup.type = btv->tuner_type; 3354 tun_setup.type = btv->tuner_type;
3355 tun_setup.addr = addr; 3355 tun_setup.addr = addr;
3356 3356
3357 if (addr == radio_addr) 3357 if (addr == radio_addr)
3358 tun_setup.mode_mask = T_RADIO; 3358 tun_setup.mode_mask = T_RADIO;
3359 3359
3360 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); 3360 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
3361 } 3361 }
@@ -3433,11 +3433,11 @@ static void modtec_eeprom(struct bttv *btv)
3433 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) { 3433 } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
3434 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I; 3434 btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
3435 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n", 3435 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3436 btv->c.nr,&eeprom_data[0x1e]); 3436 btv->c.nr,&eeprom_data[0x1e]);
3437 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) { 3437 } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
3438 btv->tuner_type=TUNER_PHILIPS_NTSC; 3438 btv->tuner_type=TUNER_PHILIPS_NTSC;
3439 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n", 3439 printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3440 btv->c.nr,&eeprom_data[0x1e]); 3440 btv->c.nr,&eeprom_data[0x1e]);
3441 } else { 3441 } else {
3442 printk("bttv%d: Modtec: Unknown TunerString: %s\n", 3442 printk("bttv%d: Modtec: Unknown TunerString: %s\n",
3443 btv->c.nr,&eeprom_data[0x1e]); 3443 btv->c.nr,&eeprom_data[0x1e]);
@@ -3502,7 +3502,7 @@ static int terratec_active_radio_upgrade(struct bttv *btv)
3502static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen) 3502static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
3503{ 3503{
3504 u32 n; 3504 u32 n;
3505 u8 bits; 3505 u8 bits;
3506 int i; 3506 int i;
3507 3507
3508 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG); 3508 gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
@@ -3538,19 +3538,19 @@ static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
3538 3538
3539static int __devinit pvr_boot(struct bttv *btv) 3539static int __devinit pvr_boot(struct bttv *btv)
3540{ 3540{
3541 const struct firmware *fw_entry; 3541 const struct firmware *fw_entry;
3542 int rc; 3542 int rc;
3543 3543
3544 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev); 3544 rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
3545 if (rc != 0) { 3545 if (rc != 0) {
3546 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n", 3546 printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
3547 btv->c.nr); 3547 btv->c.nr);
3548 return rc; 3548 return rc;
3549 } 3549 }
3550 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size); 3550 rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
3551 printk(KERN_INFO "bttv%d: altera firmware upload %s\n", 3551 printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
3552 btv->c.nr, (rc < 0) ? "failed" : "ok"); 3552 btv->c.nr, (rc < 0) ? "failed" : "ok");
3553 release_firmware(fw_entry); 3553 release_firmware(fw_entry);
3554 return rc; 3554 return rc;
3555} 3555}
3556 3556
@@ -3564,33 +3564,33 @@ static void __devinit osprey_eeprom(struct bttv *btv)
3564 unsigned long serial = 0; 3564 unsigned long serial = 0;
3565 3565
3566 if (btv->c.type == 0) { 3566 if (btv->c.type == 0) {
3567 /* this might be an antique... check for MMAC label in eeprom */ 3567 /* this might be an antique... check for MMAC label in eeprom */
3568 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) { 3568 if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
3569 unsigned char checksum = 0; 3569 unsigned char checksum = 0;
3570 for (i =0; i<21; i++) 3570 for (i =0; i<21; i++)
3571 checksum += ee[i]; 3571 checksum += ee[i];
3572 if (checksum != ee[21]) 3572 if (checksum != ee[21])
3573 return; 3573 return;
3574 btv->c.type = BTTV_BOARD_OSPREY1x0_848; 3574 btv->c.type = BTTV_BOARD_OSPREY1x0_848;
3575 for (i = 12; i < 21; i++) 3575 for (i = 12; i < 21; i++)
3576 serial *= 10, serial += ee[i] - '0'; 3576 serial *= 10, serial += ee[i] - '0';
3577 } 3577 }
3578 } else { 3578 } else {
3579 unsigned short type; 3579 unsigned short type;
3580 int offset = 4*16; 3580 int offset = 4*16;
3581 3581
3582 for(; offset < 8*16; offset += 16) { 3582 for(; offset < 8*16; offset += 16) {
3583 unsigned short checksum = 0; 3583 unsigned short checksum = 0;
3584 /* verify the checksum */ 3584 /* verify the checksum */
3585 for(i = 0; i<14; i++) checksum += ee[i+offset]; 3585 for(i = 0; i<14; i++) checksum += ee[i+offset];
3586 checksum = ~checksum; /* no idea why */ 3586 checksum = ~checksum; /* no idea why */
3587 if ((((checksum>>8)&0x0FF) == ee[offset+14]) && 3587 if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
3588 ((checksum & 0x0FF) == ee[offset+15])) { 3588 ((checksum & 0x0FF) == ee[offset+15])) {
3589 break; 3589 break;
3590 } 3590 }
3591 } 3591 }
3592 3592
3593 if (offset >= 8*16) 3593 if (offset >= 8*16)
3594 return; 3594 return;
3595 3595
3596 /* found a valid descriptor */ 3596 /* found a valid descriptor */
@@ -3606,7 +3606,7 @@ static void __devinit osprey_eeprom(struct bttv *btv)
3606 btv->c.type = BTTV_BOARD_OSPREY101_848; 3606 btv->c.type = BTTV_BOARD_OSPREY101_848;
3607 break; 3607 break;
3608 3608
3609 /* 878 based */ 3609 /* 878 based */
3610 case 0x0012: 3610 case 0x0012:
3611 case 0x0013: 3611 case 0x0013:
3612 btv->c.type = BTTV_BOARD_OSPREY1x0; 3612 btv->c.type = BTTV_BOARD_OSPREY1x0;
@@ -3662,27 +3662,27 @@ static void __devinit osprey_eeprom(struct bttv *btv)
3662/* AVermedia specific stuff, from bktr_card.c */ 3662/* AVermedia specific stuff, from bktr_card.c */
3663 3663
3664static int tuner_0_table[] = { 3664static int tuner_0_table[] = {
3665 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/, 3665 TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/,
3666 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/, 3666 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/,
3667 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, 3667 TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL,
3668 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, 3668 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3669 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, 3669 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
3670 TUNER_PHILIPS_FM1216ME_MK3 }; 3670 TUNER_PHILIPS_FM1216ME_MK3 };
3671 3671
3672static int tuner_1_table[] = { 3672static int tuner_1_table[] = {
3673 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, 3673 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
3674 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, 3674 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3675 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, 3675 TUNER_TEMIC_PAL, TUNER_TEMIC_PAL,
3676 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ 3676 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */
3677 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; 3677 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3678 3678
3679static void __devinit avermedia_eeprom(struct bttv *btv) 3679static void __devinit avermedia_eeprom(struct bttv *btv)
3680{ 3680{
3681 int tuner_make,tuner_tv_fm,tuner_format,tuner=0; 3681 int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
3682 3682
3683 tuner_make = (eeprom_data[0x41] & 0x7); 3683 tuner_make = (eeprom_data[0x41] & 0x7);
3684 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3; 3684 tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3;
3685 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4; 3685 tuner_format = (eeprom_data[0x42] & 0xf0) >> 4;
3686 btv->has_remote = (eeprom_data[0x42] & 0x01); 3686 btv->has_remote = (eeprom_data[0x42] & 0x01);
3687 3687
3688 if (tuner_make == 0 || tuner_make == 2) 3688 if (tuner_make == 0 || tuner_make == 2)
@@ -3718,8 +3718,8 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm)
3718 dprintk("bttv_tda9880_setnorm to NTSC\n"); 3718 dprintk("bttv_tda9880_setnorm to NTSC\n");
3719 } 3719 }
3720 else { 3720 else {
3721 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; 3721 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff;
3722 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; 3722 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff;
3723 dprintk("bttv_tda9880_setnorm to PAL\n"); 3723 dprintk("bttv_tda9880_setnorm to PAL\n");
3724 } 3724 }
3725 /* set GPIO according */ 3725 /* set GPIO according */
@@ -3741,7 +3741,7 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3741 3741
3742 gpio_inout(mask,mask); 3742 gpio_inout(mask,mask);
3743 gpio_bits(mask,0); 3743 gpio_bits(mask,0);
3744 udelay(2500); 3744 udelay(2500);
3745 gpio_bits(mask,mask); 3745 gpio_bits(mask,mask);
3746 3746
3747 if (bttv_gpio) 3747 if (bttv_gpio)
@@ -3817,7 +3817,7 @@ static void __devinit init_PXC200(struct bttv *btv)
3817 udelay(10); 3817 udelay(10);
3818 gpio_write(1<<2); 3818 gpio_write(1<<2);
3819 3819
3820 for (i = 0; i < ARRAY_SIZE(vals); i++) { 3820 for (i = 0; i < ARRAY_SIZE(vals); i++) {
3821 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1); 3821 tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
3822 if (tmp != -1) { 3822 if (tmp != -1) {
3823 printk(KERN_INFO 3823 printk(KERN_INFO
@@ -4260,30 +4260,30 @@ avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
4260static void 4260static void
4261lt9415_audio(struct bttv *btv, struct video_audio *v, int set) 4261lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
4262{ 4262{
4263 int val = 0; 4263 int val = 0;
4264 4264
4265 if (gpio_read() & 0x4000) { 4265 if (gpio_read() & 0x4000) {
4266 v->mode = VIDEO_SOUND_MONO; 4266 v->mode = VIDEO_SOUND_MONO;
4267 return; 4267 return;
4268 } 4268 }
4269 4269
4270 if (set) { 4270 if (set) {
4271 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ 4271 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */
4272 val = 0x0080; 4272 val = 0x0080;
4273 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */ 4273 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
4274 val = 0x0880; 4274 val = 0x0880;
4275 if ((v->mode & VIDEO_SOUND_LANG1) || 4275 if ((v->mode & VIDEO_SOUND_LANG1) ||
4276 (v->mode & VIDEO_SOUND_MONO)) 4276 (v->mode & VIDEO_SOUND_MONO))
4277 val = 0; 4277 val = 0;
4278 gpio_bits(0x0880, val); 4278 gpio_bits(0x0880, val);
4279 if (bttv_gpio) 4279 if (bttv_gpio)
4280 bttv_gpio_tracking(btv,"lt9415"); 4280 bttv_gpio_tracking(btv,"lt9415");
4281 } else { 4281 } else {
4282 /* autodetect doesn't work with this card :-( */ 4282 /* autodetect doesn't work with this card :-( */
4283 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 4283 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
4284 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 4284 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4285 return; 4285 return;
4286 } 4286 }
4287} 4287}
4288 4288
4289/* TDA9821 on TerraTV+ Bt848, Bt878 */ 4289/* TDA9821 on TerraTV+ Bt848, Bt878 */
@@ -4406,26 +4406,26 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
4406static void 4406static void
4407windvr_audio(struct bttv *btv, struct video_audio *v, int set) 4407windvr_audio(struct bttv *btv, struct video_audio *v, int set)
4408{ 4408{
4409 unsigned long val = 0; 4409 unsigned long val = 0;
4410 4410
4411 if (set) { 4411 if (set) {
4412 if (v->mode & VIDEO_SOUND_MONO) 4412 if (v->mode & VIDEO_SOUND_MONO)
4413 val = 0x040000; 4413 val = 0x040000;
4414 if (v->mode & VIDEO_SOUND_LANG1) 4414 if (v->mode & VIDEO_SOUND_LANG1)
4415 val = 0; 4415 val = 0;
4416 if (v->mode & VIDEO_SOUND_LANG2) 4416 if (v->mode & VIDEO_SOUND_LANG2)
4417 val = 0x100000; 4417 val = 0x100000;
4418 if (v->mode & VIDEO_SOUND_STEREO) 4418 if (v->mode & VIDEO_SOUND_STEREO)
4419 val = 0; 4419 val = 0;
4420 if (val) { 4420 if (val) {
4421 gpio_bits(0x140000, val); 4421 gpio_bits(0x140000, val);
4422 if (bttv_gpio) 4422 if (bttv_gpio)
4423 bttv_gpio_tracking(btv,"windvr"); 4423 bttv_gpio_tracking(btv,"windvr");
4424 } 4424 }
4425 } else { 4425 } else {
4426 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 4426 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
4427 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 4427 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4428 } 4428 }
4429} 4429}
4430 4430
4431/* 4431/*
@@ -4668,10 +4668,10 @@ static void kodicom4400r_init(struct bttv *btv)
4668static void xguard_muxsel(struct bttv *btv, unsigned int input) 4668static void xguard_muxsel(struct bttv *btv, unsigned int input)
4669{ 4669{
4670 static const int masks[] = { 4670 static const int masks[] = {
4671 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10, 4671 ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
4672 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10, 4672 ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
4673 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11, 4673 ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
4674 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11, 4674 ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
4675 }; 4675 };
4676 gpio_write(masks[input%16]); 4676 gpio_write(masks[input%16]);
4677} 4677}
@@ -4776,10 +4776,10 @@ static void ivc120_muxsel(struct bttv *btv, unsigned int input)
4776 4776
4777static void PXC200_muxsel(struct bttv *btv, unsigned int input) 4777static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4778{ 4778{
4779 int rc; 4779 int rc;
4780 long mux; 4780 long mux;
4781 int bitmask; 4781 int bitmask;
4782 unsigned char buf[2]; 4782 unsigned char buf[2];
4783 4783
4784 /* Read PIC config to determine if this is a PXC200F */ 4784 /* Read PIC config to determine if this is a PXC200F */
4785 /* PX_I2C_CMD_CFG*/ 4785 /* PX_I2C_CMD_CFG*/
@@ -4809,14 +4809,14 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4809 /* bitmask=0x30f; */ 4809 /* bitmask=0x30f; */
4810 bitmask=0x302; 4810 bitmask=0x302;
4811 /* check whether we have a PXC200A */ 4811 /* check whether we have a PXC200A */
4812 if (btv->cardid == PX_PXC200A_CARDID) { 4812 if (btv->cardid == PX_PXC200A_CARDID) {
4813 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */ 4813 bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4814 bitmask |= 7<<4; /* the DAC */ 4814 bitmask |= 7<<4; /* the DAC */
4815 } 4815 }
4816 btwrite(bitmask, BT848_GPIO_OUT_EN); 4816 btwrite(bitmask, BT848_GPIO_OUT_EN);
4817 4817
4818 bitmask = btread(BT848_GPIO_DATA); 4818 bitmask = btread(BT848_GPIO_DATA);
4819 if (btv->cardid == PX_PXC200A_CARDID) 4819 if (btv->cardid == PX_PXC200A_CARDID)
4820 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7); 4820 bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4821 else /* older device */ 4821 else /* older device */
4822 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8); 4822 bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
@@ -4829,7 +4829,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4829 * 4829 *
4830 * needed because bttv-driver sets mux before calling this function 4830 * needed because bttv-driver sets mux before calling this function
4831 */ 4831 */
4832 if (btv->cardid == PX_PXC200A_CARDID) 4832 if (btv->cardid == PX_PXC200A_CARDID)
4833 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM); 4833 btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4834 else /* older device */ 4834 else /* older device */
4835 btand(~BT848_IFORM_MUXSEL,BT848_IFORM); 4835 btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
@@ -4875,7 +4875,7 @@ void __devinit bttv_check_chipset(void)
4875 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency); 4875 printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
4876 while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, 4876 while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL,
4877 PCI_DEVICE_ID_INTEL_82441, dev))) { 4877 PCI_DEVICE_ID_INTEL_82441, dev))) {
4878 unsigned char b; 4878 unsigned char b;
4879 pci_read_config_byte(dev, 0x53, &b); 4879 pci_read_config_byte(dev, 0x53, &b);
4880 if (bttv_debug) 4880 if (bttv_debug)
4881 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, " 4881 printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
@@ -4885,7 +4885,7 @@ void __devinit bttv_check_chipset(void)
4885 4885
4886int __devinit bttv_handle_chipset(struct bttv *btv) 4886int __devinit bttv_handle_chipset(struct bttv *btv)
4887{ 4887{
4888 unsigned char command; 4888 unsigned char command;
4889 4889
4890 if (!triton1 && !vsfx && UNSET == latency) 4890 if (!triton1 && !vsfx && UNSET == latency)
4891 return 0; 4891 return 0;
@@ -4906,13 +4906,13 @@ int __devinit bttv_handle_chipset(struct bttv *btv)
4906 btv->triton1 = BT848_INT_ETBF; 4906 btv->triton1 = BT848_INT_ETBF;
4907 } else { 4907 } else {
4908 /* bt878 has a bit in the pci config space for it */ 4908 /* bt878 has a bit in the pci config space for it */
4909 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command); 4909 pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4910 if (triton1) 4910 if (triton1)
4911 command |= BT878_EN_TBFX; 4911 command |= BT878_EN_TBFX;
4912 if (vsfx) 4912 if (vsfx)
4913 command |= BT878_EN_VSFX; 4913 command |= BT878_EN_VSFX;
4914 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command); 4914 pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4915 } 4915 }
4916 if (UNSET != latency) 4916 if (UNSET != latency)
4917 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency); 4917 pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
4918 return 0; 4918 return 0;