diff options
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-cards.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-cards.c | 399 |
1 files changed, 2 insertions, 397 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 6a2d37258820..78e5e29748ac 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "bttvp.h" | 39 | #include "bttvp.h" |
40 | #include <media/v4l2-common.h> | 40 | #include <media/v4l2-common.h> |
41 | #include <media/tvaudio.h> | 41 | #include <media/tvaudio.h> |
42 | #include "bttv-audio-hook.h" | ||
42 | 43 | ||
43 | /* fwd decl */ | 44 | /* fwd decl */ |
44 | static void boot_msp34xx(struct bttv *btv, int pin); | 45 | static void boot_msp34xx(struct bttv *btv, int pin); |
@@ -50,20 +51,6 @@ static void modtec_eeprom(struct bttv *btv); | |||
50 | static void init_PXC200(struct bttv *btv); | 51 | static void init_PXC200(struct bttv *btv); |
51 | static void init_RTV24(struct bttv *btv); | 52 | static void init_RTV24(struct bttv *btv); |
52 | 53 | ||
53 | static void winview_audio(struct bttv *btv, struct video_audio *v, int set); | ||
54 | static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); | ||
55 | static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, | ||
56 | int set); | ||
57 | static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, | ||
58 | int set); | ||
59 | static void terratv_audio(struct bttv *btv, struct video_audio *v, int set); | ||
60 | static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set); | ||
61 | static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set); | ||
62 | static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set); | ||
63 | static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set); | ||
64 | static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set); | ||
65 | static void windvr_audio(struct bttv *btv, struct video_audio *v, int set); | ||
66 | static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set); | ||
67 | static void rv605_muxsel(struct bttv *btv, unsigned int input); | 54 | static void rv605_muxsel(struct bttv *btv, unsigned int input); |
68 | static void eagle_muxsel(struct bttv *btv, unsigned int input); | 55 | static void eagle_muxsel(struct bttv *btv, unsigned int input); |
69 | static void xguard_muxsel(struct bttv *btv, unsigned int input); | 56 | static void xguard_muxsel(struct bttv *btv, unsigned int input); |
@@ -3954,7 +3941,7 @@ static void __devinit avermedia_eeprom(struct bttv *btv) | |||
3954 | void bttv_tda9880_setnorm(struct bttv *btv, int norm) | 3941 | void bttv_tda9880_setnorm(struct bttv *btv, int norm) |
3955 | { | 3942 | { |
3956 | /* fix up our card entry */ | 3943 | /* fix up our card entry */ |
3957 | if(norm==VIDEO_MODE_NTSC) { | 3944 | if(norm==V4L2_STD_NTSC) { |
3958 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; | 3945 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; |
3959 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; | 3946 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; |
3960 | bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; | 3947 | bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; |
@@ -4323,388 +4310,6 @@ void tea5757_set_freq(struct bttv *btv, unsigned short freq) | |||
4323 | tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ | 4310 | tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ |
4324 | } | 4311 | } |
4325 | 4312 | ||
4326 | |||
4327 | /* ----------------------------------------------------------------------- */ | ||
4328 | /* winview */ | ||
4329 | |||
4330 | static void winview_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4331 | { | ||
4332 | /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */ | ||
4333 | int bits_out, loops, vol, data; | ||
4334 | |||
4335 | if (!set) { | ||
4336 | /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */ | ||
4337 | v->flags |= VIDEO_AUDIO_VOLUME; | ||
4338 | return; | ||
4339 | } | ||
4340 | |||
4341 | /* 32 levels logarithmic */ | ||
4342 | vol = 32 - ((v->volume>>11)); | ||
4343 | /* units */ | ||
4344 | bits_out = (PT2254_DBS_IN_2>>(vol%5)); | ||
4345 | /* tens */ | ||
4346 | bits_out |= (PT2254_DBS_IN_10>>(vol/5)); | ||
4347 | bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL; | ||
4348 | data = gpio_read(); | ||
4349 | data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA| | ||
4350 | WINVIEW_PT2254_STROBE); | ||
4351 | for (loops = 17; loops >= 0 ; loops--) { | ||
4352 | if (bits_out & (1<<loops)) | ||
4353 | data |= WINVIEW_PT2254_DATA; | ||
4354 | else | ||
4355 | data &= ~WINVIEW_PT2254_DATA; | ||
4356 | gpio_write(data); | ||
4357 | udelay(5); | ||
4358 | data |= WINVIEW_PT2254_CLK; | ||
4359 | gpio_write(data); | ||
4360 | udelay(5); | ||
4361 | data &= ~WINVIEW_PT2254_CLK; | ||
4362 | gpio_write(data); | ||
4363 | } | ||
4364 | data |= WINVIEW_PT2254_STROBE; | ||
4365 | data &= ~WINVIEW_PT2254_DATA; | ||
4366 | gpio_write(data); | ||
4367 | udelay(10); | ||
4368 | data &= ~WINVIEW_PT2254_STROBE; | ||
4369 | gpio_write(data); | ||
4370 | } | ||
4371 | |||
4372 | /* ----------------------------------------------------------------------- */ | ||
4373 | /* mono/stereo control for various cards (which don't use i2c chips but */ | ||
4374 | /* connect something to the GPIO pins */ | ||
4375 | |||
4376 | static void | ||
4377 | gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4378 | { | ||
4379 | unsigned int con = 0; | ||
4380 | |||
4381 | if (set) { | ||
4382 | gpio_inout(0x300, 0x300); | ||
4383 | if (v->mode & VIDEO_SOUND_LANG1) | ||
4384 | con = 0x000; | ||
4385 | if (v->mode & VIDEO_SOUND_LANG2) | ||
4386 | con = 0x300; | ||
4387 | if (v->mode & VIDEO_SOUND_STEREO) | ||
4388 | con = 0x200; | ||
4389 | /* if (v->mode & VIDEO_SOUND_MONO) | ||
4390 | * con = 0x100; */ | ||
4391 | gpio_bits(0x300, con); | ||
4392 | } else { | ||
4393 | v->mode = VIDEO_SOUND_STEREO | | ||
4394 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4395 | } | ||
4396 | } | ||
4397 | |||
4398 | static void | ||
4399 | gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4400 | { | ||
4401 | unsigned int val, con; | ||
4402 | |||
4403 | if (btv->radio_user) | ||
4404 | return; | ||
4405 | |||
4406 | val = gpio_read(); | ||
4407 | if (set) { | ||
4408 | con = 0x000; | ||
4409 | if (v->mode & VIDEO_SOUND_LANG2) { | ||
4410 | if (v->mode & VIDEO_SOUND_LANG1) { | ||
4411 | /* LANG1 + LANG2 */ | ||
4412 | con = 0x100; | ||
4413 | } | ||
4414 | else { | ||
4415 | /* LANG2 */ | ||
4416 | con = 0x300; | ||
4417 | } | ||
4418 | } | ||
4419 | if (con != (val & 0x300)) { | ||
4420 | gpio_bits(0x300, con); | ||
4421 | if (bttv_gpio) | ||
4422 | bttv_gpio_tracking(btv,"gvbctv5pci"); | ||
4423 | } | ||
4424 | } else { | ||
4425 | switch (val & 0x70) { | ||
4426 | case 0x10: | ||
4427 | v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4428 | break; | ||
4429 | case 0x30: | ||
4430 | v->mode = VIDEO_SOUND_LANG2; | ||
4431 | break; | ||
4432 | case 0x50: | ||
4433 | v->mode = VIDEO_SOUND_LANG1; | ||
4434 | break; | ||
4435 | case 0x60: | ||
4436 | v->mode = VIDEO_SOUND_STEREO; | ||
4437 | break; | ||
4438 | case 0x70: | ||
4439 | v->mode = VIDEO_SOUND_MONO; | ||
4440 | break; | ||
4441 | default: | ||
4442 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4443 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4444 | } | ||
4445 | } | ||
4446 | } | ||
4447 | |||
4448 | /* | ||
4449 | * Mario Medina Nussbaum <medisoft@alohabbs.org.mx> | ||
4450 | * I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo, | ||
4451 | * 0xdde enables mono and 0xccd enables sap | ||
4452 | * | ||
4453 | * Petr Vandrovec <VANDROVE@vc.cvut.cz> | ||
4454 | * P.S.: At least mask in line above is wrong - GPIO pins 3,2 select | ||
4455 | * input/output sound connection, so both must be set for output mode. | ||
4456 | * | ||
4457 | * Looks like it's needed only for the "tvphone", the "tvphone 98" | ||
4458 | * handles this with a tda9840 | ||
4459 | * | ||
4460 | */ | ||
4461 | static void | ||
4462 | avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4463 | { | ||
4464 | int val = 0; | ||
4465 | |||
4466 | if (set) { | ||
4467 | if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ | ||
4468 | val = 0x02; | ||
4469 | if (v->mode & VIDEO_SOUND_STEREO) | ||
4470 | val = 0x01; | ||
4471 | if (val) { | ||
4472 | gpio_bits(0x03,val); | ||
4473 | if (bttv_gpio) | ||
4474 | bttv_gpio_tracking(btv,"avermedia"); | ||
4475 | } | ||
4476 | } else { | ||
4477 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4478 | VIDEO_SOUND_LANG1; | ||
4479 | return; | ||
4480 | } | ||
4481 | } | ||
4482 | |||
4483 | static void | ||
4484 | avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4485 | { | ||
4486 | int val = 0; | ||
4487 | |||
4488 | if (set) { | ||
4489 | if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ | ||
4490 | val = 0x01; | ||
4491 | if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */ | ||
4492 | val = 0x02; | ||
4493 | btaor(val, ~0x03, BT848_GPIO_DATA); | ||
4494 | if (bttv_gpio) | ||
4495 | bttv_gpio_tracking(btv,"avermedia"); | ||
4496 | } else { | ||
4497 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4498 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4499 | return; | ||
4500 | } | ||
4501 | } | ||
4502 | |||
4503 | /* Lifetec 9415 handling */ | ||
4504 | static void | ||
4505 | lt9415_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4506 | { | ||
4507 | int val = 0; | ||
4508 | |||
4509 | if (gpio_read() & 0x4000) { | ||
4510 | v->mode = VIDEO_SOUND_MONO; | ||
4511 | return; | ||
4512 | } | ||
4513 | |||
4514 | if (set) { | ||
4515 | if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ | ||
4516 | val = 0x0080; | ||
4517 | if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */ | ||
4518 | val = 0x0880; | ||
4519 | if ((v->mode & VIDEO_SOUND_LANG1) || | ||
4520 | (v->mode & VIDEO_SOUND_MONO)) | ||
4521 | val = 0; | ||
4522 | gpio_bits(0x0880, val); | ||
4523 | if (bttv_gpio) | ||
4524 | bttv_gpio_tracking(btv,"lt9415"); | ||
4525 | } else { | ||
4526 | /* autodetect doesn't work with this card :-( */ | ||
4527 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4528 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4529 | return; | ||
4530 | } | ||
4531 | } | ||
4532 | |||
4533 | /* TDA9821 on TerraTV+ Bt848, Bt878 */ | ||
4534 | static void | ||
4535 | terratv_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4536 | { | ||
4537 | unsigned int con = 0; | ||
4538 | |||
4539 | if (set) { | ||
4540 | gpio_inout(0x180000,0x180000); | ||
4541 | if (v->mode & VIDEO_SOUND_LANG2) | ||
4542 | con = 0x080000; | ||
4543 | if (v->mode & VIDEO_SOUND_STEREO) | ||
4544 | con = 0x180000; | ||
4545 | gpio_bits(0x180000, con); | ||
4546 | if (bttv_gpio) | ||
4547 | bttv_gpio_tracking(btv,"terratv"); | ||
4548 | } else { | ||
4549 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4550 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4551 | } | ||
4552 | } | ||
4553 | |||
4554 | static void | ||
4555 | winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4556 | { | ||
4557 | unsigned long val = 0; | ||
4558 | |||
4559 | if (set) { | ||
4560 | /*btor (0xc32000, BT848_GPIO_OUT_EN);*/ | ||
4561 | if (v->mode & VIDEO_SOUND_MONO) /* Mono */ | ||
4562 | val = 0x420000; | ||
4563 | if (v->mode & VIDEO_SOUND_LANG1) /* Mono */ | ||
4564 | val = 0x420000; | ||
4565 | if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ | ||
4566 | val = 0x410000; | ||
4567 | if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */ | ||
4568 | val = 0x020000; | ||
4569 | if (val) { | ||
4570 | gpio_bits(0x430000, val); | ||
4571 | if (bttv_gpio) | ||
4572 | bttv_gpio_tracking(btv,"winfast2000"); | ||
4573 | } | ||
4574 | } else { | ||
4575 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4576 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4577 | } | ||
4578 | } | ||
4579 | |||
4580 | /* | ||
4581 | * Dariusz Kowalewski <darekk@automex.pl> | ||
4582 | * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM | ||
4583 | * revision 9B has on-board TDA9874A sound decoder). | ||
4584 | * | ||
4585 | * Note: There are card variants without tda9874a. Forcing the "stereo sound route" | ||
4586 | * will mute this cards. | ||
4587 | */ | ||
4588 | static void | ||
4589 | pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4590 | { | ||
4591 | unsigned int val = 0; | ||
4592 | |||
4593 | if (btv->radio_user) | ||
4594 | return; | ||
4595 | |||
4596 | if (set) { | ||
4597 | if (v->mode & VIDEO_SOUND_MONO) { | ||
4598 | val = 0x01; | ||
4599 | } | ||
4600 | if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) | ||
4601 | || (v->mode & VIDEO_SOUND_STEREO)) { | ||
4602 | val = 0x02; | ||
4603 | } | ||
4604 | if (val) { | ||
4605 | gpio_bits(0x03,val); | ||
4606 | if (bttv_gpio) | ||
4607 | bttv_gpio_tracking(btv,"pvbt878p9b"); | ||
4608 | } | ||
4609 | } else { | ||
4610 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4611 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4612 | } | ||
4613 | } | ||
4614 | |||
4615 | /* | ||
4616 | * Dariusz Kowalewski <darekk@automex.pl> | ||
4617 | * sound control for FlyVideo 2000S (with tda9874 decoder) | ||
4618 | * based on pvbt878p9b_audio() - this is not tested, please fix!!! | ||
4619 | */ | ||
4620 | static void | ||
4621 | fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4622 | { | ||
4623 | unsigned int val = 0xffff; | ||
4624 | |||
4625 | if (btv->radio_user) | ||
4626 | return; | ||
4627 | |||
4628 | if (set) { | ||
4629 | if (v->mode & VIDEO_SOUND_MONO) { | ||
4630 | val = 0x0000; | ||
4631 | } | ||
4632 | if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) | ||
4633 | || (v->mode & VIDEO_SOUND_STEREO)) { | ||
4634 | val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */ | ||
4635 | } | ||
4636 | if (val != 0xffff) { | ||
4637 | gpio_bits(0x1800, val); | ||
4638 | if (bttv_gpio) | ||
4639 | bttv_gpio_tracking(btv,"fv2000s"); | ||
4640 | } | ||
4641 | } else { | ||
4642 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4643 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4644 | } | ||
4645 | } | ||
4646 | |||
4647 | /* | ||
4648 | * sound control for Canopus WinDVR PCI | ||
4649 | * Masaki Suzuki <masaki@btree.org> | ||
4650 | */ | ||
4651 | static void | ||
4652 | windvr_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4653 | { | ||
4654 | unsigned long val = 0; | ||
4655 | |||
4656 | if (set) { | ||
4657 | if (v->mode & VIDEO_SOUND_MONO) | ||
4658 | val = 0x040000; | ||
4659 | if (v->mode & VIDEO_SOUND_LANG1) | ||
4660 | val = 0; | ||
4661 | if (v->mode & VIDEO_SOUND_LANG2) | ||
4662 | val = 0x100000; | ||
4663 | if (v->mode & VIDEO_SOUND_STEREO) | ||
4664 | val = 0; | ||
4665 | if (val) { | ||
4666 | gpio_bits(0x140000, val); | ||
4667 | if (bttv_gpio) | ||
4668 | bttv_gpio_tracking(btv,"windvr"); | ||
4669 | } | ||
4670 | } else { | ||
4671 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4672 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4673 | } | ||
4674 | } | ||
4675 | |||
4676 | /* | ||
4677 | * sound control for AD-TVK503 | ||
4678 | * Hiroshi Takekawa <sian@big.or.jp> | ||
4679 | */ | ||
4680 | static void | ||
4681 | adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) | ||
4682 | { | ||
4683 | unsigned int con = 0xffffff; | ||
4684 | |||
4685 | /* btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN); */ | ||
4686 | |||
4687 | if (set) { | ||
4688 | /* btor(***, BT848_GPIO_OUT_EN); */ | ||
4689 | if (v->mode & VIDEO_SOUND_LANG1) | ||
4690 | con = 0x00000000; | ||
4691 | if (v->mode & VIDEO_SOUND_LANG2) | ||
4692 | con = 0x00180000; | ||
4693 | if (v->mode & VIDEO_SOUND_STEREO) | ||
4694 | con = 0x00000000; | ||
4695 | if (v->mode & VIDEO_SOUND_MONO) | ||
4696 | con = 0x00060000; | ||
4697 | if (con != 0xffffff) { | ||
4698 | gpio_bits(0x1e0000,con); | ||
4699 | if (bttv_gpio) | ||
4700 | bttv_gpio_tracking(btv, "adtvk503"); | ||
4701 | } | ||
4702 | } else { | ||
4703 | v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | | ||
4704 | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
4705 | } | ||
4706 | } | ||
4707 | |||
4708 | /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas] | 4313 | /* RemoteVision MX (rv605) muxsel helper [Miguel Freitas] |
4709 | * | 4314 | * |
4710 | * This is needed because rv605 don't use a normal multiplex, but a crosspoint | 4315 | * This is needed because rv605 don't use a normal multiplex, but a crosspoint |