aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r--drivers/media/video/saa7134/Kconfig1
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c12
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c507
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c52
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c434
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c10
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c19
-rw-r--r--drivers/media/video/saa7134/saa7134-reg.h3
-rw-r--r--drivers/media/video/saa7134/saa7134-ts.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c21
-rw-r--r--drivers/media/video/saa7134/saa7134-vbi.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c17
-rw-r--r--drivers/media/video/saa7134/saa7134.h22
14 files changed, 886 insertions, 222 deletions
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index 96bc3b1298a2..e086f14d5663 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -37,6 +37,7 @@ config VIDEO_SAA7134_DVB
37 select DVB_TDA826X if !DVB_FE_CUSTOMISE 37 select DVB_TDA826X if !DVB_FE_CUSTOMISE
38 select DVB_TDA827X if !DVB_FE_CUSTOMISE 38 select DVB_TDA827X if !DVB_FE_CUSTOMISE
39 select DVB_ISL6421 if !DVB_FE_CUSTOMISE 39 select DVB_ISL6421 if !DVB_FE_CUSTOMISE
40 select TUNER_SIMPLE if !DVB_FE_CUSTOMISE
40 ---help--- 41 ---help---
41 This adds support for DVB cards based on the 42 This adds support for DVB cards based on the
42 Philips saa7134 chip. 43 Philips saa7134 chip.
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index ec6bdb9680a3..ba3082422a01 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -31,7 +31,7 @@
31#include "saa7134.h" 31#include "saa7134.h"
32#include "saa7134-reg.h" 32#include "saa7134-reg.h"
33 33
34static unsigned int debug = 0; 34static unsigned int debug;
35module_param(debug, int, 0644); 35module_param(debug, int, 0644);
36MODULE_PARM_DESC(debug,"enable debug messages [alsa]"); 36MODULE_PARM_DESC(debug,"enable debug messages [alsa]");
37 37
@@ -503,7 +503,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
503 /* release the old buffer */ 503 /* release the old buffer */
504 if (substream->runtime->dma_area) { 504 if (substream->runtime->dma_area) {
505 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); 505 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
506 videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); 506 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
507 dsp_buffer_free(dev); 507 dsp_buffer_free(dev);
508 substream->runtime->dma_area = NULL; 508 substream->runtime->dma_area = NULL;
509 } 509 }
@@ -519,12 +519,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
519 return err; 519 return err;
520 } 520 }
521 521
522 if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) { 522 if (0 != (err = videobuf_sg_dma_map(&dev->pci->dev, &dev->dmasound.dma))) {
523 dsp_buffer_free(dev); 523 dsp_buffer_free(dev);
524 return err; 524 return err;
525 } 525 }
526 if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { 526 if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) {
527 videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); 527 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
528 dsp_buffer_free(dev); 528 dsp_buffer_free(dev);
529 return err; 529 return err;
530 } 530 }
@@ -533,7 +533,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
533 dev->dmasound.dma.sglen, 533 dev->dmasound.dma.sglen,
534 0))) { 534 0))) {
535 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); 535 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
536 videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); 536 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
537 dsp_buffer_free(dev); 537 dsp_buffer_free(dev);
538 return err; 538 return err;
539 } 539 }
@@ -569,7 +569,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream)
569 569
570 if (substream->runtime->dma_area) { 570 if (substream->runtime->dma_area) {
571 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); 571 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
572 videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); 572 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
573 dsp_buffer_free(dev); 573 dsp_buffer_free(dev);
574 substream->runtime->dma_area = NULL; 574 substream->runtime->dma_area = NULL;
575 } 575 }
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 6f5744286e8c..98375955a84b 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -22,11 +22,15 @@
22 22
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/i2c.h>
26#include <linux/i2c-algo-bit.h>
25 27
26#include "saa7134-reg.h" 28#include "saa7134-reg.h"
27#include "saa7134.h" 29#include "saa7134.h"
30#include "tuner-xc2028.h"
28#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
29#include <media/tveeprom.h> 32#include <media/tveeprom.h>
33#include "tea5767.h"
30 34
31/* commly used strings */ 35/* commly used strings */
32static char name_mute[] = "mute"; 36static char name_mute[] = "mute";
@@ -1046,7 +1050,7 @@ struct saa7134_board saa7134_boards[] = {
1046 }, 1050 },
1047 [SAA7134_BOARD_MANLI_MTV002] = { 1051 [SAA7134_BOARD_MANLI_MTV002] = {
1048 /* Ognjen Nastic <ognjen@logosoft.ba> */ 1052 /* Ognjen Nastic <ognjen@logosoft.ba> */
1049 .name = "Manli MuchTV M-TV002/Behold TV 403 FM", 1053 .name = "Manli MuchTV M-TV002",
1050 .audio_clock = 0x00200000, 1054 .audio_clock = 0x00200000,
1051 .tuner_type = TUNER_PHILIPS_PAL, 1055 .tuner_type = TUNER_PHILIPS_PAL,
1052 .radio_type = UNSET, 1056 .radio_type = UNSET,
@@ -1073,7 +1077,7 @@ struct saa7134_board saa7134_boards[] = {
1073 }, 1077 },
1074 [SAA7134_BOARD_MANLI_MTV001] = { 1078 [SAA7134_BOARD_MANLI_MTV001] = {
1075 /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */ 1079 /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */
1076 .name = "Manli MuchTV M-TV001/Behold TV 401", 1080 .name = "Manli MuchTV M-TV001",
1077 .audio_clock = 0x00200000, 1081 .audio_clock = 0x00200000,
1078 .tuner_type = TUNER_PHILIPS_PAL, 1082 .tuner_type = TUNER_PHILIPS_PAL,
1079 .radio_type = UNSET, 1083 .radio_type = UNSET,
@@ -2195,6 +2199,8 @@ struct saa7134_board saa7134_boards[] = {
2195 }, 2199 },
2196 [SAA7134_BOARD_BEHOLD_409FM] = { 2200 [SAA7134_BOARD_BEHOLD_409FM] = {
2197 /* <http://tuner.beholder.ru>, Sergey <skiv@orel.ru> */ 2201 /* <http://tuner.beholder.ru>, Sergey <skiv@orel.ru> */
2202 /* Beholder Intl. Ltd. 2008 */
2203 /*Dmitry Belimov <d.belimov@gmail.com> */
2198 .name = "Beholder BeholdTV 409 FM", 2204 .name = "Beholder BeholdTV 409 FM",
2199 .audio_clock = 0x00187de7, 2205 .audio_clock = 0x00187de7,
2200 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 2206 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -2202,6 +2208,7 @@ struct saa7134_board saa7134_boards[] = {
2202 .tuner_addr = ADDR_UNSET, 2208 .tuner_addr = ADDR_UNSET,
2203 .radio_addr = ADDR_UNSET, 2209 .radio_addr = ADDR_UNSET,
2204 .tda9887_conf = TDA9887_PRESENT, 2210 .tda9887_conf = TDA9887_PRESENT,
2211 .gpiomask = 0x00008000,
2205 .inputs = {{ 2212 .inputs = {{
2206 .name = name_tv, 2213 .name = name_tv,
2207 .vmux = 3, 2214 .vmux = 3,
@@ -2908,15 +2915,13 @@ struct saa7134_board saa7134_boards[] = {
2908 }}, 2915 }},
2909 }, 2916 },
2910 [SAA7134_BOARD_MD7134_BRIDGE_2] = { 2917 [SAA7134_BOARD_MD7134_BRIDGE_2] = {
2911 /* This card has two saa7134 chips on it, 2918 /* The second saa7134 on this card only serves as DVB-S host bridge */
2912 but only one of them is currently working.
2913 The programming for the primary decoder is
2914 in SAA7134_BOARD_MD7134 */
2915 .name = "Medion 7134 Bridge #2", 2919 .name = "Medion 7134 Bridge #2",
2916 .audio_clock = 0x00187de7, 2920 .audio_clock = 0x00187de7,
2917 .radio_type = UNSET, 2921 .radio_type = UNSET,
2918 .tuner_addr = ADDR_UNSET, 2922 .tuner_addr = ADDR_UNSET,
2919 .radio_addr = ADDR_UNSET, 2923 .radio_addr = ADDR_UNSET,
2924 .mpeg = SAA7134_MPEG_DVB,
2920 }, 2925 },
2921 [SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS] = { 2926 [SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS] = {
2922 .name = "LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB", 2927 .name = "LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB",
@@ -3330,7 +3335,7 @@ struct saa7134_board saa7134_boards[] = {
3330 /* Juan Pablo Sormani <sorman@gmail.com> */ 3335 /* Juan Pablo Sormani <sorman@gmail.com> */
3331 .name = "Encore ENLTV-FM", 3336 .name = "Encore ENLTV-FM",
3332 .audio_clock = 0x00200000, 3337 .audio_clock = 0x00200000,
3333 .tuner_type = TUNER_PHILIPS_ATSC, 3338 .tuner_type = TUNER_PHILIPS_FCV1236D,
3334 .radio_type = UNSET, 3339 .radio_type = UNSET,
3335 .tuner_addr = ADDR_UNSET, 3340 .tuner_addr = ADDR_UNSET,
3336 .radio_addr = ADDR_UNSET, 3341 .radio_addr = ADDR_UNSET,
@@ -3575,12 +3580,15 @@ struct saa7134_board saa7134_boards[] = {
3575 }}, 3580 }},
3576 }, 3581 },
3577 [SAA7134_BOARD_BEHOLD_401] = { 3582 [SAA7134_BOARD_BEHOLD_401] = {
3583 /* Beholder Intl. Ltd. 2008 */
3584 /*Dmitry Belimov <d.belimov@gmail.com> */
3578 .name = "Beholder BeholdTV 401", 3585 .name = "Beholder BeholdTV 401",
3579 .audio_clock = 0x00187de7, 3586 .audio_clock = 0x00187de7,
3580 .tuner_type = TUNER_PHILIPS_FQ1216ME, 3587 .tuner_type = TUNER_PHILIPS_FQ1216ME,
3581 .radio_type = UNSET, 3588 .radio_type = UNSET,
3582 .tuner_addr = ADDR_UNSET, 3589 .tuner_addr = ADDR_UNSET,
3583 .radio_addr = ADDR_UNSET, 3590 .radio_addr = ADDR_UNSET,
3591 .gpiomask = 0x00008000,
3584 .inputs = {{ 3592 .inputs = {{
3585 .name = name_svideo, 3593 .name = name_svideo,
3586 .vmux = 8, 3594 .vmux = 8,
@@ -3601,12 +3609,15 @@ struct saa7134_board saa7134_boards[] = {
3601 }, 3609 },
3602 }, 3610 },
3603 [SAA7134_BOARD_BEHOLD_403] = { 3611 [SAA7134_BOARD_BEHOLD_403] = {
3612 /* Beholder Intl. Ltd. 2008 */
3613 /*Dmitry Belimov <d.belimov@gmail.com> */
3604 .name = "Beholder BeholdTV 403", 3614 .name = "Beholder BeholdTV 403",
3605 .audio_clock = 0x00187de7, 3615 .audio_clock = 0x00187de7,
3606 .tuner_type = TUNER_PHILIPS_FQ1216ME, 3616 .tuner_type = TUNER_PHILIPS_FQ1216ME,
3607 .radio_type = UNSET, 3617 .radio_type = UNSET,
3608 .tuner_addr = ADDR_UNSET, 3618 .tuner_addr = ADDR_UNSET,
3609 .radio_addr = ADDR_UNSET, 3619 .radio_addr = ADDR_UNSET,
3620 .gpiomask = 0x00008000,
3610 .inputs = {{ 3621 .inputs = {{
3611 .name = name_svideo, 3622 .name = name_svideo,
3612 .vmux = 8, 3623 .vmux = 8,
@@ -3623,12 +3634,15 @@ struct saa7134_board saa7134_boards[] = {
3623 }}, 3634 }},
3624 }, 3635 },
3625 [SAA7134_BOARD_BEHOLD_403FM] = { 3636 [SAA7134_BOARD_BEHOLD_403FM] = {
3637 /* Beholder Intl. Ltd. 2008 */
3638 /*Dmitry Belimov <d.belimov@gmail.com> */
3626 .name = "Beholder BeholdTV 403 FM", 3639 .name = "Beholder BeholdTV 403 FM",
3627 .audio_clock = 0x00187de7, 3640 .audio_clock = 0x00187de7,
3628 .tuner_type = TUNER_PHILIPS_FQ1216ME, 3641 .tuner_type = TUNER_PHILIPS_FQ1216ME,
3629 .radio_type = UNSET, 3642 .radio_type = UNSET,
3630 .tuner_addr = ADDR_UNSET, 3643 .tuner_addr = ADDR_UNSET,
3631 .radio_addr = ADDR_UNSET, 3644 .radio_addr = ADDR_UNSET,
3645 .gpiomask = 0x00008000,
3632 .inputs = {{ 3646 .inputs = {{
3633 .name = name_svideo, 3647 .name = name_svideo,
3634 .vmux = 8, 3648 .vmux = 8,
@@ -3649,6 +3663,8 @@ struct saa7134_board saa7134_boards[] = {
3649 }, 3663 },
3650 }, 3664 },
3651 [SAA7134_BOARD_BEHOLD_405] = { 3665 [SAA7134_BOARD_BEHOLD_405] = {
3666 /* Beholder Intl. Ltd. 2008 */
3667 /*Dmitry Belimov <d.belimov@gmail.com> */
3652 .name = "Beholder BeholdTV 405", 3668 .name = "Beholder BeholdTV 405",
3653 .audio_clock = 0x00187de7, 3669 .audio_clock = 0x00187de7,
3654 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3670 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3656,6 +3672,7 @@ struct saa7134_board saa7134_boards[] = {
3656 .tuner_addr = ADDR_UNSET, 3672 .tuner_addr = ADDR_UNSET,
3657 .radio_addr = ADDR_UNSET, 3673 .radio_addr = ADDR_UNSET,
3658 .tda9887_conf = TDA9887_PRESENT, 3674 .tda9887_conf = TDA9887_PRESENT,
3675 .gpiomask = 0x00008000,
3659 .inputs = {{ 3676 .inputs = {{
3660 .name = name_svideo, 3677 .name = name_svideo,
3661 .vmux = 8, 3678 .vmux = 8,
@@ -3673,6 +3690,8 @@ struct saa7134_board saa7134_boards[] = {
3673 }, 3690 },
3674 [SAA7134_BOARD_BEHOLD_405FM] = { 3691 [SAA7134_BOARD_BEHOLD_405FM] = {
3675 /* Sergey <skiv@orel.ru> */ 3692 /* Sergey <skiv@orel.ru> */
3693 /* Beholder Intl. Ltd. 2008 */
3694 /*Dmitry Belimov <d.belimov@gmail.com> */
3676 .name = "Beholder BeholdTV 405 FM", 3695 .name = "Beholder BeholdTV 405 FM",
3677 .audio_clock = 0x00187de7, 3696 .audio_clock = 0x00187de7,
3678 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3697 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3680,6 +3699,7 @@ struct saa7134_board saa7134_boards[] = {
3680 .tuner_addr = ADDR_UNSET, 3699 .tuner_addr = ADDR_UNSET,
3681 .radio_addr = ADDR_UNSET, 3700 .radio_addr = ADDR_UNSET,
3682 .tda9887_conf = TDA9887_PRESENT, 3701 .tda9887_conf = TDA9887_PRESENT,
3702 .gpiomask = 0x00008000,
3683 .inputs = {{ 3703 .inputs = {{
3684 .name = name_svideo, 3704 .name = name_svideo,
3685 .vmux = 8, 3705 .vmux = 8,
@@ -3700,6 +3720,8 @@ struct saa7134_board saa7134_boards[] = {
3700 }, 3720 },
3701 }, 3721 },
3702 [SAA7134_BOARD_BEHOLD_407] = { 3722 [SAA7134_BOARD_BEHOLD_407] = {
3723 /* Beholder Intl. Ltd. 2008 */
3724 /*Dmitry Belimov <d.belimov@gmail.com> */
3703 .name = "Beholder BeholdTV 407", 3725 .name = "Beholder BeholdTV 407",
3704 .audio_clock = 0x00187de7, 3726 .audio_clock = 0x00187de7,
3705 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3727 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3707,7 +3729,7 @@ struct saa7134_board saa7134_boards[] = {
3707 .tuner_addr = ADDR_UNSET, 3729 .tuner_addr = ADDR_UNSET,
3708 .radio_addr = ADDR_UNSET, 3730 .radio_addr = ADDR_UNSET,
3709 .tda9887_conf = TDA9887_PRESENT, 3731 .tda9887_conf = TDA9887_PRESENT,
3710 .gpiomask = 0xc0c000, 3732 .gpiomask = 0x00008000,
3711 .inputs = {{ 3733 .inputs = {{
3712 .name = name_svideo, 3734 .name = name_svideo,
3713 .vmux = 8, 3735 .vmux = 8,
@@ -3727,6 +3749,8 @@ struct saa7134_board saa7134_boards[] = {
3727 }}, 3749 }},
3728 }, 3750 },
3729 [SAA7134_BOARD_BEHOLD_407FM] = { 3751 [SAA7134_BOARD_BEHOLD_407FM] = {
3752 /* Beholder Intl. Ltd. 2008 */
3753 /*Dmitry Belimov <d.belimov@gmail.com> */
3730 .name = "Beholder BeholdTV 407 FM", 3754 .name = "Beholder BeholdTV 407 FM",
3731 .audio_clock = 0x00187de7, 3755 .audio_clock = 0x00187de7,
3732 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3756 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3734,7 +3758,7 @@ struct saa7134_board saa7134_boards[] = {
3734 .tuner_addr = ADDR_UNSET, 3758 .tuner_addr = ADDR_UNSET,
3735 .radio_addr = ADDR_UNSET, 3759 .radio_addr = ADDR_UNSET,
3736 .tda9887_conf = TDA9887_PRESENT, 3760 .tda9887_conf = TDA9887_PRESENT,
3737 .gpiomask = 0xc0c000, 3761 .gpiomask = 0x00008000,
3738 .inputs = {{ 3762 .inputs = {{
3739 .name = name_svideo, 3763 .name = name_svideo,
3740 .vmux = 8, 3764 .vmux = 8,
@@ -3759,6 +3783,8 @@ struct saa7134_board saa7134_boards[] = {
3759 }, 3783 },
3760 }, 3784 },
3761 [SAA7134_BOARD_BEHOLD_409] = { 3785 [SAA7134_BOARD_BEHOLD_409] = {
3786 /* Beholder Intl. Ltd. 2008 */
3787 /*Dmitry Belimov <d.belimov@gmail.com> */
3762 .name = "Beholder BeholdTV 409", 3788 .name = "Beholder BeholdTV 409",
3763 .audio_clock = 0x00187de7, 3789 .audio_clock = 0x00187de7,
3764 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3790 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3766,6 +3792,7 @@ struct saa7134_board saa7134_boards[] = {
3766 .tuner_addr = ADDR_UNSET, 3792 .tuner_addr = ADDR_UNSET,
3767 .radio_addr = ADDR_UNSET, 3793 .radio_addr = ADDR_UNSET,
3768 .tda9887_conf = TDA9887_PRESENT, 3794 .tda9887_conf = TDA9887_PRESENT,
3795 .gpiomask = 0x00008000,
3769 .inputs = {{ 3796 .inputs = {{
3770 .name = name_tv, 3797 .name = name_tv,
3771 .vmux = 3, 3798 .vmux = 3,
@@ -3782,6 +3809,8 @@ struct saa7134_board saa7134_boards[] = {
3782 }}, 3809 }},
3783 }, 3810 },
3784 [SAA7134_BOARD_BEHOLD_505FM] = { 3811 [SAA7134_BOARD_BEHOLD_505FM] = {
3812 /* Beholder Intl. Ltd. 2008 */
3813 /*Dmitry Belimov <d.belimov@gmail.com> */
3785 .name = "Beholder BeholdTV 505 FM/RDS", 3814 .name = "Beholder BeholdTV 505 FM/RDS",
3786 .audio_clock = 0x00200000, 3815 .audio_clock = 0x00200000,
3787 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3816 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3789,6 +3818,7 @@ struct saa7134_board saa7134_boards[] = {
3789 .tuner_addr = ADDR_UNSET, 3818 .tuner_addr = ADDR_UNSET,
3790 .radio_addr = ADDR_UNSET, 3819 .radio_addr = ADDR_UNSET,
3791 .tda9887_conf = TDA9887_PRESENT, 3820 .tda9887_conf = TDA9887_PRESENT,
3821 .gpiomask = 0x00008000,
3792 .inputs = {{ 3822 .inputs = {{
3793 .name = name_tv, 3823 .name = name_tv,
3794 .vmux = 3, 3824 .vmux = 3,
@@ -3813,6 +3843,8 @@ struct saa7134_board saa7134_boards[] = {
3813 }, 3843 },
3814 }, 3844 },
3815 [SAA7134_BOARD_BEHOLD_507_9FM] = { 3845 [SAA7134_BOARD_BEHOLD_507_9FM] = {
3846 /* Beholder Intl. Ltd. 2008 */
3847 /*Dmitry Belimov <d.belimov@gmail.com> */
3816 .name = "Beholder BeholdTV 507 FM/RDS / BeholdTV 509 FM", 3848 .name = "Beholder BeholdTV 507 FM/RDS / BeholdTV 509 FM",
3817 .audio_clock = 0x00187de7, 3849 .audio_clock = 0x00187de7,
3818 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3850 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
@@ -3820,6 +3852,7 @@ struct saa7134_board saa7134_boards[] = {
3820 .tuner_addr = ADDR_UNSET, 3852 .tuner_addr = ADDR_UNSET,
3821 .radio_addr = ADDR_UNSET, 3853 .radio_addr = ADDR_UNSET,
3822 .tda9887_conf = TDA9887_PRESENT, 3854 .tda9887_conf = TDA9887_PRESENT,
3855 .gpiomask = 0x00008000,
3823 .inputs = {{ 3856 .inputs = {{
3824 .name = name_tv, 3857 .name = name_tv,
3825 .vmux = 3, 3858 .vmux = 3,
@@ -3840,6 +3873,8 @@ struct saa7134_board saa7134_boards[] = {
3840 }, 3873 },
3841 }, 3874 },
3842 [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = { 3875 [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = {
3876 /* Beholder Intl. Ltd. 2008 */
3877 /*Dmitry Belimov <d.belimov@gmail.com> */
3843 .name = "Beholder BeholdTV Columbus TVFM", 3878 .name = "Beholder BeholdTV Columbus TVFM",
3844 .audio_clock = 0x00187de7, 3879 .audio_clock = 0x00187de7,
3845 .tuner_type = TUNER_ALPS_TSBE5_PAL, 3880 .tuner_type = TUNER_ALPS_TSBE5_PAL,
@@ -3847,23 +3882,28 @@ struct saa7134_board saa7134_boards[] = {
3847 .tuner_addr = ADDR_UNSET, 3882 .tuner_addr = ADDR_UNSET,
3848 .radio_addr = ADDR_UNSET, 3883 .radio_addr = ADDR_UNSET,
3849 .tda9887_conf = TDA9887_PRESENT, 3884 .tda9887_conf = TDA9887_PRESENT,
3885 .gpiomask = 0x000A8004,
3850 .inputs = {{ 3886 .inputs = {{
3851 .name = name_tv, 3887 .name = name_tv,
3852 .vmux = 3, 3888 .vmux = 3,
3853 .amux = TV, 3889 .amux = TV,
3854 .tv = 1, 3890 .tv = 1,
3855 },{ 3891 .gpio = 0x000A8004,
3892 }, {
3856 .name = name_comp1, 3893 .name = name_comp1,
3857 .vmux = 1, 3894 .vmux = 1,
3858 .amux = LINE1, 3895 .amux = LINE1,
3859 },{ 3896 .gpio = 0x000A8000,
3897 }, {
3860 .name = name_svideo, 3898 .name = name_svideo,
3861 .vmux = 8, 3899 .vmux = 8,
3862 .amux = LINE1, 3900 .amux = LINE1,
3863 }}, 3901 .gpio = 0x000A8000,
3902 } },
3864 .radio = { 3903 .radio = {
3865 .name = name_radio, 3904 .name = name_radio,
3866 .amux = LINE2, 3905 .amux = LINE2,
3906 .gpio = 0x000A8000,
3867 }, 3907 },
3868 }, 3908 },
3869 [SAA7134_BOARD_BEHOLD_607_9FM] = { 3909 [SAA7134_BOARD_BEHOLD_607_9FM] = {
@@ -3992,6 +4032,221 @@ struct saa7134_board saa7134_boards[] = {
3992 .gpio = 0x6000, 4032 .gpio = 0x6000,
3993 }, 4033 },
3994 }, 4034 },
4035 [SAA7134_BOARD_PHILIPS_SNAKE] = {
4036 .name = "NXP Snake DVB-S reference design",
4037 .audio_clock = 0x00200000,
4038 .tuner_type = TUNER_ABSENT,
4039 .radio_type = UNSET,
4040 .tuner_addr = ADDR_UNSET,
4041 .radio_addr = ADDR_UNSET,
4042 .mpeg = SAA7134_MPEG_DVB,
4043 .inputs = {{
4044 .name = name_comp1,
4045 .vmux = 3,
4046 .amux = LINE1,
4047 }, {
4048 .name = name_svideo,
4049 .vmux = 8,
4050 .amux = LINE1,
4051 } },
4052 },
4053 [SAA7134_BOARD_CREATIX_CTX953] = {
4054 .name = "Medion/Creatix CTX953 Hybrid",
4055 .audio_clock = 0x00187de7,
4056 .tuner_type = TUNER_PHILIPS_TDA8290,
4057 .radio_type = UNSET,
4058 .tuner_addr = ADDR_UNSET,
4059 .radio_addr = ADDR_UNSET,
4060 .tuner_config = 0,
4061 .mpeg = SAA7134_MPEG_DVB,
4062 .inputs = {{
4063 .name = name_tv,
4064 .vmux = 1,
4065 .amux = TV,
4066 .tv = 1,
4067 }, {
4068 .name = name_comp1,
4069 .vmux = 0,
4070 .amux = LINE1,
4071 }, {
4072 .name = name_svideo,
4073 .vmux = 8,
4074 .amux = LINE1,
4075 } },
4076 },
4077 [SAA7134_BOARD_MSI_TVANYWHERE_AD11] = {
4078 .name = "MSI TV@nywhere A/D v1.1",
4079 .audio_clock = 0x00187de7,
4080 .tuner_type = TUNER_PHILIPS_TDA8290,
4081 .radio_type = UNSET,
4082 .tuner_addr = ADDR_UNSET,
4083 .radio_addr = ADDR_UNSET,
4084 .tuner_config = 2,
4085 .mpeg = SAA7134_MPEG_DVB,
4086 .gpiomask = 0x0200000,
4087 .inputs = { {
4088 .name = name_tv,
4089 .vmux = 1,
4090 .amux = TV,
4091 .tv = 1,
4092 }, {
4093 .name = name_comp1,
4094 .vmux = 3,
4095 .amux = LINE1,
4096 }, {
4097 .name = name_svideo,
4098 .vmux = 8,
4099 .amux = LINE1,
4100 } },
4101 .radio = {
4102 .name = name_radio,
4103 .amux = TV,
4104 .gpio = 0x0200000,
4105 },
4106 },
4107 [SAA7134_BOARD_AVERMEDIA_CARDBUS_506] = {
4108 .name = "AVerMedia Cardbus TV/Radio (E506R)",
4109 .audio_clock = 0x187de7,
4110 .tuner_type = TUNER_XC2028,
4111 .radio_type = UNSET,
4112 .tuner_addr = ADDR_UNSET,
4113 .radio_addr = ADDR_UNSET,
4114 /*
4115 TODO:
4116 .mpeg = SAA7134_MPEG_DVB,
4117 */
4118
4119 .inputs = {{
4120 .name = name_tv,
4121 .vmux = 1,
4122 .amux = TV,
4123 .tv = 1,
4124 }, {
4125 .name = name_comp1,
4126 .vmux = 3,
4127 .amux = LINE2,
4128 }, {
4129 .name = name_svideo,
4130 .vmux = 8,
4131 .amux = LINE1,
4132 } },
4133 .radio = {
4134 .name = name_radio,
4135 .amux = TV,
4136 },
4137 },
4138 [SAA7134_BOARD_AVERMEDIA_A16D] = {
4139 .name = "AVerMedia Hybrid TV/Radio (A16D)",
4140 .audio_clock = 0x187de7,
4141 .tuner_type = TUNER_XC2028,
4142 .radio_type = UNSET,
4143 .tuner_addr = ADDR_UNSET,
4144 .radio_addr = ADDR_UNSET,
4145 .inputs = {{
4146 .name = name_tv,
4147 .vmux = 1,
4148 .amux = TV,
4149 .tv = 1,
4150 }, {
4151 .name = name_svideo,
4152 .vmux = 8,
4153 .amux = LINE1,
4154 } },
4155 .radio = {
4156 .name = name_radio,
4157 .amux = LINE1,
4158 },
4159 },
4160 [SAA7134_BOARD_AVERMEDIA_M115] = {
4161 .name = "Avermedia M115",
4162 .audio_clock = 0x187de7,
4163 .tuner_type = TUNER_XC2028,
4164 .radio_type = UNSET,
4165 .tuner_addr = ADDR_UNSET,
4166 .radio_addr = ADDR_UNSET,
4167 .inputs = {{
4168 .name = name_tv,
4169 .vmux = 1,
4170 .amux = TV,
4171 .tv = 1,
4172 }, {
4173 .name = name_comp1,
4174 .vmux = 3,
4175 .amux = LINE1,
4176 }, {
4177 .name = name_svideo,
4178 .vmux = 8,
4179 .amux = LINE2,
4180 } },
4181 },
4182 [SAA7134_BOARD_VIDEOMATE_T750] = {
4183 /* John Newbigin <jn@it.swin.edu.au> */
4184 .name = "Compro VideoMate T750",
4185 .audio_clock = 0x00187de7,
4186 .tuner_type = TUNER_XC2028,
4187 .radio_type = UNSET,
4188 .tuner_addr = ADDR_UNSET,
4189 .radio_addr = ADDR_UNSET,
4190 .mpeg = SAA7134_MPEG_DVB,
4191 .inputs = {{
4192 .name = name_tv,
4193 .vmux = 3,
4194 .amux = TV,
4195 .tv = 1,
4196 }, {
4197 .name = name_comp1,
4198 .vmux = 1,
4199 .amux = LINE2,
4200 }, {
4201 .name = name_svideo,
4202 .vmux = 8,
4203 .amux = LINE2,
4204 } },
4205 .radio = {
4206 .name = name_radio,
4207 .amux = TV,
4208 }
4209 },
4210 [SAA7134_BOARD_AVERMEDIA_A700_PRO] = {
4211 /* Matthias Schwarzott <zzam@gentoo.org> */
4212 .name = "Avermedia DVB-S Pro A700",
4213 .audio_clock = 0x00187de7,
4214 .tuner_type = TUNER_ABSENT,
4215 .radio_type = UNSET,
4216 .tuner_addr = ADDR_UNSET,
4217 .radio_addr = ADDR_UNSET,
4218 /* no DVB support for now */
4219 /* .mpeg = SAA7134_MPEG_DVB, */
4220 .inputs = { {
4221 .name = name_comp,
4222 .vmux = 1,
4223 .amux = LINE1,
4224 }, {
4225 .name = name_svideo,
4226 .vmux = 6,
4227 .amux = LINE1,
4228 } },
4229 },
4230 [SAA7134_BOARD_AVERMEDIA_A700_HYBRID] = {
4231 /* Matthias Schwarzott <zzam@gentoo.org> */
4232 .name = "Avermedia DVB-S Hybrid+FM A700",
4233 .audio_clock = 0x00187de7,
4234 .tuner_type = TUNER_ABSENT, /* TUNER_XC2028 */
4235 .radio_type = UNSET,
4236 .tuner_addr = ADDR_UNSET,
4237 .radio_addr = ADDR_UNSET,
4238 /* no DVB support for now */
4239 /* .mpeg = SAA7134_MPEG_DVB, */
4240 .inputs = { {
4241 .name = name_comp,
4242 .vmux = 1,
4243 .amux = LINE1,
4244 }, {
4245 .name = name_svideo,
4246 .vmux = 6,
4247 .amux = LINE1,
4248 } },
4249 },
3995}; 4250};
3996 4251
3997const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 4252const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -4224,6 +4479,18 @@ struct pci_device_id saa7134_pci_tbl[] = {
4224 .driver_data = SAA7134_BOARD_MD2819, 4479 .driver_data = SAA7134_BOARD_MD2819,
4225 },{ 4480 },{
4226 .vendor = PCI_VENDOR_ID_PHILIPS, 4481 .vendor = PCI_VENDOR_ID_PHILIPS,
4482 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4483 .subvendor = 0x1461, /* Avermedia Technologies Inc */
4484 .subdevice = 0xa7a1,
4485 .driver_data = SAA7134_BOARD_AVERMEDIA_A700_PRO,
4486 }, {
4487 .vendor = PCI_VENDOR_ID_PHILIPS,
4488 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4489 .subvendor = 0x1461, /* Avermedia Technologies Inc */
4490 .subdevice = 0xa7a2,
4491 .driver_data = SAA7134_BOARD_AVERMEDIA_A700_HYBRID,
4492 }, {
4493 .vendor = PCI_VENDOR_ID_PHILIPS,
4227 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 4494 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
4228 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 4495 .subvendor = 0x1461, /* Avermedia Technologies Inc */
4229 .subdevice = 0x2115, 4496 .subdevice = 0x2115,
@@ -4942,7 +5209,43 @@ struct pci_device_id saa7134_pci_tbl[] = {
4942 .subvendor = 0x1822, /*Twinhan Technology Co. Ltd*/ 5209 .subvendor = 0x1822, /*Twinhan Technology Co. Ltd*/
4943 .subdevice = 0x0022, 5210 .subdevice = 0x0022,
4944 .driver_data = SAA7134_BOARD_TWINHAN_DTV_DVB_3056, 5211 .driver_data = SAA7134_BOARD_TWINHAN_DTV_DVB_3056,
5212 }, {
5213 .vendor = PCI_VENDOR_ID_PHILIPS,
5214 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5215 .subvendor = 0x16be,
5216 .subdevice = 0x0010, /* Medion version CTX953_V.1.4.3 */
5217 .driver_data = SAA7134_BOARD_CREATIX_CTX953,
5218 }, {
5219 .vendor = PCI_VENDOR_ID_PHILIPS,
5220 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5221 .subvendor = 0x1462, /* MSI */
5222 .subdevice = 0x8625, /* TV@nywhere A/D v1.1 */
5223 .driver_data = SAA7134_BOARD_MSI_TVANYWHERE_AD11,
4945 },{ 5224 },{
5225 .vendor = PCI_VENDOR_ID_PHILIPS,
5226 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5227 .subvendor = 0x1461, /* Avermedia Technologies Inc */
5228 .subdevice = 0xf436,
5229 .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS_506,
5230 }, {
5231 .vendor = PCI_VENDOR_ID_PHILIPS,
5232 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5233 .subvendor = 0x1461, /* Avermedia Technologies Inc */
5234 .subdevice = 0xf936,
5235 .driver_data = SAA7134_BOARD_AVERMEDIA_A16D,
5236 }, {
5237 .vendor = PCI_VENDOR_ID_PHILIPS,
5238 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5239 .subvendor = 0x1461, /* Avermedia Technologies Inc */
5240 .subdevice = 0xa836,
5241 .driver_data = SAA7134_BOARD_AVERMEDIA_M115,
5242 }, {
5243 .vendor = PCI_VENDOR_ID_PHILIPS,
5244 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5245 .subvendor = 0x185b,
5246 .subdevice = 0xc900,
5247 .driver_data = SAA7134_BOARD_VIDEOMATE_T750,
5248 }, {
4946 /* --- boards without eeprom + subsystem ID --- */ 5249 /* --- boards without eeprom + subsystem ID --- */
4947 .vendor = PCI_VENDOR_ID_PHILIPS, 5250 .vendor = PCI_VENDOR_ID_PHILIPS,
4948 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 5251 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -4998,6 +5301,77 @@ static void board_flyvideo(struct saa7134_dev *dev)
4998 dev->name, dev->name, dev->name); 5301 dev->name, dev->name, dev->name);
4999} 5302}
5000 5303
5304static int saa7134_xc2028_callback(struct saa7134_dev *dev,
5305 int command, int arg)
5306{
5307 switch (command) {
5308 case XC2028_TUNER_RESET:
5309 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000);
5310 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000);
5311 mdelay(250);
5312 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0);
5313 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0);
5314 mdelay(250);
5315 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000);
5316 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000);
5317 mdelay(250);
5318 saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02);
5319 saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81);
5320 saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7);
5321 saa_andorl(SAA7134_AUDIO_PLL_CTRL >> 2, 0x03, 0x03);
5322 saa_andorl(SAA7134_AUDIO_CLOCKS_PER_FIELD0 >> 2,
5323 0x0001e000, 0x0001e000);
5324 return 0;
5325 }
5326 return -EINVAL;
5327}
5328
5329
5330static int saa7134_tda8290_callback(struct saa7134_dev *dev,
5331 int command, int arg)
5332{
5333 u8 sync_control;
5334
5335 switch (command) {
5336 case 0: /* switch LNA gain through GPIO 22*/
5337 saa7134_set_gpio(dev, 22, arg) ;
5338 break;
5339 case 1: /* vsync output at GPIO22. 50 / 60Hz */
5340 saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80);
5341 saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03);
5342 if (arg == 1)
5343 sync_control = 11;
5344 else
5345 sync_control = 17;
5346 saa_writeb(SAA7134_VGATE_START, sync_control);
5347 saa_writeb(SAA7134_VGATE_STOP, sync_control + 1);
5348 saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00);
5349 break;
5350 default:
5351 return -EINVAL;
5352 }
5353
5354 return 0;
5355}
5356
5357int saa7134_tuner_callback(void *priv, int command, int arg)
5358{
5359 struct saa7134_dev *dev = priv;
5360 if (dev != NULL) {
5361 switch (dev->tuner_type) {
5362 case TUNER_PHILIPS_TDA8290:
5363 return saa7134_tda8290_callback(dev, command, arg);
5364 case TUNER_XC2028:
5365 return saa7134_xc2028_callback(dev, command, arg);
5366 }
5367 } else {
5368 printk(KERN_ERR "saa7134: Error - device struct undefined.\n");
5369 return -EINVAL;
5370 }
5371 return -EINVAL;
5372}
5373EXPORT_SYMBOL(saa7134_tuner_callback);
5374
5001/* ----------------------------------------------------------- */ 5375/* ----------------------------------------------------------- */
5002 5376
5003static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data) 5377static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data)
@@ -5067,6 +5441,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5067 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 5441 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
5068 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 5442 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
5069 case SAA7134_BOARD_VIDEOMATE_DVBT_200A: 5443 case SAA7134_BOARD_VIDEOMATE_DVBT_200A:
5444 case SAA7134_BOARD_VIDEOMATE_T750:
5070 case SAA7134_BOARD_MANLI_MTV001: 5445 case SAA7134_BOARD_MANLI_MTV001:
5071 case SAA7134_BOARD_MANLI_MTV002: 5446 case SAA7134_BOARD_MANLI_MTV002:
5072 case SAA7134_BOARD_BEHOLD_409FM: 5447 case SAA7134_BOARD_BEHOLD_409FM:
@@ -5133,11 +5508,29 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5133 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x08000000, 0x00000000); 5508 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x08000000, 0x00000000);
5134 break; 5509 break;
5135 case SAA7134_BOARD_AVERMEDIA_CARDBUS: 5510 case SAA7134_BOARD_AVERMEDIA_CARDBUS:
5136 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: 5511 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5512 case SAA7134_BOARD_AVERMEDIA_M115:
5513 case SAA7134_BOARD_AVERMEDIA_A16D:
5514 /* power-down tuner chip */
5515 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0);
5516 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0);
5517 msleep(10);
5137 /* power-up tuner chip */ 5518 /* power-up tuner chip */
5138 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); 5519 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff);
5139 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); 5520 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
5140 msleep(1); 5521 msleep(10);
5522 break;
5523 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
5524 /* power-down tuner chip */
5525 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x000A8004, 0x000A8004);
5526 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x000A8004, 0);
5527 msleep(10);
5528 /* power-up tuner chip */
5529 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x000A8004, 0x000A8004);
5530 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x000A8004, 0x000A8004);
5531 msleep(10);
5532 /* remote via GPIO */
5533 dev->has_remote = SAA7134_REMOTE_GPIO;
5141 break; 5534 break;
5142 case SAA7134_BOARD_RTD_VFG7350: 5535 case SAA7134_BOARD_RTD_VFG7350:
5143 5536
@@ -5160,7 +5553,6 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5160 dev->has_remote = SAA7134_REMOTE_I2C; 5553 dev->has_remote = SAA7134_REMOTE_I2C;
5161 break; 5554 break;
5162 case SAA7134_BOARD_AVERMEDIA_A169_B: 5555 case SAA7134_BOARD_AVERMEDIA_A169_B:
5163 case SAA7134_BOARD_MD7134_BRIDGE_2:
5164 printk("%s: %s: dual saa713x broadcast decoders\n" 5556 printk("%s: %s: dual saa713x broadcast decoders\n"
5165 "%s: Sorry, none of the inputs to this chip are supported yet.\n" 5557 "%s: Sorry, none of the inputs to this chip are supported yet.\n"
5166 "%s: Dual decoder functionality is disabled for now, use the other chip.\n", 5558 "%s: Dual decoder functionality is disabled for now, use the other chip.\n",
@@ -5172,6 +5564,15 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5172 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x8c040007, 0x8c040007); 5564 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x8c040007, 0x8c040007);
5173 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0c0007cd, 0x0c0007cd); 5565 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0c0007cd, 0x0c0007cd);
5174 break; 5566 break;
5567 case SAA7134_BOARD_AVERMEDIA_A700_PRO:
5568 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID:
5569 /* write windows gpio values */
5570 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x80040100, 0x80040100);
5571 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x80040100, 0x00040100);
5572 printk("%s: %s: hybrid analog/dvb card\n"
5573 "%s: Sorry, only the analog inputs are supported for now.\n",
5574 dev->name, card(dev).name, dev->name);
5575 break;
5175 } 5576 }
5176 return 0; 5577 return 0;
5177} 5578}
@@ -5200,11 +5601,16 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5200 dev->tuner_type = saa7134_boards[dev->board].tuner_type; 5601 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
5201 5602
5202 if (TUNER_ABSENT != dev->tuner_type) { 5603 if (TUNER_ABSENT != dev->tuner_type) {
5203 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; 5604 tun_setup.mode_mask = T_RADIO |
5204 tun_setup.type = dev->tuner_type; 5605 T_ANALOG_TV |
5205 tun_setup.addr = ADDR_UNSET; 5606 T_DIGITAL_TV;
5607 tun_setup.type = dev->tuner_type;
5608 tun_setup.addr = ADDR_UNSET;
5609 tun_setup.tuner_callback = saa7134_tuner_callback;
5206 5610
5207 saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup); 5611 saa7134_i2c_call_clients(dev,
5612 TUNER_SET_TYPE_ADDR,
5613 &tun_setup);
5208 } 5614 }
5209 break; 5615 break;
5210 case SAA7134_BOARD_MD7134: 5616 case SAA7134_BOARD_MD7134:
@@ -5275,14 +5681,25 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5275 &tda9887_cfg); 5681 &tda9887_cfg);
5276 } 5682 }
5277 5683
5278 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; 5684 tun_setup.mode_mask = T_RADIO |
5685 T_ANALOG_TV |
5686 T_DIGITAL_TV;
5279 tun_setup.type = dev->tuner_type; 5687 tun_setup.type = dev->tuner_type;
5280 tun_setup.addr = ADDR_UNSET; 5688 tun_setup.addr = ADDR_UNSET;
5281 5689
5282 saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); 5690 saa7134_i2c_call_clients(dev,
5691 TUNER_SET_TYPE_ADDR, &tun_setup);
5283 } 5692 }
5284 break; 5693 break;
5285 case SAA7134_BOARD_PHILIPS_EUROPA: 5694 case SAA7134_BOARD_PHILIPS_EUROPA:
5695 if (dev->autodetected && (dev->eedata[0x41] == 0x1c)) {
5696 /* Reconfigure board as Snake reference design */
5697 dev->board = SAA7134_BOARD_PHILIPS_SNAKE;
5698 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
5699 printk(KERN_INFO "%s: Reconfigured board as %s\n",
5700 dev->name, saa7134_boards[dev->board].name);
5701 break;
5702 }
5286 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 5703 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
5287 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: 5704 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:
5288 /* The Philips EUROPA based hybrid boards have the tuner connected through 5705 /* The Philips EUROPA based hybrid boards have the tuner connected through
@@ -5333,6 +5750,7 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5333 case SAA7134_BOARD_MEDION_MD8800_QUADRO: 5750 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
5334 case SAA7134_BOARD_AVERMEDIA_SUPER_007: 5751 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
5335 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: 5752 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
5753 case SAA7134_BOARD_CREATIX_CTX953:
5336 /* this is a hybrid board, initialize to analog mode 5754 /* this is a hybrid board, initialize to analog mode
5337 * and configure firmware eeprom address 5755 * and configure firmware eeprom address
5338 */ 5756 */
@@ -5402,13 +5820,46 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5402 break; 5820 break;
5403 } 5821 }
5404 break; 5822 break;
5823 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
5824 {
5825 struct v4l2_priv_tun_config tea5767_cfg;
5826 struct tea5767_ctrl ctl;
5827
5828 dev->i2c_client.addr = 0xC0;
5829 /* set TEA5767(analog FM) defines */
5830 memset(&ctl, 0, sizeof(ctl));
5831 ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
5832 tea5767_cfg.tuner = TUNER_TEA5767;
5833 tea5767_cfg.priv = &ctl;
5834 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tea5767_cfg);
5835 }
5836 break;
5405 } 5837 }
5838
5839 if (dev->tuner_type == TUNER_XC2028) {
5840 struct v4l2_priv_tun_config xc2028_cfg;
5841 struct xc2028_ctrl ctl;
5842
5843 memset(&xc2028_cfg, 0, sizeof(ctl));
5844 memset(&ctl, 0, sizeof(ctl));
5845
5846 ctl.fname = XC2028_DEFAULT_FIRMWARE;
5847 ctl.max_len = 64;
5848
5849 switch (dev->board) {
5850 case SAA7134_BOARD_AVERMEDIA_A16D:
5851 ctl.demod = XC3028_FE_ZARLINK456;
5852 break;
5853 default:
5854 ctl.demod = XC3028_FE_OREN538;
5855 ctl.mts = 1;
5856 }
5857
5858 xc2028_cfg.tuner = TUNER_XC2028;
5859 xc2028_cfg.priv = &ctl;
5860
5861 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
5862 }
5863
5406 return 0; 5864 return 0;
5407} 5865}
5408
5409/* ----------------------------------------------------------- */
5410/*
5411 * Local variables:
5412 * c-basic-offset: 8
5413 * End:
5414 */
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 58ab163fdbd7..eec127864fe3 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -42,23 +42,23 @@ MODULE_LICENSE("GPL");
42 42
43/* ------------------------------------------------------------------ */ 43/* ------------------------------------------------------------------ */
44 44
45static unsigned int irq_debug = 0; 45static unsigned int irq_debug;
46module_param(irq_debug, int, 0644); 46module_param(irq_debug, int, 0644);
47MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]"); 47MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]");
48 48
49static unsigned int core_debug = 0; 49static unsigned int core_debug;
50module_param(core_debug, int, 0644); 50module_param(core_debug, int, 0644);
51MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); 51MODULE_PARM_DESC(core_debug,"enable debug messages [core]");
52 52
53static unsigned int gpio_tracking = 0; 53static unsigned int gpio_tracking;
54module_param(gpio_tracking, int, 0644); 54module_param(gpio_tracking, int, 0644);
55MODULE_PARM_DESC(gpio_tracking,"enable debug messages [gpio]"); 55MODULE_PARM_DESC(gpio_tracking,"enable debug messages [gpio]");
56 56
57static unsigned int alsa = 0; 57static unsigned int alsa;
58module_param(alsa, int, 0644); 58module_param(alsa, int, 0644);
59MODULE_PARM_DESC(alsa,"enable ALSA DMA sound [dmasound]"); 59MODULE_PARM_DESC(alsa,"enable ALSA DMA sound [dmasound]");
60 60
61static unsigned int oss = 0; 61static unsigned int oss;
62module_param(oss, int, 0644); 62module_param(oss, int, 0644);
63MODULE_PARM_DESC(oss,"enable OSS DMA sound [dmasound]"); 63MODULE_PARM_DESC(oss,"enable OSS DMA sound [dmasound]");
64 64
@@ -142,39 +142,6 @@ void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
142 } 142 }
143} 143}
144 144
145int saa7134_tuner_callback(void *ptr, int command, int arg)
146{
147 u8 sync_control;
148 struct saa7134_dev *dev = ptr;
149
150 switch (dev->tuner_type) {
151 case TUNER_PHILIPS_TDA8290:
152 switch (command) {
153 case 0: /* switch LNA gain through GPIO 22*/
154 saa7134_set_gpio(dev, 22, arg) ;
155 break;
156 case 1: /* vsync output at GPIO22. 50 / 60Hz */
157 dprintk("setting GPIO22 to vsync %d\n", arg);
158 saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80);
159 saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03);
160 if (arg == 1)
161 sync_control = 11;
162 else
163 sync_control = 17;
164 saa_writeb(SAA7134_VGATE_START, sync_control);
165 saa_writeb(SAA7134_VGATE_STOP, sync_control + 1);
166 saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00);
167 break;
168 default:
169 return -EINVAL;
170 }
171 break;
172 default:
173 return -ENODEV;
174 }
175 return 0;
176}
177
178/* ------------------------------------------------------------------ */ 145/* ------------------------------------------------------------------ */
179 146
180 147
@@ -897,6 +864,10 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
897 struct saa7134_dev *dev; 864 struct saa7134_dev *dev;
898 struct saa7134_mpeg_ops *mops; 865 struct saa7134_mpeg_ops *mops;
899 int err; 866 int err;
867 int mask;
868
869 if (saa7134_devcount == SAA7134_MAXBOARDS)
870 return -ENOMEM;
900 871
901 dev = kzalloc(sizeof(*dev),GFP_KERNEL); 872 dev = kzalloc(sizeof(*dev),GFP_KERNEL);
902 if (NULL == dev) 873 if (NULL == dev)
@@ -1094,6 +1065,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1094 if (TUNER_ABSENT != dev->tuner_type) 1065 if (TUNER_ABSENT != dev->tuner_type)
1095 saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); 1066 saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
1096 1067
1068 if (card(dev).gpiomask != 0) {
1069 mask = card(dev).gpiomask;
1070 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
1071 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, 0);
1072 }
1097 return 0; 1073 return 0;
1098 1074
1099 fail4: 1075 fail4:
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index ea2be9eceeb8..2d16be2259db 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -33,33 +33,40 @@
33#include "saa7134.h" 33#include "saa7134.h"
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include "dvb-pll.h" 35#include "dvb-pll.h"
36#include <dvb_frontend.h>
36 37
37#include "mt352.h" 38#include "mt352.h"
38#include "mt352_priv.h" /* FIXME */ 39#include "mt352_priv.h" /* FIXME */
39#include "tda1004x.h" 40#include "tda1004x.h"
40#include "nxt200x.h" 41#include "nxt200x.h"
42#include "tuner-xc2028.h"
41 43
42#include "tda10086.h" 44#include "tda10086.h"
43#include "tda826x.h" 45#include "tda826x.h"
44#include "tda827x.h" 46#include "tda827x.h"
45#include "isl6421.h" 47#include "isl6421.h"
48#include "isl6405.h"
49#include "lnbp21.h"
50#include "tuner-simple.h"
46 51
47MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 52MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
48MODULE_LICENSE("GPL"); 53MODULE_LICENSE("GPL");
49 54
50static unsigned int antenna_pwr = 0; 55static unsigned int antenna_pwr;
51 56
52module_param(antenna_pwr, int, 0444); 57module_param(antenna_pwr, int, 0444);
53MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); 58MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
54 59
55static int use_frontend = 0; 60static int use_frontend;
56module_param(use_frontend, int, 0644); 61module_param(use_frontend, int, 0644);
57MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)"); 62MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
58 63
59static int debug = 0; 64static int debug;
60module_param(debug, int, 0644); 65module_param(debug, int, 0644);
61MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off)."); 66MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off).");
62 67
68DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
69
63#define dprintk(fmt, arg...) do { if (debug) \ 70#define dprintk(fmt, arg...) do { if (debug) \
64 printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0) 71 printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0)
65 72
@@ -91,7 +98,7 @@ static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
91 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28)); 98 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
92 udelay(10); 99 udelay(10);
93 ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27); 100 ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
94 dprintk("%s %s\n", __FUNCTION__, ok ? "on" : "off"); 101 dprintk("%s %s\n", __func__, ok ? "on" : "off");
95 102
96 if (!ok) 103 if (!ok)
97 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); 104 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
@@ -111,7 +118,7 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
111 static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 }; 118 static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 };
112 struct saa7134_dev *dev= fe->dvb->priv; 119 struct saa7134_dev *dev= fe->dvb->priv;
113 120
114 dprintk("%s called\n", __FUNCTION__); 121 dprintk("%s called\n", __func__);
115 122
116 mt352_write(fe, clock_config, sizeof(clock_config)); 123 mt352_write(fe, clock_config, sizeof(clock_config));
117 udelay(200); 124 udelay(200);
@@ -146,6 +153,26 @@ static int mt352_aver777_init(struct dvb_frontend* fe)
146 return 0; 153 return 0;
147} 154}
148 155
156static int mt352_aver_a16d_init(struct dvb_frontend *fe)
157{
158 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
159 static u8 reset [] = { RESET, 0x80 };
160 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
161 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 };
162 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
163
164 mt352_write(fe, clock_config, sizeof(clock_config));
165 udelay(200);
166 mt352_write(fe, reset, sizeof(reset));
167 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
168 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
169 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
170
171 return 0;
172}
173
174
175
149static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, 176static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
150 struct dvb_frontend_parameters* params) 177 struct dvb_frontend_parameters* params)
151{ 178{
@@ -188,6 +215,16 @@ static struct mt352_config avermedia_777 = {
188 .demod_init = mt352_aver777_init, 215 .demod_init = mt352_aver777_init,
189}; 216};
190 217
218static struct mt352_config avermedia_16d = {
219 .demod_address = 0xf,
220 .demod_init = mt352_aver_a16d_init,
221};
222
223static struct mt352_config avermedia_e506r_mt352_dev = {
224 .demod_address = (0x1e >> 1),
225 .no_tuner = 1,
226};
227
191/* ================================================================== 228/* ==================================================================
192 * tda1004x based DVB-T cards, helper functions 229 * tda1004x based DVB-T cards, helper functions
193 */ 230 */
@@ -430,8 +467,6 @@ static struct tda1004x_config philips_europa_config = {
430 .request_firmware = philips_tda1004x_request_firmware 467 .request_firmware = philips_tda1004x_request_firmware
431}; 468};
432 469
433/* ------------------------------------------------------------------ */
434
435static struct tda1004x_config medion_cardbus = { 470static struct tda1004x_config medion_cardbus = {
436 .demod_address = 0x08, 471 .demod_address = 0x08,
437 .invert = 1, 472 .invert = 1,
@@ -447,47 +482,6 @@ static struct tda1004x_config medion_cardbus = {
447 * tda 1004x based cards with philips silicon tuner 482 * tda 1004x based cards with philips silicon tuner
448 */ 483 */
449 484
450static void philips_tda827x_lna_gain(struct dvb_frontend *fe, int high)
451{
452 struct saa7134_dev *dev = fe->dvb->priv;
453 struct tda1004x_state *state = fe->demodulator_priv;
454 u8 addr = state->config->i2c_gate;
455 u8 config = state->config->tuner_config;
456 u8 GP00_CF[] = {0x20, 0x01};
457 u8 GP00_LEV[] = {0x22, 0x00};
458
459 struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = GP00_CF, .len = 2};
460 if (config) {
461 if (high) {
462 dprintk("setting LNA to high gain\n");
463 } else {
464 dprintk("setting LNA to low gain\n");
465 }
466 }
467 switch (config) {
468 case 0: /* no LNA */
469 break;
470 case 1: /* switch is GPIO 0 of tda8290 */
471 case 2:
472 /* turn Vsync off */
473 saa7134_set_gpio(dev, 22, 0);
474 GP00_LEV[1] = high ? 0 : 1;
475 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
476 wprintk("could not access tda8290 at addr: 0x%02x\n",
477 addr << 1);
478 return;
479 }
480 msg.buf = GP00_LEV;
481 if (config == 2)
482 GP00_LEV[1] = high ? 1 : 0;
483 i2c_transfer(&dev->i2c_adap, &msg, 1);
484 break;
485 case 3: /* switch with GPIO of saa713x */
486 saa7134_set_gpio(dev, 22, high);
487 break;
488 }
489}
490
491static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) 485static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable)
492{ 486{
493 struct tda1004x_state *state = fe->demodulator_priv; 487 struct tda1004x_state *state = fe->demodulator_priv;
@@ -510,8 +504,6 @@ static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable)
510 return 0; 504 return 0;
511} 505}
512 506
513/* ------------------------------------------------------------------ */
514
515static int philips_tda827x_tuner_init(struct dvb_frontend *fe) 507static int philips_tda827x_tuner_init(struct dvb_frontend *fe)
516{ 508{
517 struct saa7134_dev *dev = fe->dvb->priv; 509 struct saa7134_dev *dev = fe->dvb->priv;
@@ -546,28 +538,57 @@ static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe)
546 return 0; 538 return 0;
547} 539}
548 540
549static struct tda827x_config tda827x_cfg = { 541static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *cdec_conf,
550 .lna_gain = philips_tda827x_lna_gain, 542 struct tda827x_config *tuner_conf)
551 .init = philips_tda827x_tuner_init,
552 .sleep = philips_tda827x_tuner_sleep
553};
554
555static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *tda_conf)
556{ 543{
557 dev->dvb.frontend = dvb_attach(tda10046_attach, tda_conf, &dev->i2c_adap); 544 dev->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap);
558 if (dev->dvb.frontend) { 545 if (dev->dvb.frontend) {
559 if (tda_conf->i2c_gate) 546 if (cdec_conf->i2c_gate)
560 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; 547 dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
561 if (dvb_attach(tda827x_attach, dev->dvb.frontend, tda_conf->tuner_address, 548 if (dvb_attach(tda827x_attach, dev->dvb.frontend, cdec_conf->tuner_address,
562 &dev->i2c_adap,&tda827x_cfg) == NULL) { 549 &dev->i2c_adap, tuner_conf) == NULL) {
563 wprintk("no tda827x tuner found at addr: %02x\n", 550 wprintk("no tda827x tuner found at addr: %02x\n",
564 tda_conf->tuner_address); 551 cdec_conf->tuner_address);
565 } 552 }
566 } 553 }
567} 554}
568 555
569/* ------------------------------------------------------------------ */ 556/* ------------------------------------------------------------------ */
570 557
558static struct tda827x_config tda827x_cfg_0 = {
559 .tuner_callback = saa7134_tuner_callback,
560 .init = philips_tda827x_tuner_init,
561 .sleep = philips_tda827x_tuner_sleep,
562 .config = 0,
563 .switch_addr = 0
564};
565
566static struct tda827x_config tda827x_cfg_1 = {
567 .tuner_callback = saa7134_tuner_callback,
568 .init = philips_tda827x_tuner_init,
569 .sleep = philips_tda827x_tuner_sleep,
570 .config = 1,
571 .switch_addr = 0x4b
572};
573
574static struct tda827x_config tda827x_cfg_2 = {
575 .tuner_callback = saa7134_tuner_callback,
576 .init = philips_tda827x_tuner_init,
577 .sleep = philips_tda827x_tuner_sleep,
578 .config = 2,
579 .switch_addr = 0x4b
580};
581
582static struct tda827x_config tda827x_cfg_2_sw42 = {
583 .tuner_callback = saa7134_tuner_callback,
584 .init = philips_tda827x_tuner_init,
585 .sleep = philips_tda827x_tuner_sleep,
586 .config = 2,
587 .switch_addr = 0x42
588};
589
590/* ------------------------------------------------------------------ */
591
571static struct tda1004x_config tda827x_lifeview_config = { 592static struct tda1004x_config tda827x_lifeview_config = {
572 .demod_address = 0x08, 593 .demod_address = 0x08,
573 .invert = 1, 594 .invert = 1,
@@ -590,7 +611,6 @@ static struct tda1004x_config philips_tiger_config = {
590 .if_freq = TDA10046_FREQ_045, 611 .if_freq = TDA10046_FREQ_045,
591 .i2c_gate = 0x4b, 612 .i2c_gate = 0x4b,
592 .tuner_address = 0x61, 613 .tuner_address = 0x61,
593 .tuner_config = 0,
594 .antenna_switch= 1, 614 .antenna_switch= 1,
595 .request_firmware = philips_tda1004x_request_firmware 615 .request_firmware = philips_tda1004x_request_firmware
596}; 616};
@@ -605,7 +625,6 @@ static struct tda1004x_config cinergy_ht_config = {
605 .if_freq = TDA10046_FREQ_045, 625 .if_freq = TDA10046_FREQ_045,
606 .i2c_gate = 0x4b, 626 .i2c_gate = 0x4b,
607 .tuner_address = 0x61, 627 .tuner_address = 0x61,
608 .tuner_config = 0,
609 .request_firmware = philips_tda1004x_request_firmware 628 .request_firmware = philips_tda1004x_request_firmware
610}; 629};
611 630
@@ -619,7 +638,6 @@ static struct tda1004x_config cinergy_ht_pci_config = {
619 .if_freq = TDA10046_FREQ_045, 638 .if_freq = TDA10046_FREQ_045,
620 .i2c_gate = 0x4b, 639 .i2c_gate = 0x4b,
621 .tuner_address = 0x60, 640 .tuner_address = 0x60,
622 .tuner_config = 0,
623 .request_firmware = philips_tda1004x_request_firmware 641 .request_firmware = philips_tda1004x_request_firmware
624}; 642};
625 643
@@ -633,7 +651,6 @@ static struct tda1004x_config philips_tiger_s_config = {
633 .if_freq = TDA10046_FREQ_045, 651 .if_freq = TDA10046_FREQ_045,
634 .i2c_gate = 0x4b, 652 .i2c_gate = 0x4b,
635 .tuner_address = 0x61, 653 .tuner_address = 0x61,
636 .tuner_config = 2,
637 .antenna_switch= 1, 654 .antenna_switch= 1,
638 .request_firmware = philips_tda1004x_request_firmware 655 .request_firmware = philips_tda1004x_request_firmware
639}; 656};
@@ -648,7 +665,6 @@ static struct tda1004x_config pinnacle_pctv_310i_config = {
648 .if_freq = TDA10046_FREQ_045, 665 .if_freq = TDA10046_FREQ_045,
649 .i2c_gate = 0x4b, 666 .i2c_gate = 0x4b,
650 .tuner_address = 0x61, 667 .tuner_address = 0x61,
651 .tuner_config = 1,
652 .request_firmware = philips_tda1004x_request_firmware 668 .request_firmware = philips_tda1004x_request_firmware
653}; 669};
654 670
@@ -662,7 +678,6 @@ static struct tda1004x_config hauppauge_hvr_1110_config = {
662 .if_freq = TDA10046_FREQ_045, 678 .if_freq = TDA10046_FREQ_045,
663 .i2c_gate = 0x4b, 679 .i2c_gate = 0x4b,
664 .tuner_address = 0x61, 680 .tuner_address = 0x61,
665 .tuner_config = 1,
666 .request_firmware = philips_tda1004x_request_firmware 681 .request_firmware = philips_tda1004x_request_firmware
667}; 682};
668 683
@@ -676,7 +691,6 @@ static struct tda1004x_config asus_p7131_dual_config = {
676 .if_freq = TDA10046_FREQ_045, 691 .if_freq = TDA10046_FREQ_045,
677 .i2c_gate = 0x4b, 692 .i2c_gate = 0x4b,
678 .tuner_address = 0x61, 693 .tuner_address = 0x61,
679 .tuner_config = 0,
680 .antenna_switch= 2, 694 .antenna_switch= 2,
681 .request_firmware = philips_tda1004x_request_firmware 695 .request_firmware = philips_tda1004x_request_firmware
682}; 696};
@@ -715,7 +729,6 @@ static struct tda1004x_config md8800_dvbt_config = {
715 .if_freq = TDA10046_FREQ_045, 729 .if_freq = TDA10046_FREQ_045,
716 .i2c_gate = 0x4b, 730 .i2c_gate = 0x4b,
717 .tuner_address = 0x60, 731 .tuner_address = 0x60,
718 .tuner_config = 0,
719 .request_firmware = philips_tda1004x_request_firmware 732 .request_firmware = philips_tda1004x_request_firmware
720}; 733};
721 734
@@ -729,7 +742,6 @@ static struct tda1004x_config asus_p7131_4871_config = {
729 .if_freq = TDA10046_FREQ_045, 742 .if_freq = TDA10046_FREQ_045,
730 .i2c_gate = 0x4b, 743 .i2c_gate = 0x4b,
731 .tuner_address = 0x61, 744 .tuner_address = 0x61,
732 .tuner_config = 2,
733 .antenna_switch= 2, 745 .antenna_switch= 2,
734 .request_firmware = philips_tda1004x_request_firmware 746 .request_firmware = philips_tda1004x_request_firmware
735}; 747};
@@ -744,7 +756,6 @@ static struct tda1004x_config asus_p7131_hybrid_lna_config = {
744 .if_freq = TDA10046_FREQ_045, 756 .if_freq = TDA10046_FREQ_045,
745 .i2c_gate = 0x4b, 757 .i2c_gate = 0x4b,
746 .tuner_address = 0x61, 758 .tuner_address = 0x61,
747 .tuner_config = 2,
748 .antenna_switch= 2, 759 .antenna_switch= 2,
749 .request_firmware = philips_tda1004x_request_firmware 760 .request_firmware = philips_tda1004x_request_firmware
750}; 761};
@@ -759,7 +770,6 @@ static struct tda1004x_config kworld_dvb_t_210_config = {
759 .if_freq = TDA10046_FREQ_045, 770 .if_freq = TDA10046_FREQ_045,
760 .i2c_gate = 0x4b, 771 .i2c_gate = 0x4b,
761 .tuner_address = 0x61, 772 .tuner_address = 0x61,
762 .tuner_config = 2,
763 .antenna_switch= 1, 773 .antenna_switch= 1,
764 .request_firmware = philips_tda1004x_request_firmware 774 .request_firmware = philips_tda1004x_request_firmware
765}; 775};
@@ -774,7 +784,6 @@ static struct tda1004x_config avermedia_super_007_config = {
774 .if_freq = TDA10046_FREQ_045, 784 .if_freq = TDA10046_FREQ_045,
775 .i2c_gate = 0x4b, 785 .i2c_gate = 0x4b,
776 .tuner_address = 0x60, 786 .tuner_address = 0x60,
777 .tuner_config = 0,
778 .antenna_switch= 1, 787 .antenna_switch= 1,
779 .request_firmware = philips_tda1004x_request_firmware 788 .request_firmware = philips_tda1004x_request_firmware
780}; 789};
@@ -789,7 +798,6 @@ static struct tda1004x_config twinhan_dtv_dvb_3056_config = {
789 .if_freq = TDA10046_FREQ_045, 798 .if_freq = TDA10046_FREQ_045,
790 .i2c_gate = 0x42, 799 .i2c_gate = 0x42,
791 .tuner_address = 0x61, 800 .tuner_address = 0x61,
792 .tuner_config = 2,
793 .antenna_switch = 1, 801 .antenna_switch = 1,
794 .request_firmware = philips_tda1004x_request_firmware 802 .request_firmware = philips_tda1004x_request_firmware
795}; 803};
@@ -817,9 +825,10 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
817} 825}
818 826
819static struct tda827x_config ads_duo_cfg = { 827static struct tda827x_config ads_duo_cfg = {
820 .lna_gain = philips_tda827x_lna_gain, 828 .tuner_callback = saa7134_tuner_callback,
821 .init = ads_duo_tuner_init, 829 .init = ads_duo_tuner_init,
822 .sleep = ads_duo_tuner_sleep 830 .sleep = ads_duo_tuner_sleep,
831 .config = 0
823}; 832};
824 833
825static struct tda1004x_config ads_tech_duo_config = { 834static struct tda1004x_config ads_tech_duo_config = {
@@ -842,8 +851,73 @@ static struct tda10086_config flydvbs = {
842 .demod_address = 0x0e, 851 .demod_address = 0x0e,
843 .invert = 0, 852 .invert = 0,
844 .diseqc_tone = 0, 853 .diseqc_tone = 0,
854 .xtal_freq = TDA10086_XTAL_16M,
845}; 855};
846 856
857static struct tda10086_config sd1878_4m = {
858 .demod_address = 0x0e,
859 .invert = 0,
860 .diseqc_tone = 0,
861 .xtal_freq = TDA10086_XTAL_4M,
862};
863
864/* ------------------------------------------------------------------
865 * special case: lnb supply is connected to the gated i2c
866 */
867
868static int md8800_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
869{
870 int res = -EIO;
871 struct saa7134_dev *dev = fe->dvb->priv;
872 if (fe->ops.i2c_gate_ctrl) {
873 fe->ops.i2c_gate_ctrl(fe, 1);
874 if (dev->original_set_voltage)
875 res = dev->original_set_voltage(fe, voltage);
876 fe->ops.i2c_gate_ctrl(fe, 0);
877 }
878 return res;
879};
880
881static int md8800_set_high_voltage(struct dvb_frontend *fe, long arg)
882{
883 int res = -EIO;
884 struct saa7134_dev *dev = fe->dvb->priv;
885 if (fe->ops.i2c_gate_ctrl) {
886 fe->ops.i2c_gate_ctrl(fe, 1);
887 if (dev->original_set_high_voltage)
888 res = dev->original_set_high_voltage(fe, arg);
889 fe->ops.i2c_gate_ctrl(fe, 0);
890 }
891 return res;
892};
893
894static int md8800_set_voltage2(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
895{
896 struct saa7134_dev *dev = fe->dvb->priv;
897 u8 wbuf[2] = { 0x1f, 00 };
898 u8 rbuf;
899 struct i2c_msg msg[] = { { .addr = 0x08, .flags = 0, .buf = wbuf, .len = 1 },
900 { .addr = 0x08, .flags = I2C_M_RD, .buf = &rbuf, .len = 1 } };
901
902 if (i2c_transfer(&dev->i2c_adap, msg, 2) != 2)
903 return -EIO;
904 /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */
905 if (voltage == SEC_VOLTAGE_18)
906 wbuf[1] = rbuf | 0x10;
907 else
908 wbuf[1] = rbuf & 0xef;
909 msg[0].len = 2;
910 i2c_transfer(&dev->i2c_adap, msg, 1);
911 return 0;
912}
913
914static int md8800_set_high_voltage2(struct dvb_frontend *fe, long arg)
915{
916 struct saa7134_dev *dev = fe->dvb->priv;
917 wprintk("%s: sorry can't set high LNB supply voltage from here\n", __func__);
918 return -EIO;
919}
920
847/* ================================================================== 921/* ==================================================================
848 * nxt200x based ATSC cards, helper functions 922 * nxt200x based ATSC cards, helper functions
849 */ 923 */
@@ -863,12 +937,14 @@ static struct nxt200x_config kworldatsc110 = {
863static int dvb_init(struct saa7134_dev *dev) 937static int dvb_init(struct saa7134_dev *dev)
864{ 938{
865 int ret; 939 int ret;
940 int attach_xc3028 = 0;
941
866 /* init struct videobuf_dvb */ 942 /* init struct videobuf_dvb */
867 dev->ts.nr_bufs = 32; 943 dev->ts.nr_bufs = 32;
868 dev->ts.nr_packets = 32*4; 944 dev->ts.nr_packets = 32*4;
869 dev->dvb.name = dev->name; 945 dev->dvb.name = dev->name;
870 videobuf_queue_pci_init(&dev->dvb.dvbq, &saa7134_ts_qops, 946 videobuf_queue_sg_init(&dev->dvb.dvbq, &saa7134_ts_qops,
871 dev->pci, &dev->slock, 947 &dev->pci->dev, &dev->slock,
872 V4L2_BUF_TYPE_VIDEO_CAPTURE, 948 V4L2_BUF_TYPE_VIDEO_CAPTURE,
873 V4L2_FIELD_ALTERNATE, 949 V4L2_FIELD_ALTERNATE,
874 sizeof(struct saa7134_buf), 950 sizeof(struct saa7134_buf),
@@ -889,17 +965,25 @@ static int dvb_init(struct saa7134_dev *dev)
889 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, 965 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777,
890 &dev->i2c_adap); 966 &dev->i2c_adap);
891 if (dev->dvb.frontend) { 967 if (dev->dvb.frontend) {
892 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 968 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
893 NULL, DVB_PLL_PHILIPS_TD1316); 969 &dev->i2c_adap, 0x61,
970 TUNER_PHILIPS_TD1316);
894 } 971 }
895 break; 972 break;
973 case SAA7134_BOARD_AVERMEDIA_A16D:
974 dprintk("avertv A16D dvb setup\n");
975 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_16d,
976 &dev->i2c_adap);
977 attach_xc3028 = 1;
978 break;
896 case SAA7134_BOARD_MD7134: 979 case SAA7134_BOARD_MD7134:
897 dev->dvb.frontend = dvb_attach(tda10046_attach, 980 dev->dvb.frontend = dvb_attach(tda10046_attach,
898 &medion_cardbus, 981 &medion_cardbus,
899 &dev->i2c_adap); 982 &dev->i2c_adap);
900 if (dev->dvb.frontend) { 983 if (dev->dvb.frontend) {
901 dvb_attach(dvb_pll_attach, dev->dvb.frontend, medion_cardbus.tuner_address, 984 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
902 &dev->i2c_adap, DVB_PLL_FMD1216ME); 985 &dev->i2c_adap, medion_cardbus.tuner_address,
986 TUNER_PHILIPS_FMD1216ME_MK3);
903 } 987 }
904 break; 988 break;
905 case SAA7134_BOARD_PHILIPS_TOUGH: 989 case SAA7134_BOARD_PHILIPS_TOUGH:
@@ -913,7 +997,7 @@ static int dvb_init(struct saa7134_dev *dev)
913 break; 997 break;
914 case SAA7134_BOARD_FLYDVBTDUO: 998 case SAA7134_BOARD_FLYDVBTDUO:
915 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: 999 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
916 configure_tda827x_fe(dev, &tda827x_lifeview_config); 1000 configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0);
917 break; 1001 break;
918 case SAA7134_BOARD_PHILIPS_EUROPA: 1002 case SAA7134_BOARD_PHILIPS_EUROPA:
919 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 1003 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
@@ -938,36 +1022,36 @@ static int dvb_init(struct saa7134_dev *dev)
938 } 1022 }
939 break; 1023 break;
940 case SAA7134_BOARD_KWORLD_DVBT_210: 1024 case SAA7134_BOARD_KWORLD_DVBT_210:
941 configure_tda827x_fe(dev, &kworld_dvb_t_210_config); 1025 configure_tda827x_fe(dev, &kworld_dvb_t_210_config, &tda827x_cfg_2);
942 break; 1026 break;
943 case SAA7134_BOARD_PHILIPS_TIGER: 1027 case SAA7134_BOARD_PHILIPS_TIGER:
944 configure_tda827x_fe(dev, &philips_tiger_config); 1028 configure_tda827x_fe(dev, &philips_tiger_config, &tda827x_cfg_0);
945 break; 1029 break;
946 case SAA7134_BOARD_PINNACLE_PCTV_310i: 1030 case SAA7134_BOARD_PINNACLE_PCTV_310i:
947 configure_tda827x_fe(dev, &pinnacle_pctv_310i_config); 1031 configure_tda827x_fe(dev, &pinnacle_pctv_310i_config, &tda827x_cfg_1);
948 break; 1032 break;
949 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 1033 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
950 configure_tda827x_fe(dev, &hauppauge_hvr_1110_config); 1034 configure_tda827x_fe(dev, &hauppauge_hvr_1110_config, &tda827x_cfg_1);
951 break; 1035 break;
952 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 1036 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
953 configure_tda827x_fe(dev, &asus_p7131_dual_config); 1037 configure_tda827x_fe(dev, &asus_p7131_dual_config, &tda827x_cfg_0);
954 break; 1038 break;
955 case SAA7134_BOARD_FLYDVBT_LR301: 1039 case SAA7134_BOARD_FLYDVBT_LR301:
956 configure_tda827x_fe(dev, &tda827x_lifeview_config); 1040 configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0);
957 break; 1041 break;
958 case SAA7134_BOARD_FLYDVB_TRIO: 1042 case SAA7134_BOARD_FLYDVB_TRIO:
959 if(! use_frontend) { /* terrestrial */ 1043 if(! use_frontend) { /* terrestrial */
960 configure_tda827x_fe(dev, &lifeview_trio_config); 1044 configure_tda827x_fe(dev, &lifeview_trio_config, &tda827x_cfg_0);
961 } else { /* satellite */ 1045 } else { /* satellite */
962 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); 1046 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
963 if (dev->dvb.frontend) { 1047 if (dev->dvb.frontend) {
964 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, 1048 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
965 &dev->i2c_adap, 0) == NULL) { 1049 &dev->i2c_adap, 0) == NULL) {
966 wprintk("%s: Lifeview Trio, No tda826x found!\n", __FUNCTION__); 1050 wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__);
967 } 1051 }
968 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, 1052 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap,
969 0x08, 0, 0) == NULL) { 1053 0x08, 0, 0) == NULL) {
970 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __FUNCTION__); 1054 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__);
971 } 1055 }
972 } 1056 }
973 } 1057 }
@@ -979,18 +1063,56 @@ static int dvb_init(struct saa7134_dev *dev)
979 &dev->i2c_adap); 1063 &dev->i2c_adap);
980 if (dev->dvb.frontend) { 1064 if (dev->dvb.frontend) {
981 if (dvb_attach(tda827x_attach,dev->dvb.frontend, 1065 if (dvb_attach(tda827x_attach,dev->dvb.frontend,
982 ads_tech_duo_config.tuner_address, 1066 ads_tech_duo_config.tuner_address, &dev->i2c_adap,
983 &dev->i2c_adap,&ads_duo_cfg) == NULL) { 1067 &ads_duo_cfg) == NULL) {
984 wprintk("no tda827x tuner found at addr: %02x\n", 1068 wprintk("no tda827x tuner found at addr: %02x\n",
985 ads_tech_duo_config.tuner_address); 1069 ads_tech_duo_config.tuner_address);
986 } 1070 }
987 } 1071 }
988 break; 1072 break;
989 case SAA7134_BOARD_TEVION_DVBT_220RF: 1073 case SAA7134_BOARD_TEVION_DVBT_220RF:
990 configure_tda827x_fe(dev, &tevion_dvbt220rf_config); 1074 configure_tda827x_fe(dev, &tevion_dvbt220rf_config, &tda827x_cfg_0);
991 break; 1075 break;
992 case SAA7134_BOARD_MEDION_MD8800_QUADRO: 1076 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
993 configure_tda827x_fe(dev, &md8800_dvbt_config); 1077 if (!use_frontend) { /* terrestrial */
1078 configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0);
1079 } else { /* satellite */
1080 dev->dvb.frontend = dvb_attach(tda10086_attach,
1081 &flydvbs, &dev->i2c_adap);
1082 if (dev->dvb.frontend) {
1083 struct dvb_frontend *fe = dev->dvb.frontend;
1084 u8 dev_id = dev->eedata[2];
1085 u8 data = 0xc4;
1086 struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1};
1087
1088 if (dvb_attach(tda826x_attach, dev->dvb.frontend,
1089 0x60, &dev->i2c_adap, 0) == NULL)
1090 wprintk("%s: Medion Quadro, no tda826x "
1091 "found !\n", __func__);
1092 if (dev_id != 0x08) {
1093 /* we need to open the i2c gate (we know it exists) */
1094 fe->ops.i2c_gate_ctrl(fe, 1);
1095 if (dvb_attach(isl6405_attach, fe,
1096 &dev->i2c_adap, 0x08, 0, 0) == NULL)
1097 wprintk("%s: Medion Quadro, no ISL6405 "
1098 "found !\n", __func__);
1099 if (dev_id == 0x07) {
1100 /* fire up the 2nd section of the LNB supply since
1101 we can't do this from the other section */
1102 msg.buf = &data;
1103 i2c_transfer(&dev->i2c_adap, &msg, 1);
1104 }
1105 fe->ops.i2c_gate_ctrl(fe, 0);
1106 dev->original_set_voltage = fe->ops.set_voltage;
1107 fe->ops.set_voltage = md8800_set_voltage;
1108 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1109 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1110 } else {
1111 fe->ops.set_voltage = md8800_set_voltage2;
1112 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage2;
1113 }
1114 }
1115 }
994 break; 1116 break;
995 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: 1117 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
996 dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, 1118 dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,
@@ -1004,8 +1126,9 @@ static int dvb_init(struct saa7134_dev *dev)
1004 dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, 1126 dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110,
1005 &dev->i2c_adap); 1127 &dev->i2c_adap);
1006 if (dev->dvb.frontend) { 1128 if (dev->dvb.frontend) {
1007 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 1129 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
1008 NULL, DVB_PLL_TUV1236D); 1130 &dev->i2c_adap, 0x61,
1131 TUNER_PHILIPS_TUV1236D);
1009 } 1132 }
1010 break; 1133 break;
1011 case SAA7134_BOARD_FLYDVBS_LR300: 1134 case SAA7134_BOARD_FLYDVBS_LR300:
@@ -1014,11 +1137,11 @@ static int dvb_init(struct saa7134_dev *dev)
1014 if (dev->dvb.frontend) { 1137 if (dev->dvb.frontend) {
1015 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, 1138 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1016 &dev->i2c_adap, 0) == NULL) { 1139 &dev->i2c_adap, 0) == NULL) {
1017 wprintk("%s: No tda826x found!\n", __FUNCTION__); 1140 wprintk("%s: No tda826x found!\n", __func__);
1018 } 1141 }
1019 if (dvb_attach(isl6421_attach, dev->dvb.frontend, 1142 if (dvb_attach(isl6421_attach, dev->dvb.frontend,
1020 &dev->i2c_adap, 0x08, 0, 0) == NULL) { 1143 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
1021 wprintk("%s: No ISL6421 found!\n", __FUNCTION__); 1144 wprintk("%s: No ISL6421 found!\n", __func__);
1022 } 1145 }
1023 } 1146 }
1024 break; 1147 break;
@@ -1030,8 +1153,9 @@ static int dvb_init(struct saa7134_dev *dev)
1030 dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; 1153 dev->original_demod_sleep = dev->dvb.frontend->ops.sleep;
1031 dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; 1154 dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
1032 1155
1033 dvb_attach(dvb_pll_attach, dev->dvb.frontend, medion_cardbus.tuner_address, 1156 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
1034 &dev->i2c_adap, DVB_PLL_FMD1216ME); 1157 &dev->i2c_adap, medion_cardbus.tuner_address,
1158 TUNER_PHILIPS_FMD1216ME_MK3);
1035 } 1159 }
1036 break; 1160 break;
1037 case SAA7134_BOARD_VIDEOMATE_DVBT_200A: 1161 case SAA7134_BOARD_VIDEOMATE_DVBT_200A:
@@ -1044,38 +1168,107 @@ static int dvb_init(struct saa7134_dev *dev)
1044 } 1168 }
1045 break; 1169 break;
1046 case SAA7134_BOARD_CINERGY_HT_PCMCIA: 1170 case SAA7134_BOARD_CINERGY_HT_PCMCIA:
1047 configure_tda827x_fe(dev, &cinergy_ht_config); 1171 configure_tda827x_fe(dev, &cinergy_ht_config, &tda827x_cfg_0);
1048 break; 1172 break;
1049 case SAA7134_BOARD_CINERGY_HT_PCI: 1173 case SAA7134_BOARD_CINERGY_HT_PCI:
1050 configure_tda827x_fe(dev, &cinergy_ht_pci_config); 1174 configure_tda827x_fe(dev, &cinergy_ht_pci_config, &tda827x_cfg_0);
1051 break; 1175 break;
1052 case SAA7134_BOARD_PHILIPS_TIGER_S: 1176 case SAA7134_BOARD_PHILIPS_TIGER_S:
1053 configure_tda827x_fe(dev, &philips_tiger_s_config); 1177 configure_tda827x_fe(dev, &philips_tiger_s_config, &tda827x_cfg_2);
1054 break; 1178 break;
1055 case SAA7134_BOARD_ASUS_P7131_4871: 1179 case SAA7134_BOARD_ASUS_P7131_4871:
1056 configure_tda827x_fe(dev, &asus_p7131_4871_config); 1180 configure_tda827x_fe(dev, &asus_p7131_4871_config, &tda827x_cfg_2);
1057 break; 1181 break;
1058 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: 1182 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
1059 configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config); 1183 configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config, &tda827x_cfg_2);
1060 break; 1184 break;
1061 case SAA7134_BOARD_AVERMEDIA_SUPER_007: 1185 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
1062 configure_tda827x_fe(dev, &avermedia_super_007_config); 1186 configure_tda827x_fe(dev, &avermedia_super_007_config, &tda827x_cfg_0);
1063 break; 1187 break;
1064 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: 1188 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
1065 configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config); 1189 configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config, &tda827x_cfg_2_sw42);
1190 break;
1191 case SAA7134_BOARD_PHILIPS_SNAKE:
1192 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
1193 &dev->i2c_adap);
1194 if (dev->dvb.frontend) {
1195 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1196 &dev->i2c_adap, 0) == NULL)
1197 wprintk("%s: No tda826x found!\n", __func__);
1198 if (dvb_attach(lnbp21_attach, dev->dvb.frontend,
1199 &dev->i2c_adap, 0, 0) == NULL)
1200 wprintk("%s: No lnbp21 found!\n", __func__);
1201 }
1202 break;
1203 case SAA7134_BOARD_CREATIX_CTX953:
1204 configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0);
1205 break;
1206 case SAA7134_BOARD_MSI_TVANYWHERE_AD11:
1207 configure_tda827x_fe(dev, &philips_tiger_s_config, &tda827x_cfg_2);
1208 break;
1209 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
1210 dev->dvb.frontend = dvb_attach(mt352_attach,
1211 &avermedia_e506r_mt352_dev,
1212 &dev->i2c_adap);
1213 attach_xc3028 = 1;
1214 break;
1215 case SAA7134_BOARD_MD7134_BRIDGE_2:
1216 dev->dvb.frontend = dvb_attach(tda10086_attach,
1217 &sd1878_4m, &dev->i2c_adap);
1218 if (dev->dvb.frontend) {
1219 struct dvb_frontend *fe;
1220 if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,
1221 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL)
1222 wprintk("%s: MD7134 DVB-S, no SD1878 "
1223 "found !\n", __func__);
1224 /* we need to open the i2c gate (we know it exists) */
1225 fe = dev->dvb.frontend;
1226 fe->ops.i2c_gate_ctrl(fe, 1);
1227 if (dvb_attach(isl6405_attach, fe,
1228 &dev->i2c_adap, 0x08, 0, 0) == NULL)
1229 wprintk("%s: MD7134 DVB-S, no ISL6405 "
1230 "found !\n", __func__);
1231 fe->ops.i2c_gate_ctrl(fe, 0);
1232 dev->original_set_voltage = fe->ops.set_voltage;
1233 fe->ops.set_voltage = md8800_set_voltage;
1234 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1235 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1236 }
1066 break; 1237 break;
1067 default: 1238 default:
1068 wprintk("Huh? unknown DVB card?\n"); 1239 wprintk("Huh? unknown DVB card?\n");
1069 break; 1240 break;
1070 } 1241 }
1071 1242
1243 if (attach_xc3028) {
1244 struct dvb_frontend *fe;
1245 struct xc2028_config cfg = {
1246 .i2c_adap = &dev->i2c_adap,
1247 .i2c_addr = 0x61,
1248 };
1249
1250 if (!dev->dvb.frontend)
1251 return -1;
1252
1253 fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg);
1254 if (!fe) {
1255 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
1256 dev->name);
1257 dvb_frontend_detach(dev->dvb.frontend);
1258 dvb_unregister_frontend(dev->dvb.frontend);
1259 dev->dvb.frontend = NULL;
1260 return -1;
1261 }
1262 }
1263
1072 if (NULL == dev->dvb.frontend) { 1264 if (NULL == dev->dvb.frontend) {
1073 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); 1265 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
1074 return -1; 1266 return -1;
1075 } 1267 }
1076 1268
1077 /* register everything else */ 1269 /* register everything else */
1078 ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev); 1270 ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev,
1271 adapter_nr);
1079 1272
1080 /* this sequence is necessary to make the tda1004x load its firmware 1273 /* this sequence is necessary to make the tda1004x load its firmware
1081 * and to enter analog mode of hybrid boards 1274 * and to enter analog mode of hybrid boards
@@ -1106,9 +1299,22 @@ static int dvb_fini(struct saa7134_dev *dev)
1106 1299
1107 /* otherwise we don't detect the tuner on next insmod */ 1300 /* otherwise we don't detect the tuner on next insmod */
1108 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg); 1301 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg);
1302 } else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) {
1303 if ((dev->eedata[2] == 0x07) && use_frontend) {
1304 /* turn off the 2nd lnb supply */
1305 u8 data = 0x80;
1306 struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1};
1307 struct dvb_frontend *fe;
1308 fe = dev->dvb.frontend;
1309 if (fe->ops.i2c_gate_ctrl) {
1310 fe->ops.i2c_gate_ctrl(fe, 1);
1311 i2c_transfer(&dev->i2c_adap, &msg, 1);
1312 fe->ops.i2c_gate_ctrl(fe, 0);
1313 }
1314 }
1109 } 1315 }
1110 1316 if (dev->dvb.frontend)
1111 videobuf_dvb_unregister(&dev->dvb); 1317 videobuf_dvb_unregister(&dev->dvb);
1112 return 0; 1318 return 0;
1113} 1319}
1114 1320
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 3d2ec30de227..1314522a8130 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -40,7 +40,7 @@ static unsigned int empress_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
40module_param_array(empress_nr, int, NULL, 0444); 40module_param_array(empress_nr, int, NULL, 0444);
41MODULE_PARM_DESC(empress_nr,"ts device number"); 41MODULE_PARM_DESC(empress_nr,"ts device number");
42 42
43static unsigned int debug = 0; 43static unsigned int debug;
44module_param(debug, int, 0644); 44module_param(debug, int, 0644);
45MODULE_PARM_DESC(debug,"enable debug messages"); 45MODULE_PARM_DESC(debug,"enable debug messages");
46 46
@@ -402,7 +402,7 @@ static int empress_init(struct saa7134_dev *dev)
402{ 402{
403 int err; 403 int err;
404 404
405 dprintk("%s: %s\n",dev->name,__FUNCTION__); 405 dprintk("%s: %s\n",dev->name,__func__);
406 dev->empress_dev = video_device_alloc(); 406 dev->empress_dev = video_device_alloc();
407 if (NULL == dev->empress_dev) 407 if (NULL == dev->empress_dev)
408 return -ENOMEM; 408 return -ENOMEM;
@@ -427,8 +427,8 @@ static int empress_init(struct saa7134_dev *dev)
427 printk(KERN_INFO "%s: registered device video%d [mpeg]\n", 427 printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
428 dev->name,dev->empress_dev->minor & 0x1f); 428 dev->name,dev->empress_dev->minor & 0x1f);
429 429
430 videobuf_queue_pci_init(&dev->empress_tsq, &saa7134_ts_qops, 430 videobuf_queue_sg_init(&dev->empress_tsq, &saa7134_ts_qops,
431 dev->pci, &dev->slock, 431 &dev->pci->dev, &dev->slock,
432 V4L2_BUF_TYPE_VIDEO_CAPTURE, 432 V4L2_BUF_TYPE_VIDEO_CAPTURE,
433 V4L2_FIELD_ALTERNATE, 433 V4L2_FIELD_ALTERNATE,
434 sizeof(struct saa7134_buf), 434 sizeof(struct saa7134_buf),
@@ -440,7 +440,7 @@ static int empress_init(struct saa7134_dev *dev)
440 440
441static int empress_fini(struct saa7134_dev *dev) 441static int empress_fini(struct saa7134_dev *dev)
442{ 442{
443 dprintk("%s: %s\n",dev->name,__FUNCTION__); 443 dprintk("%s: %s\n",dev->name,__func__);
444 444
445 if (NULL == dev->empress_dev) 445 if (NULL == dev->empress_dev)
446 return 0; 446 return 0;
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index d3322c3018f2..2ccfaba0c490 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -33,11 +33,11 @@
33 33
34/* ----------------------------------------------------------- */ 34/* ----------------------------------------------------------- */
35 35
36static unsigned int i2c_debug = 0; 36static unsigned int i2c_debug;
37module_param(i2c_debug, int, 0644); 37module_param(i2c_debug, int, 0644);
38MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]"); 38MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]");
39 39
40static unsigned int i2c_scan = 0; 40static unsigned int i2c_scan;
41module_param(i2c_scan, int, 0444); 41module_param(i2c_scan, int, 0444);
42MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 42MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
43 43
@@ -140,6 +140,8 @@ static inline int i2c_is_busy(enum i2c_status status)
140{ 140{
141 switch (status) { 141 switch (status) {
142 case BUSY: 142 case BUSY:
143 case TO_SCL:
144 case TO_ARB:
143 return true; 145 return true;
144 default: 146 default:
145 return false; 147 return false;
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index b4188819782f..767ff30832f2 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -27,15 +27,15 @@
27#include "saa7134-reg.h" 27#include "saa7134-reg.h"
28#include "saa7134.h" 28#include "saa7134.h"
29 29
30static unsigned int disable_ir = 0; 30static unsigned int disable_ir;
31module_param(disable_ir, int, 0444); 31module_param(disable_ir, int, 0444);
32MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); 32MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
33 33
34static unsigned int ir_debug = 0; 34static unsigned int ir_debug;
35module_param(ir_debug, int, 0644); 35module_param(ir_debug, int, 0644);
36MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); 36MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
37 37
38static int pinnacle_remote = 0; 38static int pinnacle_remote;
39module_param(pinnacle_remote, int, 0644); /* Choose Pinnacle PCTV remote */ 39module_param(pinnacle_remote, int, 0644); /* Choose Pinnacle PCTV remote */
40MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)"); 40MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)");
41 41
@@ -331,6 +331,11 @@ int saa7134_input_init1(struct saa7134_dev *dev)
331 break; 331 break;
332 case SAA7134_BOARD_MANLI_MTV001: 332 case SAA7134_BOARD_MANLI_MTV001:
333 case SAA7134_BOARD_MANLI_MTV002: 333 case SAA7134_BOARD_MANLI_MTV002:
334 ir_codes = ir_codes_manli;
335 mask_keycode = 0x001f00;
336 mask_keyup = 0x004000;
337 polling = 50; /* ms */
338 break;
334 case SAA7134_BOARD_BEHOLD_409FM: 339 case SAA7134_BOARD_BEHOLD_409FM:
335 case SAA7134_BOARD_BEHOLD_401: 340 case SAA7134_BOARD_BEHOLD_401:
336 case SAA7134_BOARD_BEHOLD_403: 341 case SAA7134_BOARD_BEHOLD_403:
@@ -343,7 +348,13 @@ int saa7134_input_init1(struct saa7134_dev *dev)
343 case SAA7134_BOARD_BEHOLD_505FM: 348 case SAA7134_BOARD_BEHOLD_505FM:
344 case SAA7134_BOARD_BEHOLD_507_9FM: 349 case SAA7134_BOARD_BEHOLD_507_9FM:
345 ir_codes = ir_codes_manli; 350 ir_codes = ir_codes_manli;
346 mask_keycode = 0x001f00; 351 mask_keycode = 0x003f00;
352 mask_keyup = 0x004000;
353 polling = 50; /* ms */
354 break;
355 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
356 ir_codes = ir_codes_behold_columbus;
357 mask_keycode = 0x003f00;
347 mask_keyup = 0x004000; 358 mask_keyup = 0x004000;
348 polling = 50; // ms 359 polling = 50; // ms
349 break; 360 break;
diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h
index ac6431ba4fc3..86f5eefdb0f6 100644
--- a/drivers/media/video/saa7134/saa7134-reg.h
+++ b/drivers/media/video/saa7134/saa7134-reg.h
@@ -365,6 +365,9 @@
365#define SAA7135_DSP_RWSTATE_RDB (1 << 1) 365#define SAA7135_DSP_RWSTATE_RDB (1 << 1)
366#define SAA7135_DSP_RWSTATE_WRR (1 << 0) 366#define SAA7135_DSP_RWSTATE_WRR (1 << 0)
367 367
368#define SAA7135_DSP_RWCLEAR 0x586
369#define SAA7135_DSP_RWCLEAR_RERR 1
370
368/* ------------------------------------------------------------------ */ 371/* ------------------------------------------------------------------ */
369/* 372/*
370 * Local variables: 373 * Local variables:
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
index f1b8fcaeb43a..eae72fd60cec 100644
--- a/drivers/media/video/saa7134/saa7134-ts.c
+++ b/drivers/media/video/saa7134/saa7134-ts.c
@@ -32,7 +32,7 @@
32 32
33/* ------------------------------------------------------------------ */ 33/* ------------------------------------------------------------------ */
34 34
35static unsigned int ts_debug = 0; 35static unsigned int ts_debug;
36module_param(ts_debug, int, 0644); 36module_param(ts_debug, int, 0644);
37MODULE_PARM_DESC(ts_debug,"enable debug messages [ts]"); 37MODULE_PARM_DESC(ts_debug,"enable debug messages [ts]");
38 38
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 4e9810469ae3..232af598d947 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -35,18 +35,18 @@
35 35
36/* ------------------------------------------------------------------ */ 36/* ------------------------------------------------------------------ */
37 37
38static unsigned int audio_debug = 0; 38static unsigned int audio_debug;
39module_param(audio_debug, int, 0644); 39module_param(audio_debug, int, 0644);
40MODULE_PARM_DESC(audio_debug,"enable debug messages [tv audio]"); 40MODULE_PARM_DESC(audio_debug,"enable debug messages [tv audio]");
41 41
42static unsigned int audio_ddep = 0; 42static unsigned int audio_ddep;
43module_param(audio_ddep, int, 0644); 43module_param(audio_ddep, int, 0644);
44MODULE_PARM_DESC(audio_ddep,"audio ddep overwrite"); 44MODULE_PARM_DESC(audio_ddep,"audio ddep overwrite");
45 45
46static int audio_clock_override = UNSET; 46static int audio_clock_override = UNSET;
47module_param(audio_clock_override, int, 0644); 47module_param(audio_clock_override, int, 0644);
48 48
49static int audio_clock_tweak = 0; 49static int audio_clock_tweak;
50module_param(audio_clock_tweak, int, 0644); 50module_param(audio_clock_tweak, int, 0644);
51MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with audio crystal that's slightly off (range [-1024 .. 1024])"); 51MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with audio crystal that's slightly off (range [-1024 .. 1024])");
52 52
@@ -653,6 +653,17 @@ static char *stdres[0x20] = {
653 653
654#define DSP_RETRY 32 654#define DSP_RETRY 32
655#define DSP_DELAY 16 655#define DSP_DELAY 16
656#define SAA7135_DSP_RWCLEAR_RERR 1
657
658static inline int saa_dsp_reset_error_bit(struct saa7134_dev *dev)
659{
660 int state = saa_readb(SAA7135_DSP_RWSTATE);
661 if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) {
662 d2printk("%s: resetting error bit\n", dev->name);
663 saa_writeb(SAA7135_DSP_RWCLEAR, SAA7135_DSP_RWCLEAR_RERR);
664 }
665 return 0;
666}
656 667
657static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit) 668static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit)
658{ 669{
@@ -660,8 +671,8 @@ static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit)
660 671
661 state = saa_readb(SAA7135_DSP_RWSTATE); 672 state = saa_readb(SAA7135_DSP_RWSTATE);
662 if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) { 673 if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) {
663 printk("%s: dsp access error\n",dev->name); 674 printk(KERN_WARNING "%s: dsp access error\n", dev->name);
664 /* FIXME: send ack ... */ 675 saa_dsp_reset_error_bit(dev);
665 return -EIO; 676 return -EIO;
666 } 677 }
667 while (0 == (state & bit)) { 678 while (0 == (state & bit)) {
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c
index f0d5ed9c2b06..cb0304298a96 100644
--- a/drivers/media/video/saa7134/saa7134-vbi.c
+++ b/drivers/media/video/saa7134/saa7134-vbi.c
@@ -31,7 +31,7 @@
31 31
32/* ------------------------------------------------------------------ */ 32/* ------------------------------------------------------------------ */
33 33
34static unsigned int vbi_debug = 0; 34static unsigned int vbi_debug;
35module_param(vbi_debug, int, 0644); 35module_param(vbi_debug, int, 0644);
36MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]"); 36MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
37 37
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 39c41ad97d0e..a0baf2d0ba7f 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -40,7 +40,7 @@
40 40
41unsigned int video_debug; 41unsigned int video_debug;
42static unsigned int gbuffers = 8; 42static unsigned int gbuffers = 8;
43static unsigned int noninterlaced = 0; 43static unsigned int noninterlaced; /* 0 */
44static unsigned int gbufsize = 720*576*4; 44static unsigned int gbufsize = 720*576*4;
45static unsigned int gbufsize_max = 720*576*4; 45static unsigned int gbufsize_max = 720*576*4;
46static char secam[] = "--"; 46static char secam[] = "--";
@@ -626,13 +626,8 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev)
626{ 626{
627 saa7134_set_decoder(dev); 627 saa7134_set_decoder(dev);
628 628
629 if (card_in(dev, dev->ctl_input).tv) { 629 if (card_in(dev, dev->ctl_input).tv)
630 if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290)
631 && ((card(dev).tuner_config == 1)
632 || (card(dev).tuner_config == 2)))
633 saa7134_set_gpio(dev, 22, 5);
634 saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); 630 saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);
635 }
636} 631}
637 632
638static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) 633static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale)
@@ -1350,14 +1345,14 @@ static int video_open(struct inode *inode, struct file *file)
1350 fh->height = 576; 1345 fh->height = 576;
1351 v4l2_prio_open(&dev->prio,&fh->prio); 1346 v4l2_prio_open(&dev->prio,&fh->prio);
1352 1347
1353 videobuf_queue_pci_init(&fh->cap, &video_qops, 1348 videobuf_queue_sg_init(&fh->cap, &video_qops,
1354 dev->pci, &dev->slock, 1349 &dev->pci->dev, &dev->slock,
1355 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1350 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1356 V4L2_FIELD_INTERLACED, 1351 V4L2_FIELD_INTERLACED,
1357 sizeof(struct saa7134_buf), 1352 sizeof(struct saa7134_buf),
1358 fh); 1353 fh);
1359 videobuf_queue_pci_init(&fh->vbi, &saa7134_vbi_qops, 1354 videobuf_queue_sg_init(&fh->vbi, &saa7134_vbi_qops,
1360 dev->pci, &dev->slock, 1355 &dev->pci->dev, &dev->slock,
1361 V4L2_BUF_TYPE_VBI_CAPTURE, 1356 V4L2_BUF_TYPE_VBI_CAPTURE,
1362 V4L2_FIELD_SEQ_TB, 1357 V4L2_FIELD_SEQ_TB,
1363 sizeof(struct saa7134_buf), 1358 sizeof(struct saa7134_buf),
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index f940d0254798..924ffd13637e 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -253,7 +253,17 @@ struct saa7134_format {
253#define SAA7134_BOARD_BEHOLD_607_9FM 129 253#define SAA7134_BOARD_BEHOLD_607_9FM 129
254#define SAA7134_BOARD_BEHOLD_M6 130 254#define SAA7134_BOARD_BEHOLD_M6 130
255#define SAA7134_BOARD_TWINHAN_DTV_DVB_3056 131 255#define SAA7134_BOARD_TWINHAN_DTV_DVB_3056 131
256#define SAA7134_BOARD_GENIUS_TVGO_A11MCE 132 256#define SAA7134_BOARD_GENIUS_TVGO_A11MCE 132
257#define SAA7134_BOARD_PHILIPS_SNAKE 133
258#define SAA7134_BOARD_CREATIX_CTX953 134
259#define SAA7134_BOARD_MSI_TVANYWHERE_AD11 135
260#define SAA7134_BOARD_AVERMEDIA_CARDBUS_506 136
261#define SAA7134_BOARD_AVERMEDIA_A16D 137
262#define SAA7134_BOARD_AVERMEDIA_M115 138
263#define SAA7134_BOARD_VIDEOMATE_T750 139
264#define SAA7134_BOARD_AVERMEDIA_A700_PRO 140
265#define SAA7134_BOARD_AVERMEDIA_A700_HYBRID 141
266
257 267
258#define SAA7134_MAXBOARDS 8 268#define SAA7134_MAXBOARDS 8
259#define SAA7134_INPUT_MAX 8 269#define SAA7134_INPUT_MAX 8
@@ -380,9 +390,7 @@ struct saa7134_fh {
380 unsigned int radio; 390 unsigned int radio;
381 enum v4l2_buf_type type; 391 enum v4l2_buf_type type;
382 unsigned int resources; 392 unsigned int resources;
383#ifdef VIDIOC_G_PRIORITY
384 enum v4l2_priority prio; 393 enum v4l2_priority prio;
385#endif
386 394
387 /* video overlay */ 395 /* video overlay */
388 struct v4l2_window win; 396 struct v4l2_window win;
@@ -454,9 +462,7 @@ struct saa7134_dev {
454 struct list_head devlist; 462 struct list_head devlist;
455 struct mutex lock; 463 struct mutex lock;
456 spinlock_t slock; 464 spinlock_t slock;
457#ifdef VIDIOC_G_PRIORITY
458 struct v4l2_prio_state prio; 465 struct v4l2_prio_state prio;
459#endif
460 /* workstruct for loading modules */ 466 /* workstruct for loading modules */
461 struct work_struct request_module_wk; 467 struct work_struct request_module_wk;
462 468
@@ -556,7 +562,9 @@ struct saa7134_dev {
556#if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE) 562#if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE)
557 /* SAA7134_MPEG_DVB only */ 563 /* SAA7134_MPEG_DVB only */
558 struct videobuf_dvb dvb; 564 struct videobuf_dvb dvb;
559 int (*original_demod_sleep)(struct dvb_frontend* fe); 565 int (*original_demod_sleep)(struct dvb_frontend *fe);
566 int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
567 int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg);
560#endif 568#endif
561}; 569};
562 570
@@ -594,7 +602,6 @@ extern int saa7134_no_overlay;
594 602
595void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); 603void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
596void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value); 604void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value);
597int saa7134_tuner_callback(void *ptr, int command, int arg);
598 605
599#define SAA7134_PGTABLE_SIZE 4096 606#define SAA7134_PGTABLE_SIZE 4096
600 607
@@ -631,6 +638,7 @@ extern struct pci_device_id __devinitdata saa7134_pci_tbl[];
631 638
632extern int saa7134_board_init1(struct saa7134_dev *dev); 639extern int saa7134_board_init1(struct saa7134_dev *dev);
633extern int saa7134_board_init2(struct saa7134_dev *dev); 640extern int saa7134_board_init2(struct saa7134_dev *dev);
641int saa7134_tuner_callback(void *priv, int command, int arg);
634 642
635 643
636/* ----------------------------------------------------------- */ 644/* ----------------------------------------------------------- */