aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/Kconfig13
-rw-r--r--drivers/media/video/bt832.c12
-rw-r--r--drivers/media/video/bttv-cards.c110
-rw-r--r--drivers/media/video/bttv-driver.c19
-rw-r--r--drivers/media/video/bttv-i2c.c26
-rw-r--r--drivers/media/video/bttv-risc.c9
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c5
-rw-r--r--drivers/media/video/cx88/cx88-core.c48
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c39
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c31
-rw-r--r--drivers/media/video/cx88/cx88-input.c448
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c26
-rw-r--r--drivers/media/video/cx88/cx88-reg.h11
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c76
-rw-r--r--drivers/media/video/cx88/cx88-video.c303
-rw-r--r--drivers/media/video/cx88/cx88.h12
-rw-r--r--drivers/media/video/ir-kbd-i2c.c51
-rw-r--r--drivers/media/video/msp3400.c25
-rw-r--r--drivers/media/video/mt20xx.c16
-rw-r--r--drivers/media/video/mxb.c7
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c2096
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c74
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c423
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c45
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c48
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c19
-rw-r--r--drivers/media/video/saa7134/saa7134-ts.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c121
-rw-r--r--drivers/media/video/saa7134/saa7134-vbi.c12
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c54
-rw-r--r--drivers/media/video/saa7134/saa7134.h21
-rw-r--r--drivers/media/video/tda7432.c13
-rw-r--r--drivers/media/video/tda8290.c13
-rw-r--r--drivers/media/video/tda9875.c13
-rw-r--r--drivers/media/video/tda9887.c9
-rw-r--r--drivers/media/video/tea5767.c158
-rw-r--r--drivers/media/video/tuner-3036.c2
-rw-r--r--drivers/media/video/tuner-core.c707
-rw-r--r--drivers/media/video/tuner-simple.c85
-rw-r--r--drivers/media/video/tvaudio.c5
-rw-r--r--drivers/media/video/tveeprom.c9
42 files changed, 2742 insertions, 2482 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index e771064689e6..f461750c7646 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -7,19 +7,6 @@ menu "Video For Linux"
7 7
8comment "Video Adapters" 8comment "Video Adapters"
9 9
10config TUNER_MULTI_I2C
11 bool "Enable support for multiple I2C devices on Video Adapters (EXPERIMENTAL)"
12 depends on VIDEO_DEV && EXPERIMENTAL
13 ---help---
14 Some video adapters have more than one tuner inside. This patch
15 enables support for using more than one tuner. This is required
16 for some cards to allow tunning both video and radio.
17 It also improves I2C autodetection for these cards.
18
19 Only few tuners currently is supporting this. More to come.
20
21 It is safe to say 'Y' here even if your card has only one I2C tuner.
22
23config VIDEO_BT848 10config VIDEO_BT848
24 tristate "BT848 Video For Linux" 11 tristate "BT848 Video For Linux"
25 depends on VIDEO_DEV && PCI && I2C 12 depends on VIDEO_DEV && PCI && I2C
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
index 9a642c7de545..a070417e65e6 100644
--- a/drivers/media/video/bt832.c
+++ b/drivers/media/video/bt832.c
@@ -138,25 +138,13 @@ int bt832_init(struct i2c_client *i2c_client_s)
138 138
139 bt832_hexdump(i2c_client_s,buf); 139 bt832_hexdump(i2c_client_s,buf);
140 140
141#if 0
142 // Full 30/25 Frame rate
143 printk("Full 30/25 Frame rate\n");
144 buf[0]=BT832_VP_CONTROL0; // Reg.39
145 buf[1]= 0x00;
146 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
147 printk("bt832: i2c i/o error FFR: rc == %d (should be 2)\n",rc);
148
149 bt832_hexdump(i2c_client_s,buf);
150#endif
151 141
152#if 1
153 // for testing (even works when no camera attached) 142 // for testing (even works when no camera attached)
154 printk("bt832: *** Generate NTSC M Bars *****\n"); 143 printk("bt832: *** Generate NTSC M Bars *****\n");
155 buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 144 buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42
156 buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally 145 buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally
157 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 146 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
158 printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); 147 printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc);
159#endif
160 148
161 printk("Bt832: Camera Present: %s\n", 149 printk("Bt832: Camera Present: %s\n",
162 (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); 150 (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no");
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 251092e7f19f..2dbf5ec43abd 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-cards.c,v 1.49 2005/06/10 17:20:24 mchehab Exp $ 2 $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $
3 3
4 bttv-cards.c 4 bttv-cards.c
5 5
@@ -39,9 +39,6 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#include "bttvp.h" 41#include "bttvp.h"
42#if 0 /* not working yet */
43#include "bt832.h"
44#endif
45 42
46/* fwd decl */ 43/* fwd decl */
47static void boot_msp34xx(struct bttv *btv, int pin); 44static void boot_msp34xx(struct bttv *btv, int pin);
@@ -513,13 +510,8 @@ struct tvcard bttv_tvcards[] = {
513 .svhs = 2, 510 .svhs = 2,
514 .gpiomask = 0x01fe00, 511 .gpiomask = 0x01fe00,
515 .muxsel = { 2, 3, 1, 1}, 512 .muxsel = { 2, 3, 1, 1},
516#if 0
517 // old
518 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
519#else
520 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> 513 // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
521 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, 514 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
522#endif
523 .needs_tvaudio = 1, 515 .needs_tvaudio = 1,
524 .pll = PLL_28, 516 .pll = PLL_28,
525 .tuner_type = -1, 517 .tuner_type = -1,
@@ -766,14 +758,9 @@ struct tvcard bttv_tvcards[] = {
766 .tuner = 0, 758 .tuner = 0,
767 .svhs = 2, 759 .svhs = 2,
768 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector 760 .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
769#if 0
770 .gpiomask = 0xc33000,
771 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
772#else
773 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ 761 /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
774 .gpiomask = 0xb33000, 762 .gpiomask = 0xb33000,
775 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, 763 .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 },
776#endif
777 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) 764 /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
778 gpio23 -- hef4052:nEnable (0x800000) 765 gpio23 -- hef4052:nEnable (0x800000)
779 gpio12 -- hef4052:A1 766 gpio12 -- hef4052:A1
@@ -1603,20 +1590,11 @@ struct tvcard bttv_tvcards[] = {
1603 .video_inputs = 4, 1590 .video_inputs = 4,
1604 .audio_inputs = 1, 1591 .audio_inputs = 1,
1605 .tuner = -1, 1592 .tuner = -1,
1606#if 0 /* TODO ... */
1607 .svhs = OSPREY540_SVID_ANALOG,
1608 .muxsel = { [OSPREY540_COMP_ANALOG] = 2,
1609 [OSPREY540_SVID_ANALOG] = 3, },
1610#endif
1611 .pll = PLL_28, 1593 .pll = PLL_28,
1612 .tuner_type = -1, 1594 .tuner_type = -1,
1613 .no_msp34xx = 1, 1595 .no_msp34xx = 1,
1614 .no_tda9875 = 1, 1596 .no_tda9875 = 1,
1615 .no_tda7432 = 1, 1597 .no_tda7432 = 1,
1616#if 0 /* TODO ... */
1617 .muxsel_hook = osprey_540_muxsel,
1618 .picture_hook = osprey_540_set_picture,
1619#endif
1620},{ 1598},{
1621 1599
1622 /* ---- card 0x5C ---------------------------------- */ 1600 /* ---- card 0x5C ---------------------------------- */
@@ -2546,21 +2524,12 @@ static void eagle_muxsel(struct bttv *btv, unsigned int input)
2546 btaor((2)<<5, ~(3<<5), BT848_IFORM); 2524 btaor((2)<<5, ~(3<<5), BT848_IFORM);
2547 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]); 2525 gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
2548 2526
2549#if 0
2550 /* svhs */
2551 /* wake chroma ADC */
2552 btand(~BT848_ADC_C_SLEEP, BT848_ADC);
2553 /* set to YC video */
2554 btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
2555 btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
2556#else
2557 /* composite */ 2527 /* composite */
2558 /* set chroma ADC to sleep */ 2528 /* set chroma ADC to sleep */
2559 btor(BT848_ADC_C_SLEEP, BT848_ADC); 2529 btor(BT848_ADC_C_SLEEP, BT848_ADC);
2560 /* set to composite video */ 2530 /* set to composite video */
2561 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL); 2531 btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
2562 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL); 2532 btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
2563#endif
2564 2533
2565 /* switch sync drive off */ 2534 /* switch sync drive off */
2566 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE); 2535 gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
@@ -2813,10 +2782,18 @@ void __devinit bttv_init_card2(struct bttv *btv)
2813 btv->tuner_type = tuner[btv->c.nr]; 2782 btv->tuner_type = tuner[btv->c.nr];
2814 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); 2783 printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
2815 if (btv->pinnacle_id != UNSET) 2784 if (btv->pinnacle_id != UNSET)
2816 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, 2785 bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
2817 &btv->pinnacle_id); 2786 &btv->pinnacle_id);
2818 if (btv->tuner_type != UNSET) 2787 if (btv->tuner_type != UNSET) {
2819 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); 2788 struct tuner_setup tun_setup;
2789
2790 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
2791 tun_setup.type = btv->tuner_type;
2792 tun_setup.addr = ADDR_UNSET;
2793
2794 bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
2795 }
2796
2820 btv->svhs = bttv_tvcards[btv->c.type].svhs; 2797 btv->svhs = bttv_tvcards[btv->c.type].svhs;
2821 if (svhs[btv->c.nr] != UNSET) 2798 if (svhs[btv->c.nr] != UNSET)
2822 btv->svhs = svhs[btv->c.nr]; 2799 btv->svhs = svhs[btv->c.nr];
@@ -3125,14 +3102,6 @@ static int tuner_0_table[] = {
3125 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, 3102 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3126 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, 3103 TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
3127 TUNER_PHILIPS_FM1216ME_MK3 }; 3104 TUNER_PHILIPS_FM1216ME_MK3 };
3128#if 0
3129int tuner_0_fm_table[] = {
3130 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
3131 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3132 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
3133 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
3134 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
3135#endif
3136 3105
3137static int tuner_1_table[] = { 3106static int tuner_1_table[] = {
3138 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, 3107 TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL,
@@ -3218,36 +3187,6 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3218 3187
3219static void __devinit boot_bt832(struct bttv *btv) 3188static void __devinit boot_bt832(struct bttv *btv)
3220{ 3189{
3221#if 0 /* not working yet */
3222 int resetbit=0;
3223
3224 switch (btv->c.type) {
3225 case BTTV_PXELVWPLTVPAK:
3226 resetbit = 0x400000;
3227 break;
3228 case BTTV_MODTEC_205:
3229 resetbit = 1<<9;
3230 break;
3231 default:
3232 BUG();
3233 }
3234
3235 request_module("bt832");
3236 bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
3237
3238 printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
3239 gpio_write(0);
3240 gpio_inout(resetbit, resetbit);
3241 udelay(5);
3242 gpio_bits(resetbit, resetbit);
3243 udelay(5);
3244 gpio_bits(resetbit, 0);
3245 udelay(5);
3246
3247 // bt832 on pixelview changes from i2c 0x8a to 0x88 after
3248 // being reset as above. So we must follow by this:
3249 bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
3250#endif
3251} 3190}
3252 3191
3253/* ----------------------------------------------------------------------- */ 3192/* ----------------------------------------------------------------------- */
@@ -3572,11 +3511,6 @@ void tea5757_set_freq(struct bttv *btv, unsigned short freq)
3572{ 3511{
3573 dprintk("tea5757_set_freq %d\n",freq); 3512 dprintk("tea5757_set_freq %d\n",freq);
3574 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ 3513 tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
3575#if 0
3576 /* breaks Miro PCTV */
3577 value = tea5757_read(btv);
3578 dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
3579#endif
3580} 3514}
3581 3515
3582 3516
@@ -3656,13 +3590,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
3656{ 3590{
3657 unsigned int val, con; 3591 unsigned int val, con;
3658 3592
3659#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3660 if (btv->radio_user) 3593 if (btv->radio_user)
3661 return; 3594 return;
3662#else
3663 if (btv->radio)
3664 return;
3665#endif
3666 3595
3667 val = gpio_read(); 3596 val = gpio_read();
3668 if (set) { 3597 if (set) {
@@ -3851,13 +3780,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
3851{ 3780{
3852 unsigned int val = 0; 3781 unsigned int val = 0;
3853 3782
3854#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3855 if (btv->radio_user) 3783 if (btv->radio_user)
3856 return; 3784 return;
3857#else
3858 if (btv->radio)
3859 return;
3860#endif
3861 3785
3862 if (set) { 3786 if (set) {
3863 if (v->mode & VIDEO_SOUND_MONO) { 3787 if (v->mode & VIDEO_SOUND_MONO) {
@@ -3888,13 +3812,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
3888{ 3812{
3889 unsigned int val = 0xffff; 3813 unsigned int val = 0xffff;
3890 3814
3891#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
3892 if (btv->radio_user) 3815 if (btv->radio_user)
3893 return; 3816 return;
3894#else
3895 if (btv->radio)
3896 return;
3897#endif
3898 if (set) { 3817 if (set) {
3899 if (v->mode & VIDEO_SOUND_MONO) { 3818 if (v->mode & VIDEO_SOUND_MONO) {
3900 val = 0x0000; 3819 val = 0x0000;
@@ -4371,11 +4290,6 @@ void __devinit bttv_check_chipset(void)
4371 latency = 0x0A; 4290 latency = 0x0A;
4372#endif 4291#endif
4373 4292
4374#if 0
4375 /* print which chipset we have */
4376 while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
4377 printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
4378#endif
4379 4293
4380 /* print warnings about any quirks found */ 4294 /* print warnings about any quirks found */
4381 if (triton1) 4295 if (triton1)
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 7d62b394c509..51a0f6d68e73 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $ 2 $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -35,6 +35,7 @@
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <linux/kdev_t.h> 37#include <linux/kdev_t.h>
38#include <linux/dma-mapping.h>
38 39
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/byteorder.h> 41#include <asm/byteorder.h>
@@ -698,12 +699,10 @@ int locked_btres(struct bttv *btv, int bit)
698static 699static
699void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) 700void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
700{ 701{
701#if 1 /* DEBUG */
702 if ((fh->resources & bits) != bits) { 702 if ((fh->resources & bits) != bits) {
703 /* trying to free ressources not allocated by us ... */ 703 /* trying to free ressources not allocated by us ... */
704 printk("bttv: BUG! (btres)\n"); 704 printk("bttv: BUG! (btres)\n");
705 } 705 }
706#endif
707 down(&btv->reslock); 706 down(&btv->reslock);
708 fh->resources &= ~bits; 707 fh->resources &= ~bits;
709 btv->resources &= ~bits; 708 btv->resources &= ~bits;
@@ -943,11 +942,6 @@ audio_mux(struct bttv *btv, int mode)
943 i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; 942 i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio;
944 if (btv->opt_automute && !signal && !btv->radio_user) 943 if (btv->opt_automute && !signal && !btv->radio_user)
945 mux = AUDIO_OFF; 944 mux = AUDIO_OFF;
946#if 0
947 printk("bttv%d: amux: mode=%d audio=%d signal=%s mux=%d/%d irq=%s\n",
948 btv->c.nr, mode, btv->audio, signal ? "yes" : "no",
949 mux, i2c_mux, in_interrupt() ? "yes" : "no");
950#endif
951 945
952 val = bttv_tvcards[btv->c.type].audiomux[mux]; 946 val = bttv_tvcards[btv->c.type].audiomux[mux];
953 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); 947 gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val);
@@ -994,11 +988,6 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
994 case BTTV_VOODOOTV_FM: 988 case BTTV_VOODOOTV_FM:
995 bttv_tda9880_setnorm(btv,norm); 989 bttv_tda9880_setnorm(btv,norm);
996 break; 990 break;
997#if 0
998 case BTTV_OSPREY540:
999 osprey_540_set_norm(btv,norm);
1000 break;
1001#endif
1002 } 991 }
1003 return 0; 992 return 0;
1004} 993}
@@ -1849,7 +1838,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1849 1838
1850 if (unlikely(f->tuner != 0)) 1839 if (unlikely(f->tuner != 0))
1851 return -EINVAL; 1840 return -EINVAL;
1852 if (unlikely(f->type != V4L2_TUNER_ANALOG_TV)) 1841 if (unlikely (f->type != V4L2_TUNER_ANALOG_TV))
1853 return -EINVAL; 1842 return -EINVAL;
1854 down(&btv->lock); 1843 down(&btv->lock);
1855 btv->freq = f->frequency; 1844 btv->freq = f->frequency;
@@ -3865,7 +3854,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3865 btv->c.nr); 3854 btv->c.nr);
3866 return -EIO; 3855 return -EIO;
3867 } 3856 }
3868 if (pci_set_dma_mask(dev, 0xffffffff)) { 3857 if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
3869 printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", 3858 printk(KERN_WARNING "bttv%d: No suitable DMA available.\n",
3870 btv->c.nr); 3859 btv->c.nr);
3871 return -EIO; 3860 return -EIO;
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index da448a5f9e9c..234a85563769 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-i2c.c,v 1.21 2005/06/10 17:20:24 mchehab Exp $ 2 $Id: bttv-i2c.c,v 1.25 2005/07/05 17:37:35 nsh Exp $
3 3
4 bttv-i2c.c -- all the i2c code is here 4 bttv-i2c.c -- all the i2c code is here
5 5
@@ -295,14 +295,26 @@ static int attach_inform(struct i2c_client *client)
295{ 295{
296 struct bttv *btv = i2c_get_adapdata(client->adapter); 296 struct bttv *btv = i2c_get_adapdata(client->adapter);
297 297
298 if (btv->tuner_type != UNSET) 298 if (bttv_debug)
299 bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); 299 printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
300 btv->c.nr,client->driver->name,client->addr,
301 i2c_clientname(client));
302 if (!client->driver->command)
303 return 0;
304
305 if (btv->tuner_type != UNSET) {
306 struct tuner_setup tun_setup;
307
308 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
309 tun_setup.type = btv->tuner_type;
310 tun_setup.addr = ADDR_UNSET;
311
312 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
313 }
314
300 if (btv->pinnacle_id != UNSET) 315 if (btv->pinnacle_id != UNSET)
301 bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, 316 client->driver->command(client,AUDC_CONFIG_PINNACLE,
302 &btv->pinnacle_id); 317 &btv->pinnacle_id);
303 if (bttv_debug)
304 printk("bttv%d: i2c attach [client=%s]\n",
305 btv->c.nr, i2c_clientname(client));
306 return 0; 318 return 0;
307} 319}
308 320
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
index bdc5ce6c43b9..9ed21fd190c6 100644
--- a/drivers/media/video/bttv-risc.c
+++ b/drivers/media/video/bttv-risc.c
@@ -334,10 +334,6 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
334 } 334 }
335 335
336 vdelay = tvnorm->vdelay; 336 vdelay = tvnorm->vdelay;
337#if 0 /* FIXME */
338 if (vdelay < btv->vbi.lines*2)
339 vdelay = btv->vbi.lines*2;
340#endif
341 337
342 xsf = (width*scaledtwidth)/swidth; 338 xsf = (width*scaledtwidth)/swidth;
343 geo->hscale = ((totalwidth*4096UL)/xsf-4096); 339 geo->hscale = ((totalwidth*4096UL)/xsf-4096);
@@ -776,13 +772,8 @@ bttv_overlay_risc(struct bttv *btv,
776 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0); 772 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0);
777 break; 773 break;
778 case V4L2_FIELD_INTERLACED: 774 case V4L2_FIELD_INTERLACED:
779#if 0
780 bttv_risc_overlay(btv, &buf->top, fmt, ov, 1, 0);
781 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 1);
782#else
783 bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1); 775 bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1);
784 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0); 776 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0);
785#endif
786 break; 777 break;
787 default: 778 default:
788 BUG(); 779 BUG();
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 91f8afeded88..4f39688f780a 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -690,11 +690,9 @@ static void blackbird_codec_settings(struct cx8802_dev *dev)
690 int bitrate_mode = 1; 690 int bitrate_mode = 1;
691 int bitrate = 7500000; 691 int bitrate = 7500000;
692 int bitrate_peak = 7500000; 692 int bitrate_peak = 7500000;
693#if 1
694 bitrate_mode = BLACKBIRD_VIDEO_CBR; 693 bitrate_mode = BLACKBIRD_VIDEO_CBR;
695 bitrate = 4000*1024; 694 bitrate = 4000*1024;
696 bitrate_peak = 4000*1024; 695 bitrate_peak = 4000*1024;
697#endif
698 696
699 /* assign stream type */ 697 /* assign stream type */
700 blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); 698 blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM);
@@ -810,9 +808,6 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
810 cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */ 808 cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */
811 cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */ 809 cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */
812 810
813#if 0 /* FIXME */
814 set_scale(dev, 720, 480, V4L2_FIELD_INTERLACED);
815#endif
816 blackbird_codec_settings(dev); 811 blackbird_codec_settings(dev);
817 msleep(1); 812 msleep(1);
818 813
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 96cb0ff33bbd..5e868f5cd0c0 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-core.c,v 1.31 2005/06/22 22:58:04 mchehab Exp $ 2 * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * driver core 5 * driver core
@@ -470,25 +470,6 @@ int cx88_risc_decode(u32 risc)
470 return incr[risc >> 28] ? incr[risc >> 28] : 1; 470 return incr[risc >> 28] ? incr[risc >> 28] : 1;
471} 471}
472 472
473#if 0 /* currently unused, but useful for debugging */
474void cx88_risc_disasm(struct cx88_core *core,
475 struct btcx_riscmem *risc)
476{
477 unsigned int i,j,n;
478
479 printk("%s: risc disasm: %p [dma=0x%08lx]\n",
480 core->name, risc->cpu, (unsigned long)risc->dma);
481 for (i = 0; i < (risc->size >> 2); i += n) {
482 printk("%s: %04d: ", core->name, i);
483 n = cx88_risc_decode(risc->cpu[i]);
484 for (j = 1; j < n; j++)
485 printk("%s: %04d: 0x%08x [ arg #%d ]\n",
486 core->name, i+j, risc->cpu[i+j], j);
487 if (risc->cpu[i] == RISC_JUMP)
488 break;
489 }
490}
491#endif
492 473
493void cx88_sram_channel_dump(struct cx88_core *core, 474void cx88_sram_channel_dump(struct cx88_core *core,
494 struct sram_channel *ch) 475 struct sram_channel *ch)
@@ -545,30 +526,12 @@ void cx88_sram_channel_dump(struct cx88_core *core,
545 core->name,cx_read(ch->cnt2_reg)); 526 core->name,cx_read(ch->cnt2_reg));
546} 527}
547 528
548/* Used only on cx88-core */
549static char *cx88_pci_irqs[32] = { 529static char *cx88_pci_irqs[32] = {
550 "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1", 530 "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
551 "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err", 531 "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
552 "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", 532 "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
553 "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" 533 "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
554}; 534};
555/* Used only on cx88-video */
556char *cx88_vid_irqs[32] = {
557 "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
558 "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
559 "y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
560 "y_sync", "u_sync", "v_sync", "vbi_sync",
561 "opc_err", "par_err", "rip_err", "pci_abort",
562};
563/* Used only on cx88-mpeg */
564char *cx88_mpeg_irqs[32] = {
565 "ts_risci1", NULL, NULL, NULL,
566 "ts_risci2", NULL, NULL, NULL,
567 "ts_oflow", NULL, NULL, NULL,
568 "ts_sync", NULL, NULL, NULL,
569 "opc_err", "par_err", "rip_err", "pci_abort",
570 "ts_err?",
571};
572 535
573void cx88_print_irqbits(char *name, char *tag, char **strings, 536void cx88_print_irqbits(char *name, char *tag, char **strings,
574 u32 bits, u32 mask) 537 u32 bits, u32 mask)
@@ -618,16 +581,11 @@ void cx88_wakeup(struct cx88_core *core,
618 break; 581 break;
619 buf = list_entry(q->active.next, 582 buf = list_entry(q->active.next,
620 struct cx88_buffer, vb.queue); 583 struct cx88_buffer, vb.queue);
621#if 0
622 if (buf->count > count)
623 break;
624#else
625 /* count comes from the hw and is is 16bit wide -- 584 /* count comes from the hw and is is 16bit wide --
626 * this trick handles wrap-arounds correctly for 585 * this trick handles wrap-arounds correctly for
627 * up to 32767 buffers in flight... */ 586 * up to 32767 buffers in flight... */
628 if ((s16) (count - buf->count) < 0) 587 if ((s16) (count - buf->count) < 0)
629 break; 588 break;
630#endif
631 do_gettimeofday(&buf->vb.ts); 589 do_gettimeofday(&buf->vb.ts);
632 dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, 590 dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i,
633 count, buf->count); 591 count, buf->count);
@@ -955,12 +913,10 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm)
955 norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); 913 norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
956 cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat); 914 cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat);
957 915
958#if 1
959 // FIXME: as-is from DScaler 916 // FIXME: as-is from DScaler
960 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", 917 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
961 norm->cxoformat, cx_read(MO_OUTPUT_FORMAT)); 918 norm->cxoformat, cx_read(MO_OUTPUT_FORMAT));
962 cx_write(MO_OUTPUT_FORMAT, norm->cxoformat); 919 cx_write(MO_OUTPUT_FORMAT, norm->cxoformat);
963#endif
964 920
965 // MO_SCONV_REG = adc clock / video dec clock * 2^17 921 // MO_SCONV_REG = adc clock / video dec clock * 2^17
966 tmp64 = adc_clock * (u64)(1 << 17); 922 tmp64 = adc_clock * (u64)(1 << 17);
@@ -1219,8 +1175,6 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
1219/* ------------------------------------------------------------------ */ 1175/* ------------------------------------------------------------------ */
1220 1176
1221EXPORT_SYMBOL(cx88_print_ioctl); 1177EXPORT_SYMBOL(cx88_print_ioctl);
1222EXPORT_SYMBOL(cx88_vid_irqs);
1223EXPORT_SYMBOL(cx88_mpeg_irqs);
1224EXPORT_SYMBOL(cx88_print_irqbits); 1178EXPORT_SYMBOL(cx88_print_irqbits);
1225 1179
1226EXPORT_SYMBOL(cx88_core_irq); 1180EXPORT_SYMBOL(cx88_core_irq);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 690477a67917..8db68f2d1351 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-dvb.c,v 1.39 2005/07/02 20:00:46 mkrufky Exp $ 2 * $Id: cx88-dvb.c,v 1.41 2005/07/04 19:35:05 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * MPEG Transport Stream (DVB) routines 5 * MPEG Transport Stream (DVB) routines
@@ -30,22 +30,25 @@
30#include <linux/file.h> 30#include <linux/file.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32 32
33/* these three frontends need merging via linuxtv cvs ... */ 33#define CONFIG_DVB_MT352 1
34#define HAVE_CX22702 1 34#define CONFIG_DVB_CX22702 1
35#define HAVE_OR51132 1 35#define CONFIG_DVB_OR51132 1
36#define HAVE_LGDT3302 1 36#define CONFIG_DVB_LGDT3302 1
37 37
38#include "cx88.h" 38#include "cx88.h"
39#include "dvb-pll.h" 39#include "dvb-pll.h"
40#include "mt352.h" 40
41#include "mt352_priv.h" 41#if CONFIG_DVB_MT352
42#if HAVE_CX22702 42# include "mt352.h"
43# include "mt352_priv.h"
44#endif
45#if CONFIG_DVB_CX22702
43# include "cx22702.h" 46# include "cx22702.h"
44#endif 47#endif
45#if HAVE_OR51132 48#if CONFIG_DVB_OR51132
46# include "or51132.h" 49# include "or51132.h"
47#endif 50#endif
48#if HAVE_LGDT3302 51#if CONFIG_DVB_LGDT3302
49# include "lgdt3302.h" 52# include "lgdt3302.h"
50#endif 53#endif
51 54
@@ -104,6 +107,7 @@ static struct videobuf_queue_ops dvb_qops = {
104 107
105/* ------------------------------------------------------------------ */ 108/* ------------------------------------------------------------------ */
106 109
110#if CONFIG_DVB_MT352
107static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) 111static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
108{ 112{
109 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 113 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
@@ -171,8 +175,9 @@ static struct mt352_config dntv_live_dvbt_config = {
171 .demod_init = dntv_live_dvbt_demod_init, 175 .demod_init = dntv_live_dvbt_demod_init,
172 .pll_set = mt352_pll_set, 176 .pll_set = mt352_pll_set,
173}; 177};
178#endif
174 179
175#if HAVE_CX22702 180#if CONFIG_DVB_CX22702
176static struct cx22702_config connexant_refboard_config = { 181static struct cx22702_config connexant_refboard_config = {
177 .demod_address = 0x43, 182 .demod_address = 0x43,
178 .pll_address = 0x60, 183 .pll_address = 0x60,
@@ -186,7 +191,7 @@ static struct cx22702_config hauppauge_novat_config = {
186}; 191};
187#endif 192#endif
188 193
189#if HAVE_OR51132 194#if CONFIG_DVB_OR51132
190static int or51132_set_ts_param(struct dvb_frontend* fe, 195static int or51132_set_ts_param(struct dvb_frontend* fe,
191 int is_punctured) 196 int is_punctured)
192{ 197{
@@ -203,7 +208,7 @@ static struct or51132_config pchdtv_hd3000 = {
203}; 208};
204#endif 209#endif
205 210
206#if HAVE_LGDT3302 211#if CONFIG_DVB_LGDT3302
207static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) 212static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
208{ 213{
209 struct cx8802_dev *dev= fe->dvb->priv; 214 struct cx8802_dev *dev= fe->dvb->priv;
@@ -237,7 +242,7 @@ static int dvb_register(struct cx8802_dev *dev)
237 242
238 /* init frontend */ 243 /* init frontend */
239 switch (dev->core->board) { 244 switch (dev->core->board) {
240#if HAVE_CX22702 245#if CONFIG_DVB_CX22702
241 case CX88_BOARD_HAUPPAUGE_DVB_T1: 246 case CX88_BOARD_HAUPPAUGE_DVB_T1:
242 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, 247 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
243 &dev->core->i2c_adap); 248 &dev->core->i2c_adap);
@@ -248,6 +253,7 @@ static int dvb_register(struct cx8802_dev *dev)
248 &dev->core->i2c_adap); 253 &dev->core->i2c_adap);
249 break; 254 break;
250#endif 255#endif
256#if CONFIG_DVB_MT352
251 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: 257 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
252 dev->core->pll_addr = 0x61; 258 dev->core->pll_addr = 0x61;
253 dev->core->pll_desc = &dvb_pll_lg_z201; 259 dev->core->pll_desc = &dvb_pll_lg_z201;
@@ -268,13 +274,14 @@ static int dvb_register(struct cx8802_dev *dev)
268 dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, 274 dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config,
269 &dev->core->i2c_adap); 275 &dev->core->i2c_adap);
270 break; 276 break;
271#if HAVE_OR51132 277#endif
278#if CONFIG_DVB_OR51132
272 case CX88_BOARD_PCHDTV_HD3000: 279 case CX88_BOARD_PCHDTV_HD3000:
273 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, 280 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
274 &dev->core->i2c_adap); 281 &dev->core->i2c_adap);
275 break; 282 break;
276#endif 283#endif
277#if HAVE_LGDT3302 284#if CONFIG_DVB_LGDT3302
278 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 285 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
279 dev->ts_gen_cntrl = 0x08; 286 dev->ts_gen_cntrl = 0x08;
280 { 287 {
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index b5342234b305..8403c4e95050 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: cx88-i2c.c,v 1.24 2005/06/17 18:46:23 mkrufky Exp $ 2 $Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $
3 3
4 cx88-i2c.c -- all the i2c code is here 4 cx88-i2c.c -- all the i2c code is here
5 5
@@ -91,25 +91,32 @@ static int cx8800_bit_getsda(void *data)
91 91
92static int attach_inform(struct i2c_client *client) 92static int attach_inform(struct i2c_client *client)
93{ 93{
94 struct tuner_addr tun_addr; 94 struct tuner_setup tun_setup;
95 struct cx88_core *core = i2c_get_adapdata(client->adapter); 95 struct cx88_core *core = i2c_get_adapdata(client->adapter);
96 96
97 dprintk(1, "i2c attach [addr=0x%x,client=%s]\n", 97 dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
98 client->addr, i2c_clientname(client)); 98 client->driver->name,client->addr,i2c_clientname(client));
99 if (!client->driver->command) 99 if (!client->driver->command)
100 return 0; 100 return 0;
101 101
102 if (core->radio_type != UNSET) { 102 if (core->radio_type != UNSET) {
103 tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; 103 if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) {
104 tun_addr.type = core->radio_type; 104 tun_setup.mode_mask = T_RADIO;
105 tun_addr.addr = core->radio_addr; 105 tun_setup.type = core->radio_type;
106 client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); 106 tun_setup.addr = core->radio_addr;
107
108 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
109 }
107 } 110 }
108 if (core->tuner_type != UNSET) { 111 if (core->tuner_type != UNSET) {
109 tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; 112 if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) {
110 tun_addr.type = core->tuner_type; 113
111 tun_addr.addr = core->tuner_addr; 114 tun_setup.mode_mask = T_ANALOG_TV;
112 client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); 115 tun_setup.type = core->tuner_type;
116 tun_setup.addr = core->tuner_addr;
117
118 client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup);
119 }
113 } 120 }
114 121
115 if (core->tda9887_conf) 122 if (core->tda9887_conf)
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index bdc26e75ab5f..214887798192 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-input.c,v 1.13 2005/06/13 16:07:46 nsh Exp $ 2 * $Id: cx88-input.c,v 1.15 2005/07/07 13:58:38 mchehab Exp $
3 * 3 *
4 * Device driver for GPIO attached remote control interfaces 4 * Device driver for GPIO attached remote control interfaces
5 * on Conexant 2388x based TV/DVB cards. 5 * on Conexant 2388x based TV/DVB cards.
@@ -38,199 +38,206 @@
38 38
39/* DigitalNow DNTV Live DVB-T Remote */ 39/* DigitalNow DNTV Live DVB-T Remote */
40static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { 40static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = {
41 [ 0x00 ] = KEY_ESC, // 'go up a level?' 41 [0x00] = KEY_ESC, /* 'go up a level?' */
42 [ 0x01 ] = KEY_KP1, // '1' 42 /* Keys 0 to 9 */
43 [ 0x02 ] = KEY_KP2, // '2' 43 [0x0a] = KEY_KP0,
44 [ 0x03 ] = KEY_KP3, // '3' 44 [0x01] = KEY_KP1,
45 [ 0x04 ] = KEY_KP4, // '4' 45 [0x02] = KEY_KP2,
46 [ 0x05 ] = KEY_KP5, // '5' 46 [0x03] = KEY_KP3,
47 [ 0x06 ] = KEY_KP6, // '6' 47 [0x04] = KEY_KP4,
48 [ 0x07 ] = KEY_KP7, // '7' 48 [0x05] = KEY_KP5,
49 [ 0x08 ] = KEY_KP8, // '8' 49 [0x06] = KEY_KP6,
50 [ 0x09 ] = KEY_KP9, // '9' 50 [0x07] = KEY_KP7,
51 [ 0x0a ] = KEY_KP0, // '0' 51 [0x08] = KEY_KP8,
52 [ 0x0b ] = KEY_TUNER, // 'tv/fm' 52 [0x09] = KEY_KP9,
53 [ 0x0c ] = KEY_SEARCH, // 'scan' 53
54 [ 0x0d ] = KEY_STOP, // 'stop' 54 [0x0b] = KEY_TUNER, /* tv/fm */
55 [ 0x0e ] = KEY_PAUSE, // 'pause' 55 [0x0c] = KEY_SEARCH, /* scan */
56 [ 0x0f ] = KEY_LIST, // 'source' 56 [0x0d] = KEY_STOP,
57 57 [0x0e] = KEY_PAUSE,
58 [ 0x10 ] = KEY_MUTE, // 'mute' 58 [0x0f] = KEY_LIST, /* source */
59 [ 0x11 ] = KEY_REWIND, // 'backward <<' 59
60 [ 0x12 ] = KEY_POWER, // 'power' 60 [0x10] = KEY_MUTE,
61 [ 0x13 ] = KEY_S, // 'snap' 61 [0x11] = KEY_REWIND, /* backward << */
62 [ 0x14 ] = KEY_AUDIO, // 'stereo' 62 [0x12] = KEY_POWER,
63 [ 0x15 ] = KEY_CLEAR, // 'reset' 63 [0x13] = KEY_S, /* snap */
64 [ 0x16 ] = KEY_PLAY, // 'play' 64 [0x14] = KEY_AUDIO, /* stereo */
65 [ 0x17 ] = KEY_ENTER, // 'enter' 65 [0x15] = KEY_CLEAR, /* reset */
66 [ 0x18 ] = KEY_ZOOM, // 'full screen' 66 [0x16] = KEY_PLAY,
67 [ 0x19 ] = KEY_FASTFORWARD, // 'forward >>' 67 [0x17] = KEY_ENTER,
68 [ 0x1a ] = KEY_CHANNELUP, // 'channel +' 68 [0x18] = KEY_ZOOM, /* full screen */
69 [ 0x1b ] = KEY_VOLUMEUP, // 'volume +' 69 [0x19] = KEY_FASTFORWARD, /* forward >> */
70 [ 0x1c ] = KEY_INFO, // 'preview' 70 [0x1a] = KEY_CHANNELUP,
71 [ 0x1d ] = KEY_RECORD, // 'record' 71 [0x1b] = KEY_VOLUMEUP,
72 [ 0x1e ] = KEY_CHANNELDOWN, // 'channel -' 72 [0x1c] = KEY_INFO, /* preview */
73 [ 0x1f ] = KEY_VOLUMEDOWN, // 'volume -' 73 [0x1d] = KEY_RECORD, /* record */
74 [0x1e] = KEY_CHANNELDOWN,
75 [0x1f] = KEY_VOLUMEDOWN,
74}; 76};
75 77
76/* ---------------------------------------------------------------------- */ 78/* ---------------------------------------------------------------------- */
77 79
78/* IO-DATA BCTV7E Remote */ 80/* IO-DATA BCTV7E Remote */
79static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = { 81static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = {
80 [ 0x40 ] = KEY_TV, // TV 82 [0x40] = KEY_TV,
81 [ 0x20 ] = KEY_RADIO, // FM 83 [0x20] = KEY_RADIO, /* FM */
82 [ 0x60 ] = KEY_EPG, // EPG 84 [0x60] = KEY_EPG,
83 [ 0x00 ] = KEY_POWER, // power 85 [0x00] = KEY_POWER,
84 86
85 [ 0x50 ] = KEY_KP1, // 1 87 /* Keys 0 to 9 */
86 [ 0x30 ] = KEY_KP2, // 2 88 [0x44] = KEY_KP0, /* 10 */
87 [ 0x70 ] = KEY_KP3, // 3 89 [0x50] = KEY_KP1,
88 [ 0x10 ] = KEY_L, // Live 90 [0x30] = KEY_KP2,
89 91 [0x70] = KEY_KP3,
90 [ 0x48 ] = KEY_KP4, // 4 92 [0x48] = KEY_KP4,
91 [ 0x28 ] = KEY_KP5, // 5 93 [0x28] = KEY_KP5,
92 [ 0x68 ] = KEY_KP6, // 6 94 [0x68] = KEY_KP6,
93 [ 0x08 ] = KEY_T, // Time Shift 95 [0x58] = KEY_KP7,
94 96 [0x38] = KEY_KP8,
95 [ 0x58 ] = KEY_KP7, // 7 97 [0x78] = KEY_KP9,
96 [ 0x38 ] = KEY_KP8, // 8 98
97 [ 0x78 ] = KEY_KP9, // 9 99 [0x10] = KEY_L, /* Live */
98 [ 0x18 ] = KEY_PLAYPAUSE, // Play 100 [0x08] = KEY_T, /* Time Shift */
99 101
100 [ 0x44 ] = KEY_KP0, // 10 102 [0x18] = KEY_PLAYPAUSE, /* Play */
101 [ 0x24 ] = KEY_ENTER, // 11 103
102 [ 0x64 ] = KEY_ESC, // 12 104 [0x24] = KEY_ENTER, /* 11 */
103 [ 0x04 ] = KEY_M, // Multi 105 [0x64] = KEY_ESC, /* 12 */
104 106 [0x04] = KEY_M, /* Multi */
105 [ 0x54 ] = KEY_VIDEO, // VIDEO 107
106 [ 0x34 ] = KEY_CHANNELUP, // channel + 108 [0x54] = KEY_VIDEO,
107 [ 0x74 ] = KEY_VOLUMEUP, // volume + 109 [0x34] = KEY_CHANNELUP,
108 [ 0x14 ] = KEY_MUTE, // Mute 110 [0x74] = KEY_VOLUMEUP,
109 111 [0x14] = KEY_MUTE,
110 [ 0x4c ] = KEY_S, // SVIDEO 112
111 [ 0x2c ] = KEY_CHANNELDOWN, // channel - 113 [0x4c] = KEY_S, /* SVIDEO */
112 [ 0x6c ] = KEY_VOLUMEDOWN, // volume - 114 [0x2c] = KEY_CHANNELDOWN,
113 [ 0x0c ] = KEY_ZOOM, // Zoom 115 [0x6c] = KEY_VOLUMEDOWN,
114 116 [0x0c] = KEY_ZOOM,
115 [ 0x5c ] = KEY_PAUSE, // pause 117
116 [ 0x3c ] = KEY_C, // || (red) 118 [0x5c] = KEY_PAUSE,
117 [ 0x7c ] = KEY_RECORD, // recording 119 [0x3c] = KEY_C, /* || (red) */
118 [ 0x1c ] = KEY_STOP, // stop 120 [0x7c] = KEY_RECORD, /* recording */
119 121 [0x1c] = KEY_STOP,
120 [ 0x41 ] = KEY_REWIND, // backward << 122
121 [ 0x21 ] = KEY_PLAY, // play 123 [0x41] = KEY_REWIND, /* backward << */
122 [ 0x61 ] = KEY_FASTFORWARD, // forward >> 124 [0x21] = KEY_PLAY,
123 [ 0x01 ] = KEY_NEXT, // skip >| 125 [0x61] = KEY_FASTFORWARD, /* forward >> */
126 [0x01] = KEY_NEXT, /* skip >| */
124}; 127};
125 128
126/* ---------------------------------------------------------------------- */ 129/* ---------------------------------------------------------------------- */
127 130
128/* ADS Tech Instant TV DVB-T PCI Remote */ 131/* ADS Tech Instant TV DVB-T PCI Remote */
129static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = { 132static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = {
130 [ 0x5b ] = KEY_POWER, 133 /* Keys 0 to 9 */
131 [ 0x5f ] = KEY_MUTE, 134 [0x4d] = KEY_0,
132 [ 0x57 ] = KEY_1, 135 [0x57] = KEY_1,
133 [ 0x4f ] = KEY_2, 136 [0x4f] = KEY_2,
134 [ 0x53 ] = KEY_3, 137 [0x53] = KEY_3,
135 [ 0x56 ] = KEY_4, 138 [0x56] = KEY_4,
136 [ 0x4e ] = KEY_5, 139 [0x4e] = KEY_5,
137 [ 0x5e ] = KEY_6, 140 [0x5e] = KEY_6,
138 [ 0x54 ] = KEY_7, 141 [0x54] = KEY_7,
139 [ 0x4c ] = KEY_8, 142 [0x4c] = KEY_8,
140 [ 0x5c ] = KEY_9, 143 [0x5c] = KEY_9,
141 [ 0x4d ] = KEY_0, 144
142 [ 0x55 ] = KEY_GOTO, 145 [0x5b] = KEY_POWER,
143 [ 0x5d ] = KEY_SEARCH, 146 [0x5f] = KEY_MUTE,
144 [ 0x17 ] = KEY_EPG, // Guide 147 [0x55] = KEY_GOTO,
145 [ 0x1f ] = KEY_MENU, 148 [0x5d] = KEY_SEARCH,
146 [ 0x0f ] = KEY_UP, 149 [0x17] = KEY_EPG, /* Guide */
147 [ 0x46 ] = KEY_DOWN, 150 [0x1f] = KEY_MENU,
148 [ 0x16 ] = KEY_LEFT, 151 [0x0f] = KEY_UP,
149 [ 0x1e ] = KEY_RIGHT, 152 [0x46] = KEY_DOWN,
150 [ 0x0e ] = KEY_SELECT, // Enter 153 [0x16] = KEY_LEFT,
151 [ 0x5a ] = KEY_INFO, 154 [0x1e] = KEY_RIGHT,
152 [ 0x52 ] = KEY_EXIT, 155 [0x0e] = KEY_SELECT, /* Enter */
153 [ 0x59 ] = KEY_PREVIOUS, 156 [0x5a] = KEY_INFO,
154 [ 0x51 ] = KEY_NEXT, 157 [0x52] = KEY_EXIT,
155 [ 0x58 ] = KEY_REWIND, 158 [0x59] = KEY_PREVIOUS,
156 [ 0x50 ] = KEY_FORWARD, 159 [0x51] = KEY_NEXT,
157 [ 0x44 ] = KEY_PLAYPAUSE, 160 [0x58] = KEY_REWIND,
158 [ 0x07 ] = KEY_STOP, 161 [0x50] = KEY_FORWARD,
159 [ 0x1b ] = KEY_RECORD, 162 [0x44] = KEY_PLAYPAUSE,
160 [ 0x13 ] = KEY_TUNER, // Live 163 [0x07] = KEY_STOP,
161 [ 0x0a ] = KEY_A, 164 [0x1b] = KEY_RECORD,
162 [ 0x12 ] = KEY_B, 165 [0x13] = KEY_TUNER, /* Live */
163 [ 0x03 ] = KEY_PROG1, // 1 166 [0x0a] = KEY_A,
164 [ 0x01 ] = KEY_PROG2, // 2 167 [0x12] = KEY_B,
165 [ 0x00 ] = KEY_PROG3, // 3 168 [0x03] = KEY_PROG1, /* 1 */
166 [ 0x06 ] = KEY_DVD, 169 [0x01] = KEY_PROG2, /* 2 */
167 [ 0x48 ] = KEY_AUX, // Photo 170 [0x00] = KEY_PROG3, /* 3 */
168 [ 0x40 ] = KEY_VIDEO, 171 [0x06] = KEY_DVD,
169 [ 0x19 ] = KEY_AUDIO, // Music 172 [0x48] = KEY_AUX, /* Photo */
170 [ 0x0b ] = KEY_CHANNELUP, 173 [0x40] = KEY_VIDEO,
171 [ 0x08 ] = KEY_CHANNELDOWN, 174 [0x19] = KEY_AUDIO, /* Music */
172 [ 0x15 ] = KEY_VOLUMEUP, 175 [0x0b] = KEY_CHANNELUP,
173 [ 0x1c ] = KEY_VOLUMEDOWN, 176 [0x08] = KEY_CHANNELDOWN,
177 [0x15] = KEY_VOLUMEUP,
178 [0x1c] = KEY_VOLUMEDOWN,
174}; 179};
175 180
176/* ---------------------------------------------------------------------- */ 181/* ---------------------------------------------------------------------- */
177 182
178/* MSI TV@nywhere remote */ 183/* MSI TV@nywhere remote */
179static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { 184static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = {
180 [ 0x00 ] = KEY_0, /* '0' */ 185 /* Keys 0 to 9 */
181 [ 0x01 ] = KEY_1, /* '1' */ 186 [0x00] = KEY_0,
182 [ 0x02 ] = KEY_2, /* '2' */ 187 [0x01] = KEY_1,
183 [ 0x03 ] = KEY_3, /* '3' */ 188 [0x02] = KEY_2,
184 [ 0x04 ] = KEY_4, /* '4' */ 189 [0x03] = KEY_3,
185 [ 0x05 ] = KEY_5, /* '5' */ 190 [0x04] = KEY_4,
186 [ 0x06 ] = KEY_6, /* '6' */ 191 [0x05] = KEY_5,
187 [ 0x07 ] = KEY_7, /* '7' */ 192 [0x06] = KEY_6,
188 [ 0x08 ] = KEY_8, /* '8' */ 193 [0x07] = KEY_7,
189 [ 0x09 ] = KEY_9, /* '9' */ 194 [0x08] = KEY_8,
190 [ 0x0c ] = KEY_MUTE, /* 'Mute' */ 195 [0x09] = KEY_9,
191 [ 0x0f ] = KEY_SCREEN, /* 'Full Screen' */ 196
192 [ 0x10 ] = KEY_F, /* 'Funtion' */ 197 [0x0c] = KEY_MUTE,
193 [ 0x11 ] = KEY_T, /* 'Time shift' */ 198 [0x0f] = KEY_SCREEN, /* Full Screen */
194 [ 0x12 ] = KEY_POWER, /* 'Power' */ 199 [0x10] = KEY_F, /* Funtion */
195 [ 0x13 ] = KEY_MEDIA, /* 'MTS' */ 200 [0x11] = KEY_T, /* Time shift */
196 [ 0x14 ] = KEY_SLOW, /* 'Slow' */ 201 [0x12] = KEY_POWER,
197 [ 0x16 ] = KEY_REWIND, /* 'backward <<' */ 202 [0x13] = KEY_MEDIA, /* MTS */
198 [ 0x17 ] = KEY_ENTER, /* 'Return' */ 203 [0x14] = KEY_SLOW,
199 [ 0x18 ] = KEY_FASTFORWARD, /* 'forward >>' */ 204 [0x16] = KEY_REWIND, /* backward << */
200 [ 0x1a ] = KEY_CHANNELUP, /* 'Channel+' */ 205 [0x17] = KEY_ENTER, /* Return */
201 [ 0x1b ] = KEY_VOLUMEUP, /* 'Volume+' */ 206 [0x18] = KEY_FASTFORWARD, /* forward >> */
202 [ 0x1e ] = KEY_CHANNELDOWN, /* 'Channel-' */ 207 [0x1a] = KEY_CHANNELUP,
203 [ 0x1f ] = KEY_VOLUMEDOWN, /* 'Volume-' */ 208 [0x1b] = KEY_VOLUMEUP,
209 [0x1e] = KEY_CHANNELDOWN,
210 [0x1f] = KEY_VOLUMEDOWN,
204}; 211};
205 212
206/* ---------------------------------------------------------------------- */ 213/* ---------------------------------------------------------------------- */
207 214
208struct cx88_IR { 215struct cx88_IR {
209 struct cx88_core *core; 216 struct cx88_core *core;
210 struct input_dev input; 217 struct input_dev input;
211 struct ir_input_state ir; 218 struct ir_input_state ir;
212 char name[32]; 219 char name[32];
213 char phys[32]; 220 char phys[32];
214 221
215 /* sample from gpio pin 16 */ 222 /* sample from gpio pin 16 */
216 int sampling; 223 int sampling;
217 u32 samples[16]; 224 u32 samples[16];
218 int scount; 225 int scount;
219 unsigned long release; 226 unsigned long release;
220 227
221 /* poll external decoder */ 228 /* poll external decoder */
222 int polling; 229 int polling;
223 struct work_struct work; 230 struct work_struct work;
224 struct timer_list timer; 231 struct timer_list timer;
225 u32 gpio_addr; 232 u32 gpio_addr;
226 u32 last_gpio; 233 u32 last_gpio;
227 u32 mask_keycode; 234 u32 mask_keycode;
228 u32 mask_keydown; 235 u32 mask_keydown;
229 u32 mask_keyup; 236 u32 mask_keyup;
230}; 237};
231 238
232static int ir_debug = 0; 239static int ir_debug = 0;
233module_param(ir_debug, int, 0644); /* debug level [IR] */ 240module_param(ir_debug, int, 0644); /* debug level [IR] */
234MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); 241MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
235 242
236#define ir_dprintk(fmt, arg...) if (ir_debug) \ 243#define ir_dprintk(fmt, arg...) if (ir_debug) \
@@ -254,37 +261,37 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
254 /* extract data */ 261 /* extract data */
255 data = ir_extract_bits(gpio, ir->mask_keycode); 262 data = ir_extract_bits(gpio, ir->mask_keycode);
256 ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n", 263 ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
257 gpio, data, 264 gpio, data,
258 ir->polling ? "poll" : "irq", 265 ir->polling ? "poll" : "irq",
259 (gpio & ir->mask_keydown) ? " down" : "", 266 (gpio & ir->mask_keydown) ? " down" : "",
260 (gpio & ir->mask_keyup) ? " up" : ""); 267 (gpio & ir->mask_keyup) ? " up" : "");
261 268
262 if (ir->mask_keydown) { 269 if (ir->mask_keydown) {
263 /* bit set on keydown */ 270 /* bit set on keydown */
264 if (gpio & ir->mask_keydown) { 271 if (gpio & ir->mask_keydown) {
265 ir_input_keydown(&ir->input,&ir->ir,data,data); 272 ir_input_keydown(&ir->input, &ir->ir, data, data);
266 } else { 273 } else {
267 ir_input_nokey(&ir->input,&ir->ir); 274 ir_input_nokey(&ir->input, &ir->ir);
268 } 275 }
269 276
270 } else if (ir->mask_keyup) { 277 } else if (ir->mask_keyup) {
271 /* bit cleared on keydown */ 278 /* bit cleared on keydown */
272 if (0 == (gpio & ir->mask_keyup)) { 279 if (0 == (gpio & ir->mask_keyup)) {
273 ir_input_keydown(&ir->input,&ir->ir,data,data); 280 ir_input_keydown(&ir->input, &ir->ir, data, data);
274 } else { 281 } else {
275 ir_input_nokey(&ir->input,&ir->ir); 282 ir_input_nokey(&ir->input, &ir->ir);
276 } 283 }
277 284
278 } else { 285 } else {
279 /* can't distinguish keydown/up :-/ */ 286 /* can't distinguish keydown/up :-/ */
280 ir_input_keydown(&ir->input,&ir->ir,data,data); 287 ir_input_keydown(&ir->input, &ir->ir, data, data);
281 ir_input_nokey(&ir->input,&ir->ir); 288 ir_input_nokey(&ir->input, &ir->ir);
282 } 289 }
283} 290}
284 291
285static void ir_timer(unsigned long data) 292static void ir_timer(unsigned long data)
286{ 293{
287 struct cx88_IR *ir = (struct cx88_IR*)data; 294 struct cx88_IR *ir = (struct cx88_IR *)data;
288 295
289 schedule_work(&ir->work); 296 schedule_work(&ir->work);
290} 297}
@@ -307,62 +314,62 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
307 IR_KEYTAB_TYPE *ir_codes = NULL; 314 IR_KEYTAB_TYPE *ir_codes = NULL;
308 int ir_type = IR_TYPE_OTHER; 315 int ir_type = IR_TYPE_OTHER;
309 316
310 ir = kmalloc(sizeof(*ir),GFP_KERNEL); 317 ir = kmalloc(sizeof(*ir), GFP_KERNEL);
311 if (NULL == ir) 318 if (NULL == ir)
312 return -ENOMEM; 319 return -ENOMEM;
313 memset(ir,0,sizeof(*ir)); 320 memset(ir, 0, sizeof(*ir));
314 321
315 /* detect & configure */ 322 /* detect & configure */
316 switch (core->board) { 323 switch (core->board) {
317 case CX88_BOARD_DNTV_LIVE_DVB_T: 324 case CX88_BOARD_DNTV_LIVE_DVB_T:
318 case CX88_BOARD_KWORLD_DVB_T: 325 case CX88_BOARD_KWORLD_DVB_T:
319 ir_codes = ir_codes_dntv_live_dvb_t; 326 ir_codes = ir_codes_dntv_live_dvb_t;
320 ir->gpio_addr = MO_GP1_IO; 327 ir->gpio_addr = MO_GP1_IO;
321 ir->mask_keycode = 0x1f; 328 ir->mask_keycode = 0x1f;
322 ir->mask_keyup = 0x60; 329 ir->mask_keyup = 0x60;
323 ir->polling = 50; // ms 330 ir->polling = 50; /* ms */
324 break; 331 break;
325 case CX88_BOARD_HAUPPAUGE: 332 case CX88_BOARD_HAUPPAUGE:
326 case CX88_BOARD_HAUPPAUGE_DVB_T1: 333 case CX88_BOARD_HAUPPAUGE_DVB_T1:
327 ir_codes = ir_codes_hauppauge_new; 334 ir_codes = ir_codes_hauppauge_new;
328 ir_type = IR_TYPE_RC5; 335 ir_type = IR_TYPE_RC5;
329 ir->sampling = 1; 336 ir->sampling = 1;
330 break; 337 break;
331 case CX88_BOARD_WINFAST2000XP_EXPERT: 338 case CX88_BOARD_WINFAST2000XP_EXPERT:
332 ir_codes = ir_codes_winfast; 339 ir_codes = ir_codes_winfast;
333 ir->gpio_addr = MO_GP0_IO; 340 ir->gpio_addr = MO_GP0_IO;
334 ir->mask_keycode = 0x8f8; 341 ir->mask_keycode = 0x8f8;
335 ir->mask_keyup = 0x100; 342 ir->mask_keyup = 0x100;
336 ir->polling = 1; // ms 343 ir->polling = 1; /* ms */
337 break; 344 break;
338 case CX88_BOARD_IODATA_GVBCTV7E: 345 case CX88_BOARD_IODATA_GVBCTV7E:
339 ir_codes = ir_codes_iodata_bctv7e; 346 ir_codes = ir_codes_iodata_bctv7e;
340 ir->gpio_addr = MO_GP0_IO; 347 ir->gpio_addr = MO_GP0_IO;
341 ir->mask_keycode = 0xfd; 348 ir->mask_keycode = 0xfd;
342 ir->mask_keydown = 0x02; 349 ir->mask_keydown = 0x02;
343 ir->polling = 5; // ms 350 ir->polling = 5; /* ms */
344 break; 351 break;
345 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: 352 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
346 ir_codes = ir_codes_pixelview; 353 ir_codes = ir_codes_pixelview;
347 ir->gpio_addr = MO_GP1_IO; 354 ir->gpio_addr = MO_GP1_IO;
348 ir->mask_keycode = 0x1f; 355 ir->mask_keycode = 0x1f;
349 ir->mask_keyup = 0x80; 356 ir->mask_keyup = 0x80;
350 ir->polling = 1; // ms 357 ir->polling = 1; /* ms */
351 break; 358 break;
352 case CX88_BOARD_ADSTECH_DVB_T_PCI: 359 case CX88_BOARD_ADSTECH_DVB_T_PCI:
353 ir_codes = ir_codes_adstech_dvb_t_pci; 360 ir_codes = ir_codes_adstech_dvb_t_pci;
354 ir->gpio_addr = MO_GP1_IO; 361 ir->gpio_addr = MO_GP1_IO;
355 ir->mask_keycode = 0xbf; 362 ir->mask_keycode = 0xbf;
356 ir->mask_keyup = 0x40; 363 ir->mask_keyup = 0x40;
357 ir->polling = 50; // ms 364 ir->polling = 50; /* ms */
365 break;
366 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
367 ir_codes = ir_codes_msi_tvanywhere;
368 ir->gpio_addr = MO_GP1_IO;
369 ir->mask_keycode = 0x1f;
370 ir->mask_keyup = 0x40;
371 ir->polling = 1; /* ms */
358 break; 372 break;
359 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
360 ir_codes = ir_codes_msi_tvanywhere;
361 ir->gpio_addr = MO_GP1_IO;
362 ir->mask_keycode = 0x1f;
363 ir->mask_keyup = 0x40;
364 ir->polling = 1;
365 break;
366 } 373 }
367 374
368 if (NULL == ir_codes) { 375 if (NULL == ir_codes) {
@@ -373,8 +380,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
373 /* init input device */ 380 /* init input device */
374 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", 381 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)",
375 cx88_boards[core->board].name); 382 cx88_boards[core->board].name);
376 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 383 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
377 pci_name(pci));
378 384
379 ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); 385 ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes);
380 ir->input.name = ir->name; 386 ir->input.name = ir->name;
@@ -382,10 +388,10 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
382 ir->input.id.bustype = BUS_PCI; 388 ir->input.id.bustype = BUS_PCI;
383 ir->input.id.version = 1; 389 ir->input.id.version = 1;
384 if (pci->subsystem_vendor) { 390 if (pci->subsystem_vendor) {
385 ir->input.id.vendor = pci->subsystem_vendor; 391 ir->input.id.vendor = pci->subsystem_vendor;
386 ir->input.id.product = pci->subsystem_device; 392 ir->input.id.product = pci->subsystem_device;
387 } else { 393 } else {
388 ir->input.id.vendor = pci->vendor; 394 ir->input.id.vendor = pci->vendor;
389 ir->input.id.product = pci->device; 395 ir->input.id.product = pci->device;
390 } 396 }
391 397
@@ -397,13 +403,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
397 INIT_WORK(&ir->work, cx88_ir_work, ir); 403 INIT_WORK(&ir->work, cx88_ir_work, ir);
398 init_timer(&ir->timer); 404 init_timer(&ir->timer);
399 ir->timer.function = ir_timer; 405 ir->timer.function = ir_timer;
400 ir->timer.data = (unsigned long)ir; 406 ir->timer.data = (unsigned long)ir;
401 schedule_work(&ir->work); 407 schedule_work(&ir->work);
402 } 408 }
403 if (ir->sampling) { 409 if (ir->sampling) {
404 core->pci_irqmask |= (1<<18); // IR_SMP_INT 410 core->pci_irqmask |= (1 << 18); /* IR_SMP_INT */
405 cx_write(MO_DDS_IO, 0xa80a80); // 4 kHz sample rate 411 cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */
406 cx_write(MO_DDSCFG_IO, 0x5); // enable 412 cx_write(MO_DDSCFG_IO, 0x5); /* enable */
407 } 413 }
408 414
409 /* all done */ 415 /* all done */
@@ -439,7 +445,7 @@ int cx88_ir_fini(struct cx88_core *core)
439void cx88_ir_irq(struct cx88_core *core) 445void cx88_ir_irq(struct cx88_core *core)
440{ 446{
441 struct cx88_IR *ir = core->ir; 447 struct cx88_IR *ir = core->ir;
442 u32 samples,rc5; 448 u32 samples, rc5;
443 int i; 449 int i;
444 450
445 if (NULL == ir) 451 if (NULL == ir)
@@ -448,7 +454,7 @@ void cx88_ir_irq(struct cx88_core *core)
448 return; 454 return;
449 455
450 samples = cx_read(MO_SAMPLE_IO); 456 samples = cx_read(MO_SAMPLE_IO);
451 if (0 != samples && 0xffffffff != samples) { 457 if (0 != samples && 0xffffffff != samples) {
452 /* record sample data */ 458 /* record sample data */
453 if (ir->scount < ARRAY_SIZE(ir->samples)) 459 if (ir->scount < ARRAY_SIZE(ir->samples))
454 ir->samples[ir->scount++] = samples; 460 ir->samples[ir->scount++] = samples;
@@ -456,8 +462,8 @@ void cx88_ir_irq(struct cx88_core *core)
456 } 462 }
457 if (!ir->scount) { 463 if (!ir->scount) {
458 /* nothing to sample */ 464 /* nothing to sample */
459 if (ir->ir.keypressed && time_after(jiffies,ir->release)) 465 if (ir->ir.keypressed && time_after(jiffies, ir->release))
460 ir_input_nokey(&ir->input,&ir->ir); 466 ir_input_nokey(&ir->input, &ir->ir);
461 return; 467 return;
462 } 468 }
463 469
@@ -467,14 +473,14 @@ void cx88_ir_irq(struct cx88_core *core)
467 for (i = 0; i < ir->scount; i++) 473 for (i = 0; i < ir->scount; i++)
468 ir->samples[i] = ~ir->samples[i]; 474 ir->samples[i] = ~ir->samples[i];
469 if (ir_debug) 475 if (ir_debug)
470 ir_dump_samples(ir->samples,ir->scount); 476 ir_dump_samples(ir->samples, ir->scount);
471 477
472 /* decode it */ 478 /* decode it */
473 switch (core->board) { 479 switch (core->board) {
474 case CX88_BOARD_HAUPPAUGE: 480 case CX88_BOARD_HAUPPAUGE:
475 case CX88_BOARD_HAUPPAUGE_DVB_T1: 481 case CX88_BOARD_HAUPPAUGE_DVB_T1:
476 rc5 = ir_decode_biphase(ir->samples,ir->scount,5,7); 482 rc5 = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
477 ir_dprintk("biphase decoded: %x\n",rc5); 483 ir_dprintk("biphase decoded: %x\n", rc5);
478 if ((rc5 & 0xfffff000) != 0x3000) 484 if ((rc5 & 0xfffff000) != 0x3000)
479 break; 485 break;
480 ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); 486 ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5);
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 85da6dc8d0e0..fe2767c0ff94 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-mpeg.c,v 1.30 2005/07/05 19:44:40 mkrufky Exp $ 2 * $Id: cx88-mpeg.c,v 1.31 2005/07/07 14:17:47 mchehab Exp $
3 * 3 *
4 * Support for the mpeg transport stream transfers 4 * Support for the mpeg transport stream transfers
5 * PCI function #2 of the cx2388x. 5 * PCI function #2 of the cx2388x.
@@ -64,7 +64,6 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
64 /* write TS length to chip */ 64 /* write TS length to chip */
65 cx_write(MO_TS_LNGTH, buf->vb.width); 65 cx_write(MO_TS_LNGTH, buf->vb.width);
66 66
67#if 1
68 /* FIXME: this needs a review. 67 /* FIXME: this needs a review.
69 * also: move to cx88-blackbird + cx88-dvb source files? */ 68 * also: move to cx88-blackbird + cx88-dvb source files? */
70 69
@@ -76,9 +75,9 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
76 cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); 75 cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01);
77 if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) || 76 if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) ||
78 (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) { 77 (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) {
79 cx_write(TS_SOP_STAT, 0<<16 | 0<<14 | 1<<13 | 0<<12); 78 cx_write(TS_SOP_STAT, 1<<13);
80 } else { 79 } else {
81 cx_write(TS_SOP_STAT,0x00); 80 cx_write(TS_SOP_STAT, 0x00);
82 } 81 }
83 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); 82 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
84 udelay(100); 83 udelay(100);
@@ -98,7 +97,6 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
98 cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ 97 cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */
99 udelay(100); 98 udelay(100);
100 } 99 }
101#endif
102 100
103 /* reset counter */ 101 /* reset counter */
104 cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); 102 cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET);
@@ -270,6 +268,15 @@ static void cx8802_timeout(unsigned long data)
270 do_cancel_buffers(dev,"timeout",1); 268 do_cancel_buffers(dev,"timeout",1);
271} 269}
272 270
271static char *cx88_mpeg_irqs[32] = {
272 "ts_risci1", NULL, NULL, NULL,
273 "ts_risci2", NULL, NULL, NULL,
274 "ts_oflow", NULL, NULL, NULL,
275 "ts_sync", NULL, NULL, NULL,
276 "opc_err", "par_err", "rip_err", "pci_abort",
277 "ts_err?",
278};
279
273static void cx8802_mpeg_irq(struct cx8802_dev *dev) 280static void cx8802_mpeg_irq(struct cx8802_dev *dev)
274{ 281{
275 struct cx88_core *core = dev->core; 282 struct cx88_core *core = dev->core;
@@ -282,10 +289,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
282 return; 289 return;
283 290
284 cx_write(MO_TS_INTSTAT, status); 291 cx_write(MO_TS_INTSTAT, status);
285#if 0 292
286 cx88_print_irqbits(core->name, "irq mpeg ",
287 cx88_mpeg_irqs, status, mask);
288#endif
289 if (debug || (status & mask & ~0xff)) 293 if (debug || (status & mask & ~0xff))
290 cx88_print_irqbits(core->name, "irq mpeg ", 294 cx88_print_irqbits(core->name, "irq mpeg ",
291 cx88_mpeg_irqs, status, mask); 295 cx88_mpeg_irqs, status, mask);
@@ -441,10 +445,8 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
441 } 445 }
442 spin_unlock(&dev->slock); 446 spin_unlock(&dev->slock);
443 447
444#if 1
445 /* FIXME -- shutdown device */ 448 /* FIXME -- shutdown device */
446 cx88_shutdown(dev->core); 449 cx88_shutdown(dev->core);
447#endif
448 450
449 pci_save_state(pci_dev); 451 pci_save_state(pci_dev);
450 if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { 452 if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
@@ -466,10 +468,8 @@ int cx8802_resume_common(struct pci_dev *pci_dev)
466 pci_set_power_state(pci_dev, PCI_D0); 468 pci_set_power_state(pci_dev, PCI_D0);
467 pci_restore_state(pci_dev); 469 pci_restore_state(pci_dev);
468 470
469#if 1
470 /* FIXME: re-initialize hardware */ 471 /* FIXME: re-initialize hardware */
471 cx88_reset(dev->core); 472 cx88_reset(dev->core);
472#endif
473 473
474 /* restart video+vbi capture */ 474 /* restart video+vbi capture */
475 spin_lock(&dev->slock); 475 spin_lock(&dev->slock);
diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h
index 63ad33f5818b..37f82662d265 100644
--- a/drivers/media/video/cx88/cx88-reg.h
+++ b/drivers/media/video/cx88/cx88-reg.h
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: cx88-reg.h,v 1.7 2005/06/03 13:31:51 mchehab Exp $ 2 $Id: cx88-reg.h,v 1.8 2005/07/07 13:58:38 mchehab Exp $
3 3
4 cx88x-hw.h - CX2388x register offsets 4 cx88x-hw.h - CX2388x register offsets
5 5
@@ -604,20 +604,11 @@
604#define EN_I2SIN_STR2DAC 0x00004000 604#define EN_I2SIN_STR2DAC 0x00004000
605#define EN_I2SIN_ENABLE 0x00008000 605#define EN_I2SIN_ENABLE 0x00008000
606 606
607#if 0
608/* old */
609#define EN_DMTRX_SUMDIFF 0x00000800
610#define EN_DMTRX_SUMR 0x00000880
611#define EN_DMTRX_LR 0x00000900
612#define EN_DMTRX_MONO 0x00000980
613#else
614/* dscaler cvs */
615#define EN_DMTRX_SUMDIFF (0 << 7) 607#define EN_DMTRX_SUMDIFF (0 << 7)
616#define EN_DMTRX_SUMR (1 << 7) 608#define EN_DMTRX_SUMR (1 << 7)
617#define EN_DMTRX_LR (2 << 7) 609#define EN_DMTRX_LR (2 << 7)
618#define EN_DMTRX_MONO (3 << 7) 610#define EN_DMTRX_MONO (3 << 7)
619#define EN_DMTRX_BYPASS (1 << 11) 611#define EN_DMTRX_BYPASS (1 << 11)
620#endif
621 612
622// Video 613// Video
623#define VID_CAPTURE_CONTROL 0x310180 614#define VID_CAPTURE_CONTROL 0x310180
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 46d78b1dc9b2..91207f10bae7 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: cx88-tvaudio.c,v 1.36 2005/06/05 05:53:45 mchehab Exp $ 2 $Id: cx88-tvaudio.c,v 1.37 2005/07/07 13:58:38 mchehab Exp $
3 3
4 cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver 4 cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
5 5
@@ -278,80 +278,6 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap)
278 set_audio_finish(core); 278 set_audio_finish(core);
279} 279}
280 280
281#if 0
282static void set_audio_standard_NICAM(struct cx88_core *core)
283{
284 static const struct rlist nicam_common[] = {
285 /* from dscaler */
286 { AUD_RATE_ADJ1, 0x00000010 },
287 { AUD_RATE_ADJ2, 0x00000040 },
288 { AUD_RATE_ADJ3, 0x00000100 },
289 { AUD_RATE_ADJ4, 0x00000400 },
290 { AUD_RATE_ADJ5, 0x00001000 },
291 // { AUD_DMD_RA_DDS, 0x00c0d5ce },
292
293 // Deemphasis 1:
294 { AUD_DEEMPHGAIN_R, 0x000023c2 },
295 { AUD_DEEMPHNUMER1_R, 0x0002a7bc },
296 { AUD_DEEMPHNUMER2_R, 0x0003023e },
297 { AUD_DEEMPHDENOM1_R, 0x0000f3d0 },
298 { AUD_DEEMPHDENOM2_R, 0x00000000 },
299
300#if 0
301 // Deemphasis 2: (other tv norm?)
302 { AUD_DEEMPHGAIN_R, 0x0000c600 },
303 { AUD_DEEMPHNUMER1_R, 0x00066738 },
304 { AUD_DEEMPHNUMER2_R, 0x00066739 },
305 { AUD_DEEMPHDENOM1_R, 0x0001e88c },
306 { AUD_DEEMPHDENOM2_R, 0x0001e88c },
307#endif
308
309 { AUD_DEEMPHDENOM2_R, 0x00000000 },
310 { AUD_ERRLOGPERIOD_R, 0x00000fff },
311 { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff },
312 { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff },
313 { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f },
314 { AUD_POLYPH80SCALEFAC, 0x00000003 },
315
316 // setup QAM registers
317 { AUD_PDF_DDS_CNST_BYTE2, 0x06 },
318 { AUD_PDF_DDS_CNST_BYTE1, 0x82 },
319 { AUD_PDF_DDS_CNST_BYTE0, 0x16 },
320 { AUD_QAM_MODE, 0x05 },
321
322 { /* end of list */ },
323 };
324 static const struct rlist nicam_pal_i[] = {
325 { AUD_PDF_DDS_CNST_BYTE0, 0x12 },
326 { AUD_PHACC_FREQ_8MSB, 0x3a },
327 { AUD_PHACC_FREQ_8LSB, 0x93 },
328
329 { /* end of list */ },
330 };
331 static const struct rlist nicam_default[] = {
332 { AUD_PDF_DDS_CNST_BYTE0, 0x16 },
333 { AUD_PHACC_FREQ_8MSB, 0x34 },
334 { AUD_PHACC_FREQ_8LSB, 0x4c },
335
336 { /* end of list */ },
337 };
338
339 set_audio_start(core, 0x0010,
340 EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO);
341 set_audio_registers(core, nicam_common);
342 switch (core->tvaudio) {
343 case WW_NICAM_I:
344 dprintk("%s PAL-I NICAM (status: unknown)\n",__FUNCTION__);
345 set_audio_registers(core, nicam_pal_i);
346 break;
347 case WW_NICAM_BGDKL:
348 dprintk("%s PAL-BGDK NICAM (status: unknown)\n",__FUNCTION__);
349 set_audio_registers(core, nicam_default);
350 break;
351 };
352 set_audio_finish(core);
353}
354#endif
355 281
356static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) 282static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo)
357{ 283{
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index dc997549b634..c44a079d08c0 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-video.c,v 1.70 2005/06/20 03:36:00 mkrufky Exp $ 2 * $Id: cx88-video.c,v 1.79 2005/07/07 14:17:47 mchehab Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * video4linux video interface 5 * video4linux video interface
@@ -86,13 +86,6 @@ static struct cx88_tvnorm tvnorms[] = {
86 .id = V4L2_STD_NTSC_M_JP, 86 .id = V4L2_STD_NTSC_M_JP,
87 .cxiformat = VideoFormatNTSCJapan, 87 .cxiformat = VideoFormatNTSCJapan,
88 .cxoformat = 0x181f0008, 88 .cxoformat = 0x181f0008,
89#if 0
90 },{
91 .name = "NTSC-4.43",
92 .id = FIXME,
93 .cxiformat = VideoFormatNTSC443,
94 .cxoformat = 0x181f0008,
95#endif
96 },{ 89 },{
97 .name = "PAL-BG", 90 .name = "PAL-BG",
98 .id = V4L2_STD_PAL_BG, 91 .id = V4L2_STD_PAL_BG,
@@ -248,6 +241,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
248 .default_value = 0, 241 .default_value = 0,
249 .type = V4L2_CTRL_TYPE_INTEGER, 242 .type = V4L2_CTRL_TYPE_INTEGER,
250 }, 243 },
244 .off = 0,
251 .reg = MO_CONTR_BRIGHT, 245 .reg = MO_CONTR_BRIGHT,
252 .mask = 0xff00, 246 .mask = 0xff00,
253 .shift = 8, 247 .shift = 8,
@@ -674,231 +668,6 @@ static struct videobuf_queue_ops cx8800_video_qops = {
674 668
675/* ------------------------------------------------------------------ */ 669/* ------------------------------------------------------------------ */
676 670
677#if 0 /* overlay support not finished yet */
678static u32* ov_risc_field(struct cx8800_dev *dev, struct cx8800_fh *fh,
679 u32 *rp, struct btcx_skiplist *skips,
680 u32 sync_line, int skip_even, int skip_odd)
681{
682 int line,maxy,start,end,skip,nskips;
683 u32 ri,ra;
684 u32 addr;
685
686 /* sync instruction */
687 *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line);
688
689 addr = (unsigned long)dev->fbuf.base;
690 addr += dev->fbuf.fmt.bytesperline * fh->win.w.top;
691 addr += (fh->fmt->depth >> 3) * fh->win.w.left;
692
693 /* scan lines */
694 for (maxy = -1, line = 0; line < fh->win.w.height;
695 line++, addr += dev->fbuf.fmt.bytesperline) {
696 if ((line%2) == 0 && skip_even)
697 continue;
698 if ((line%2) == 1 && skip_odd)
699 continue;
700
701 /* calculate clipping */
702 if (line > maxy)
703 btcx_calc_skips(line, fh->win.w.width, &maxy,
704 skips, &nskips, fh->clips, fh->nclips);
705
706 /* write out risc code */
707 for (start = 0, skip = 0; start < fh->win.w.width; start = end) {
708 if (skip >= nskips) {
709 ri = RISC_WRITE;
710 end = fh->win.w.width;
711 } else if (start < skips[skip].start) {
712 ri = RISC_WRITE;
713 end = skips[skip].start;
714 } else {
715 ri = RISC_SKIP;
716 end = skips[skip].end;
717 skip++;
718 }
719 if (RISC_WRITE == ri)
720 ra = addr + (fh->fmt->depth>>3)*start;
721 else
722 ra = 0;
723
724 if (0 == start)
725 ri |= RISC_SOL;
726 if (fh->win.w.width == end)
727 ri |= RISC_EOL;
728 ri |= (fh->fmt->depth>>3) * (end-start);
729
730 *(rp++)=cpu_to_le32(ri);
731 if (0 != ra)
732 *(rp++)=cpu_to_le32(ra);
733 }
734 }
735 kfree(skips);
736 return rp;
737}
738
739static int ov_risc_frame(struct cx8800_dev *dev, struct cx8800_fh *fh,
740 struct cx88_buffer *buf)
741{
742 struct btcx_skiplist *skips;
743 u32 instructions,fields;
744 u32 *rp;
745 int rc;
746
747 /* skip list for window clipping */
748 if (NULL == (skips = kmalloc(sizeof(*skips) * fh->nclips,GFP_KERNEL)))
749 return -ENOMEM;
750
751 fields = 0;
752 if (V4L2_FIELD_HAS_TOP(fh->win.field))
753 fields++;
754 if (V4L2_FIELD_HAS_BOTTOM(fh->win.field))
755 fields++;
756
757 /* estimate risc mem: worst case is (clip+1) * lines instructions
758 + syncs + jump (all 2 dwords) */
759 instructions = (fh->nclips+1) * fh->win.w.height;
760 instructions += 3 + 4;
761 if ((rc = btcx_riscmem_alloc(dev->pci,&buf->risc,instructions*8)) < 0) {
762 kfree(skips);
763 return rc;
764 }
765
766 /* write risc instructions */
767 rp = buf->risc.cpu;
768 switch (fh->win.field) {
769 case V4L2_FIELD_TOP:
770 rp = ov_risc_field(dev, fh, rp, skips, 0, 0, 0);
771 break;
772 case V4L2_FIELD_BOTTOM:
773 rp = ov_risc_field(dev, fh, rp, skips, 0x200, 0, 0);
774 break;
775 case V4L2_FIELD_INTERLACED:
776 rp = ov_risc_field(dev, fh, rp, skips, 0, 0, 1);
777 rp = ov_risc_field(dev, fh, rp, skips, 0x200, 1, 0);
778 break;
779 default:
780 BUG();
781 }
782
783 /* save pointer to jmp instruction address */
784 buf->risc.jmp = rp;
785 kfree(skips);
786 return 0;
787}
788
789static int verify_window(struct cx8800_dev *dev, struct v4l2_window *win)
790{
791 enum v4l2_field field;
792 int maxw, maxh;
793
794 if (NULL == dev->fbuf.base)
795 return -EINVAL;
796 if (win->w.width < 48 || win->w.height < 32)
797 return -EINVAL;
798 if (win->clipcount > 2048)
799 return -EINVAL;
800
801 field = win->field;
802 maxw = norm_maxw(core->tvnorm);
803 maxh = norm_maxh(core->tvnorm);
804
805 if (V4L2_FIELD_ANY == field) {
806 field = (win->w.height > maxh/2)
807 ? V4L2_FIELD_INTERLACED
808 : V4L2_FIELD_TOP;
809 }
810 switch (field) {
811 case V4L2_FIELD_TOP:
812 case V4L2_FIELD_BOTTOM:
813 maxh = maxh / 2;
814 break;
815 case V4L2_FIELD_INTERLACED:
816 break;
817 default:
818 return -EINVAL;
819 }
820
821 win->field = field;
822 if (win->w.width > maxw)
823 win->w.width = maxw;
824 if (win->w.height > maxh)
825 win->w.height = maxh;
826 return 0;
827}
828
829static int setup_window(struct cx8800_dev *dev, struct cx8800_fh *fh,
830 struct v4l2_window *win)
831{
832 struct v4l2_clip *clips = NULL;
833 int n,size,retval = 0;
834
835 if (NULL == fh->fmt)
836 return -EINVAL;
837 retval = verify_window(dev,win);
838 if (0 != retval)
839 return retval;
840
841 /* copy clips -- luckily v4l1 + v4l2 are binary
842 compatible here ...*/
843 n = win->clipcount;
844 size = sizeof(*clips)*(n+4);
845 clips = kmalloc(size,GFP_KERNEL);
846 if (NULL == clips)
847 return -ENOMEM;
848 if (n > 0) {
849 if (copy_from_user(clips,win->clips,sizeof(struct v4l2_clip)*n)) {
850 kfree(clips);
851 return -EFAULT;
852 }
853 }
854
855 /* clip against screen */
856 if (NULL != dev->fbuf.base)
857 n = btcx_screen_clips(dev->fbuf.fmt.width, dev->fbuf.fmt.height,
858 &win->w, clips, n);
859 btcx_sort_clips(clips,n);
860
861 /* 4-byte alignments */
862 switch (fh->fmt->depth) {
863 case 8:
864 case 24:
865 btcx_align(&win->w, clips, n, 3);
866 break;
867 case 16:
868 btcx_align(&win->w, clips, n, 1);
869 break;
870 case 32:
871 /* no alignment fixups needed */
872 break;
873 default:
874 BUG();
875 }
876
877 down(&fh->vidq.lock);
878 if (fh->clips)
879 kfree(fh->clips);
880 fh->clips = clips;
881 fh->nclips = n;
882 fh->win = *win;
883#if 0
884 fh->ov.setup_ok = 1;
885#endif
886
887 /* update overlay if needed */
888 retval = 0;
889#if 0
890 if (check_btres(fh, RESOURCE_OVERLAY)) {
891 struct bttv_buffer *new;
892
893 new = videobuf_alloc(sizeof(*new));
894 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
895 retval = bttv_switch_overlay(btv,fh,new);
896 }
897#endif
898 up(&fh->vidq.lock);
899 return retval;
900}
901#endif
902 671
903/* ------------------------------------------------------------------ */ 672/* ------------------------------------------------------------------ */
904 673
@@ -1327,9 +1096,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1327 struct cx8800_fh *fh = file->private_data; 1096 struct cx8800_fh *fh = file->private_data;
1328 struct cx8800_dev *dev = fh->dev; 1097 struct cx8800_dev *dev = fh->dev;
1329 struct cx88_core *core = dev->core; 1098 struct cx88_core *core = dev->core;
1330#if 0
1331 unsigned long flags;
1332#endif
1333 int err; 1099 int err;
1334 1100
1335 if (video_debug > 1) 1101 if (video_debug > 1)
@@ -1350,9 +1116,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1350 V4L2_CAP_READWRITE | 1116 V4L2_CAP_READWRITE |
1351 V4L2_CAP_STREAMING | 1117 V4L2_CAP_STREAMING |
1352 V4L2_CAP_VBI_CAPTURE | 1118 V4L2_CAP_VBI_CAPTURE |
1353#if 0
1354 V4L2_CAP_VIDEO_OVERLAY |
1355#endif
1356 0; 1119 0;
1357 if (UNSET != core->tuner_type) 1120 if (UNSET != core->tuner_type)
1358 cap->capabilities |= V4L2_CAP_TUNER; 1121 cap->capabilities |= V4L2_CAP_TUNER;
@@ -1453,36 +1216,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1453 } 1216 }
1454 1217
1455 1218
1456#if 0
1457 /* needs review */
1458 case VIDIOC_G_AUDIO:
1459 {
1460 struct v4l2_audio *a = arg;
1461 unsigned int n = a->index;
1462
1463 memset(a,0,sizeof(*a));
1464 a->index = n;
1465 switch (n) {
1466 case 0:
1467 if ((CX88_VMUX_TELEVISION == INPUT(n)->type)
1468 || (CX88_VMUX_CABLE == INPUT(n)->type)) {
1469 strcpy(a->name,"Television");
1470 // FIXME figure out if stereo received and set V4L2_AUDCAP_STEREO.
1471 return 0;
1472 }
1473 break;
1474 case 1:
1475 if (CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q == core->board) {
1476 strcpy(a->name,"Line In");
1477 a->capability = V4L2_AUDCAP_STEREO;
1478 return 0;
1479 }
1480 break;
1481 }
1482 // Audio input not available.
1483 return -EINVAL;
1484 }
1485#endif
1486 1219
1487 /* --- capture ioctls ---------------------------------------- */ 1220 /* --- capture ioctls ---------------------------------------- */
1488 case VIDIOC_ENUM_FMT: 1221 case VIDIOC_ENUM_FMT:
@@ -1592,6 +1325,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1592 1325
1593 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 1326 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1594 f->frequency = dev->freq; 1327 f->frequency = dev->freq;
1328
1329 cx88_call_i2c_clients(dev->core,VIDIOC_G_FREQUENCY,f);
1330
1595 return 0; 1331 return 0;
1596 } 1332 }
1597 case VIDIOC_S_FREQUENCY: 1333 case VIDIOC_S_FREQUENCY:
@@ -1846,6 +1582,14 @@ static void cx8800_vid_timeout(unsigned long data)
1846 spin_unlock_irqrestore(&dev->slock,flags); 1582 spin_unlock_irqrestore(&dev->slock,flags);
1847} 1583}
1848 1584
1585static char *cx88_vid_irqs[32] = {
1586 "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
1587 "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
1588 "y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
1589 "y_sync", "u_sync", "v_sync", "vbi_sync",
1590 "opc_err", "par_err", "rip_err", "pci_abort",
1591};
1592
1849static void cx8800_vid_irq(struct cx8800_dev *dev) 1593static void cx8800_vid_irq(struct cx8800_dev *dev)
1850{ 1594{
1851 struct cx88_core *core = dev->core; 1595 struct cx88_core *core = dev->core;
@@ -2013,7 +1757,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
2013{ 1757{
2014 struct cx8800_dev *dev; 1758 struct cx8800_dev *dev;
2015 struct cx88_core *core; 1759 struct cx88_core *core;
2016 struct tuner_addr tun_addr;
2017 int err; 1760 int err;
2018 1761
2019 dev = kmalloc(sizeof(*dev),GFP_KERNEL); 1762 dev = kmalloc(sizeof(*dev),GFP_KERNEL);
@@ -2087,22 +1830,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
2087 request_module("tuner"); 1830 request_module("tuner");
2088 if (core->tda9887_conf) 1831 if (core->tda9887_conf)
2089 request_module("tda9887"); 1832 request_module("tda9887");
2090 if (core->radio_type != UNSET) {
2091 tun_addr.v4l2_tuner = V4L2_TUNER_RADIO;
2092 tun_addr.type = core->radio_type;
2093 tun_addr.addr = core->radio_addr;
2094 cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr);
2095 }
2096 if (core->tuner_type != UNSET) {
2097 tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV;
2098 tun_addr.type = core->tuner_type;
2099 tun_addr.addr = core->tuner_addr;
2100 cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr);
2101 }
2102
2103 if (core->tda9887_conf)
2104 cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf);
2105
2106 /* register v4l devices */ 1833 /* register v4l devices */
2107 dev->video_dev = cx88_vdev_init(core,dev->pci, 1834 dev->video_dev = cx88_vdev_init(core,dev->pci,
2108 &cx8800_video_template,"video"); 1835 &cx8800_video_template,"video");
@@ -2212,10 +1939,8 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
2212 } 1939 }
2213 spin_unlock(&dev->slock); 1940 spin_unlock(&dev->slock);
2214 1941
2215#if 1
2216 /* FIXME -- shutdown device */ 1942 /* FIXME -- shutdown device */
2217 cx88_shutdown(dev->core); 1943 cx88_shutdown(dev->core);
2218#endif
2219 1944
2220 pci_save_state(pci_dev); 1945 pci_save_state(pci_dev);
2221 if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { 1946 if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
@@ -2237,10 +1962,8 @@ static int cx8800_resume(struct pci_dev *pci_dev)
2237 pci_set_power_state(pci_dev, PCI_D0); 1962 pci_set_power_state(pci_dev, PCI_D0);
2238 pci_restore_state(pci_dev); 1963 pci_restore_state(pci_dev);
2239 1964
2240#if 1
2241 /* FIXME: re-initialize hardware */ 1965 /* FIXME: re-initialize hardware */
2242 cx88_reset(dev->core); 1966 cx88_reset(dev->core);
2243#endif
2244 1967
2245 /* restart video+vbi capture */ 1968 /* restart video+vbi capture */
2246 spin_lock(&dev->slock); 1969 spin_lock(&dev->slock);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index bc5e038bc0fe..307beae04f2a 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88.h,v 1.67 2005/07/01 12:10:07 mkrufky Exp $ 2 * $Id: cx88.h,v 1.68 2005/07/07 14:17:47 mchehab Exp $
3 * 3 *
4 * v4l2 device driver for cx2388x based TV cards 4 * v4l2 device driver for cx2388x based TV cards
5 * 5 *
@@ -82,9 +82,9 @@ struct cx88_tvnorm {
82static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) 82static unsigned int inline norm_maxw(struct cx88_tvnorm *norm)
83{ 83{
84 return (norm->id & V4L2_STD_625_50) ? 768 : 640; 84 return (norm->id & V4L2_STD_625_50) ? 768 : 640;
85// return (norm->id & V4L2_STD_625_50) ? 720 : 640;
86} 85}
87 86
87
88static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) 88static unsigned int inline norm_maxh(struct cx88_tvnorm *norm)
89{ 89{
90 return (norm->id & V4L2_STD_625_50) ? 576 : 480; 90 return (norm->id & V4L2_STD_625_50) ? 576 : 480;
@@ -220,7 +220,6 @@ struct cx88_subid {
220#define RESOURCE_VBI 4 220#define RESOURCE_VBI 4
221 221
222#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ 222#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */
223//#define BUFFER_TIMEOUT (HZ*2)
224 223
225/* buffer for one video frame */ 224/* buffer for one video frame */
226struct cx88_buffer { 225struct cx88_buffer {
@@ -336,11 +335,6 @@ struct cx8800_dev {
336 struct pci_dev *pci; 335 struct pci_dev *pci;
337 unsigned char pci_rev,pci_lat; 336 unsigned char pci_rev,pci_lat;
338 337
339#if 0
340 /* video overlay */
341 struct v4l2_framebuffer fbuf;
342 struct cx88_buffer *screen;
343#endif
344 338
345 /* capture queues */ 339 /* capture queues */
346 struct cx88_dmaqueue vidq; 340 struct cx88_dmaqueue vidq;
@@ -435,8 +429,6 @@ struct cx8802_dev {
435/* ----------------------------------------------------------- */ 429/* ----------------------------------------------------------- */
436/* cx88-core.c */ 430/* cx88-core.c */
437 431
438extern char *cx88_vid_irqs[32];
439extern char *cx88_mpeg_irqs[32];
440extern void cx88_print_irqbits(char *name, char *tag, char **strings, 432extern void cx88_print_irqbits(char *name, char *tag, char **strings,
441 u32 bits, u32 mask); 433 u32 bits, u32 mask);
442extern void cx88_print_ioctl(char *name, unsigned int cmd); 434extern void cx88_print_ioctl(char *name, unsigned int cmd);
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 92664f75d327..9fc5055e001c 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ir-kbd-i2c.c,v 1.10 2004/12/09 12:51:35 kraxel Exp $ 2 * $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $
3 * 3 *
4 * keyboard input driver for i2c IR remote controls 4 * keyboard input driver for i2c IR remote controls
5 * 5 *
@@ -66,26 +66,26 @@ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = {
66 [ 29 ] = KEY_PAGEDOWN, 66 [ 29 ] = KEY_PAGEDOWN,
67 [ 19 ] = KEY_SOUND, 67 [ 19 ] = KEY_SOUND,
68 68
69 [ 24 ] = KEY_KPPLUSMINUS, // CH +/- 69 [ 24 ] = KEY_KPPLUSMINUS, /* CH +/- */
70 [ 22 ] = KEY_SUBTITLE, // CC 70 [ 22 ] = KEY_SUBTITLE, /* CC */
71 [ 13 ] = KEY_TEXT, // TTX 71 [ 13 ] = KEY_TEXT, /* TTX */
72 [ 11 ] = KEY_TV, // AIR/CBL 72 [ 11 ] = KEY_TV, /* AIR/CBL */
73 [ 17 ] = KEY_PC, // PC/TV 73 [ 17 ] = KEY_PC, /* PC/TV */
74 [ 23 ] = KEY_OK, // CH RTN 74 [ 23 ] = KEY_OK, /* CH RTN */
75 [ 25 ] = KEY_MODE, // FUNC 75 [ 25 ] = KEY_MODE, /* FUNC */
76 [ 12 ] = KEY_SEARCH, // AUTOSCAN 76 [ 12 ] = KEY_SEARCH, /* AUTOSCAN */
77 77
78 /* Not sure what to do with these ones! */ 78 /* Not sure what to do with these ones! */
79 [ 15 ] = KEY_SELECT, // SOURCE 79 [ 15 ] = KEY_SELECT, /* SOURCE */
80 [ 10 ] = KEY_KPPLUS, // +100 80 [ 10 ] = KEY_KPPLUS, /* +100 */
81 [ 20 ] = KEY_KPEQUAL, // SYNC 81 [ 20 ] = KEY_KPEQUAL, /* SYNC */
82 [ 28 ] = KEY_MEDIA, // PC/TV 82 [ 28 ] = KEY_MEDIA, /* PC/TV */
83}; 83};
84 84
85static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { 85static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
86 [ 0x3 ] = KEY_POWER, 86 [ 0x3 ] = KEY_POWER,
87 [ 0x6f ] = KEY_MUTE, 87 [ 0x6f ] = KEY_MUTE,
88 [ 0x10 ] = KEY_BACKSPACE, // Recall 88 [ 0x10 ] = KEY_BACKSPACE, /* Recall */
89 89
90 [ 0x11 ] = KEY_KP0, 90 [ 0x11 ] = KEY_KP0,
91 [ 0x4 ] = KEY_KP1, 91 [ 0x4 ] = KEY_KP1,
@@ -97,7 +97,7 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
97 [ 0xc ] = KEY_KP7, 97 [ 0xc ] = KEY_KP7,
98 [ 0xd ] = KEY_KP8, 98 [ 0xd ] = KEY_KP8,
99 [ 0xe ] = KEY_KP9, 99 [ 0xe ] = KEY_KP9,
100 [ 0x12 ] = KEY_KPDOT, // 100+ 100 [ 0x12 ] = KEY_KPDOT, /* 100+ */
101 101
102 [ 0x7 ] = KEY_VOLUMEUP, 102 [ 0x7 ] = KEY_VOLUMEUP,
103 [ 0xb ] = KEY_VOLUMEDOWN, 103 [ 0xb ] = KEY_VOLUMEDOWN,
@@ -109,25 +109,16 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
109 [ 0x13 ] = KEY_CHANNELDOWN, 109 [ 0x13 ] = KEY_CHANNELDOWN,
110 [ 0x48 ] = KEY_ZOOM, 110 [ 0x48 ] = KEY_ZOOM,
111 111
112 [ 0x1b ] = KEY_VIDEO, // Video source 112 [ 0x1b ] = KEY_VIDEO, /* Video source */
113#if 0 113 [ 0x49 ] = KEY_LANGUAGE, /* MTS Select */
114 [ 0x1f ] = KEY_S, // Snapshot 114 [ 0x19 ] = KEY_SEARCH, /* Auto Scan */
115#endif
116 [ 0x49 ] = KEY_LANGUAGE, // MTS Select
117 [ 0x19 ] = KEY_SEARCH, // Auto Scan
118 115
119 [ 0x4b ] = KEY_RECORD, 116 [ 0x4b ] = KEY_RECORD,
120 [ 0x46 ] = KEY_PLAY, 117 [ 0x46 ] = KEY_PLAY,
121 [ 0x45 ] = KEY_PAUSE, // Pause 118 [ 0x45 ] = KEY_PAUSE, /* Pause */
122 [ 0x44 ] = KEY_STOP, 119 [ 0x44 ] = KEY_STOP,
123#if 0 120 [ 0x40 ] = KEY_FORWARD, /* Forward ? */
124 [ 0x43 ] = KEY_T, // Time Shift 121 [ 0x42 ] = KEY_REWIND, /* Backward ? */
125 [ 0x47 ] = KEY_Y, // Time Shift OFF
126 [ 0x4a ] = KEY_O, // TOP
127 [ 0x17 ] = KEY_F, // SURF CH
128#endif
129 [ 0x40 ] = KEY_FORWARD, // Forward ?
130 [ 0x42 ] = KEY_REWIND, // Backward ?
131 122
132}; 123};
133 124
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index b4ee9dfe6d42..6239254db27e 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -567,10 +567,6 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode)
567 switch (audmode) { 567 switch (audmode) {
568 case V4L2_TUNER_MODE_STEREO: 568 case V4L2_TUNER_MODE_STEREO:
569 src = 0x0020 | nicam; 569 src = 0x0020 | nicam;
570#if 0
571 /* spatial effect */
572 msp3400c_write(client,I2C_MSP3400C_DFP, 0x0005,0x4000);
573#endif
574 break; 570 break;
575 case V4L2_TUNER_MODE_MONO: 571 case V4L2_TUNER_MODE_MONO:
576 if (msp->mode == MSP_MODE_AM_NICAM) { 572 if (msp->mode == MSP_MODE_AM_NICAM) {
@@ -741,16 +737,14 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout)
741 set_current_state(TASK_INTERRUPTIBLE); 737 set_current_state(TASK_INTERRUPTIBLE);
742 schedule(); 738 schedule();
743 } else { 739 } else {
744#if 0
745 /* hmm, that one doesn't return on wakeup ... */
746 msleep_interruptible(timeout);
747#else
748 set_current_state(TASK_INTERRUPTIBLE); 740 set_current_state(TASK_INTERRUPTIBLE);
749 schedule_timeout(msecs_to_jiffies(timeout)); 741 schedule_timeout(msecs_to_jiffies(timeout));
750#endif
751 } 742 }
752 } 743 }
753 try_to_freeze(); 744 if (current->flags & PF_FREEZE) {
745 refrigerator ();
746 }
747
754 remove_wait_queue(&msp->wq, &wait); 748 remove_wait_queue(&msp->wq, &wait);
755 return msp->restart; 749 return msp->restart;
756} 750}
@@ -1154,17 +1148,10 @@ static int msp3410d_thread(void *data)
1154 MSP_CARRIER(10.7)); 1148 MSP_CARRIER(10.7));
1155 /* scart routing */ 1149 /* scart routing */
1156 msp3400c_set_scart(client,SCART_IN2,0); 1150 msp3400c_set_scart(client,SCART_IN2,0);
1157#if 0
1158 /* radio from SCART_IN2 */
1159 msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0220);
1160 msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0220);
1161 msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0220);
1162#else
1163 /* msp34xx does radio decoding */ 1151 /* msp34xx does radio decoding */
1164 msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020); 1152 msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020);
1165 msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020); 1153 msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020);
1166 msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020); 1154 msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020);
1167#endif
1168 break; 1155 break;
1169 case 0x0003: 1156 case 0x0003:
1170 case 0x0004: 1157 case 0x0004:
@@ -1507,10 +1494,6 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
1507 return -1; 1494 return -1;
1508 } 1495 }
1509 1496
1510#if 0
1511 /* this will turn on a 1kHz beep - might be useful for debugging... */
1512 msp3400c_write(c,I2C_MSP3400C_DFP, 0x0014, 0x1040);
1513#endif
1514 msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); 1497 msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance);
1515 1498
1516 snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", 1499 snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d",
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index 9c005cb128d7..2fb7c2d1787a 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -511,22 +511,6 @@ int microtune_init(struct i2c_client *c)
511 tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", 511 tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n",
512 company_code,buf[0x13],buf[0x14]); 512 company_code,buf[0x13],buf[0x14]);
513 513
514#if 0
515 /* seems to cause more problems than it solves ... */
516 switch (company_code) {
517 case 0x30bf:
518 case 0x3cbf:
519 case 0x3dbf:
520 case 0x4d54:
521 case 0x8e81:
522 case 0x8e91:
523 /* ok (?) */
524 break;
525 default:
526 tuner_warn("tuner: microtune: unknown companycode\n");
527 return 0;
528 }
529#endif
530 514
531 if (buf[0x13] < ARRAY_SIZE(microtune_part) && 515 if (buf[0x13] < ARRAY_SIZE(microtune_part) &&
532 NULL != microtune_part[buf[0x13]]) 516 NULL != microtune_part[buf[0x13]])
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 70bf1f1fad59..486234d41b56 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -326,6 +326,7 @@ static int mxb_init_done(struct saa7146_dev* dev)
326 struct mxb* mxb = (struct mxb*)dev->ext_priv; 326 struct mxb* mxb = (struct mxb*)dev->ext_priv;
327 struct video_decoder_init init; 327 struct video_decoder_init init;
328 struct i2c_msg msg; 328 struct i2c_msg msg;
329 struct tuner_setup tun_setup;
329 330
330 int i = 0, err = 0; 331 int i = 0, err = 0;
331 struct tea6415c_multiplex vm; 332 struct tea6415c_multiplex vm;
@@ -349,8 +350,10 @@ static int mxb_init_done(struct saa7146_dev* dev)
349 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i); 350 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i);
350 351
351 /* select a tuner type */ 352 /* select a tuner type */
352 i = 5; 353 tun_setup.mode_mask = T_ANALOG_TV;
353 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE, &i); 354 tun_setup.addr = ADDR_UNSET;
355 tun_setup.type = 5;
356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);
354 357
355 /* mute audio on tea6420s */ 358 /* mute audio on tea6420s */
356 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 359 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index e6d0a18833d6..79d05ea1b69b 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -155,10 +155,6 @@ static struct v4l2_mpeg_compression param_defaults =
155 .target = 256, 155 .target = 256,
156 }, 156 },
157 157
158#if 0
159 /* FIXME: size? via S_FMT? */
160 .video_format = MPEG_VIDEO_FORMAT_D1,
161#endif
162}; 158};
163 159
164/* ---------------------------------------------------------------------- */ 160/* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 0c781e24c446..88b71a20b602 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -1,6 +1,5 @@
1
2/* 1/*
3 * $Id: saa7134-cards.c,v 1.58 2005/06/07 18:05:00 nsh Exp $ 2 * $Id: saa7134-cards.c,v 1.80 2005/07/07 01:49:30 mkrufky Exp $
4 * 3 *
5 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
6 * card-specific stuff. 5 * card-specific stuff.
@@ -47,6 +46,10 @@ struct saa7134_board saa7134_boards[] = {
47 .name = "UNKNOWN/GENERIC", 46 .name = "UNKNOWN/GENERIC",
48 .audio_clock = 0x00187de7, 47 .audio_clock = 0x00187de7,
49 .tuner_type = TUNER_ABSENT, 48 .tuner_type = TUNER_ABSENT,
49 .radio_type = UNSET,
50 .tuner_addr = ADDR_UNSET,
51 .radio_addr = ADDR_UNSET,
52
50 .inputs = {{ 53 .inputs = {{
51 .name = "default", 54 .name = "default",
52 .vmux = 0, 55 .vmux = 0,
@@ -58,6 +61,10 @@ struct saa7134_board saa7134_boards[] = {
58 .name = "Proteus Pro [philips reference design]", 61 .name = "Proteus Pro [philips reference design]",
59 .audio_clock = 0x00187de7, 62 .audio_clock = 0x00187de7,
60 .tuner_type = TUNER_PHILIPS_PAL, 63 .tuner_type = TUNER_PHILIPS_PAL,
64 .radio_type = UNSET,
65 .tuner_addr = ADDR_UNSET,
66 .radio_addr = ADDR_UNSET,
67
61 .inputs = {{ 68 .inputs = {{
62 .name = name_comp1, 69 .name = name_comp1,
63 .vmux = 0, 70 .vmux = 0,
@@ -83,6 +90,10 @@ struct saa7134_board saa7134_boards[] = {
83 .name = "LifeView FlyVIDEO3000", 90 .name = "LifeView FlyVIDEO3000",
84 .audio_clock = 0x00200000, 91 .audio_clock = 0x00200000,
85 .tuner_type = TUNER_PHILIPS_PAL, 92 .tuner_type = TUNER_PHILIPS_PAL,
93 .radio_type = UNSET,
94 .tuner_addr = ADDR_UNSET,
95 .radio_addr = ADDR_UNSET,
96
86 .gpiomask = 0xe000, 97 .gpiomask = 0xe000,
87 .inputs = {{ 98 .inputs = {{
88 .name = name_tv, 99 .name = name_tv,
@@ -90,7 +101,7 @@ struct saa7134_board saa7134_boards[] = {
90 .amux = TV, 101 .amux = TV,
91 .gpio = 0x8000, 102 .gpio = 0x8000,
92 .tv = 1, 103 .tv = 1,
93 },{ 104 },{
94 .name = name_tv_mono, 105 .name = name_tv_mono,
95 .vmux = 1, 106 .vmux = 1,
96 .amux = LINE2, 107 .amux = LINE2,
@@ -117,12 +128,21 @@ struct saa7134_board saa7134_boards[] = {
117 .amux = LINE2, 128 .amux = LINE2,
118 .gpio = 0x2000, 129 .gpio = 0x2000,
119 }, 130 },
131 .mute = {
132 .name = name_mute,
133 .amux = TV,
134 .gpio = 0x8000,
135 },
120 }, 136 },
121 [SAA7134_BOARD_FLYVIDEO2000] = { 137 [SAA7134_BOARD_FLYVIDEO2000] = {
122 /* "TC Wan" <tcwan@cs.usm.my> */ 138 /* "TC Wan" <tcwan@cs.usm.my> */
123 .name = "LifeView FlyVIDEO2000", 139 .name = "LifeView FlyVIDEO2000",
124 .audio_clock = 0x00200000, 140 .audio_clock = 0x00200000,
125 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 141 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
142 .radio_type = UNSET,
143 .tuner_addr = ADDR_UNSET,
144 .radio_addr = ADDR_UNSET,
145
126 .gpiomask = 0xe000, 146 .gpiomask = 0xe000,
127 .inputs = {{ 147 .inputs = {{
128 .name = name_tv, 148 .name = name_tv,
@@ -146,14 +166,14 @@ struct saa7134_board saa7134_boards[] = {
146 .amux = LINE2, 166 .amux = LINE2,
147 .gpio = 0x4000, 167 .gpio = 0x4000,
148 }}, 168 }},
149 .radio = { 169 .radio = {
150 .name = name_radio, 170 .name = name_radio,
151 .amux = LINE2, 171 .amux = LINE2,
152 .gpio = 0x2000, 172 .gpio = 0x2000,
153 }, 173 },
154 .mute = { 174 .mute = {
155 .name = name_mute, 175 .name = name_mute,
156 .amux = LINE2, 176 .amux = LINE2,
157 .gpio = 0x8000, 177 .gpio = 0x8000,
158 }, 178 },
159 }, 179 },
@@ -162,6 +182,10 @@ struct saa7134_board saa7134_boards[] = {
162 .name = "LifeView FlyTV Platinum Mini", 182 .name = "LifeView FlyTV Platinum Mini",
163 .audio_clock = 0x00200000, 183 .audio_clock = 0x00200000,
164 .tuner_type = TUNER_PHILIPS_TDA8290, 184 .tuner_type = TUNER_PHILIPS_TDA8290,
185 .radio_type = UNSET,
186 .tuner_addr = ADDR_UNSET,
187 .radio_addr = ADDR_UNSET,
188
165 .inputs = {{ 189 .inputs = {{
166 .name = name_tv, 190 .name = name_tv,
167 .vmux = 1, 191 .vmux = 1,
@@ -183,6 +207,10 @@ struct saa7134_board saa7134_boards[] = {
183 .name = "LifeView FlyTV Platinum FM", 207 .name = "LifeView FlyTV Platinum FM",
184 .audio_clock = 0x00200000, 208 .audio_clock = 0x00200000,
185 .tuner_type = TUNER_PHILIPS_TDA8290, 209 .tuner_type = TUNER_PHILIPS_TDA8290,
210 .radio_type = UNSET,
211 .tuner_addr = ADDR_UNSET,
212 .radio_addr = ADDR_UNSET,
213
186 .gpiomask = 0x1E000, /* Set GP16 and unused 15,14,13 to Output */ 214 .gpiomask = 0x1E000, /* Set GP16 and unused 15,14,13 to Output */
187 .inputs = {{ 215 .inputs = {{
188 .name = name_tv, 216 .name = name_tv,
@@ -190,7 +218,7 @@ struct saa7134_board saa7134_boards[] = {
190 .amux = TV, 218 .amux = TV,
191 .gpio = 0x10000, /* GP16=1 selects TV input */ 219 .gpio = 0x10000, /* GP16=1 selects TV input */
192 .tv = 1, 220 .tv = 1,
193 },{ 221 },{
194/* .name = name_tv_mono, 222/* .name = name_tv_mono,
195 .vmux = 1, 223 .vmux = 1,
196 .amux = LINE2, 224 .amux = LINE2,
@@ -200,29 +228,38 @@ struct saa7134_board saa7134_boards[] = {
200*/ .name = name_comp1, /* Composite signal on S-Video input */ 228*/ .name = name_comp1, /* Composite signal on S-Video input */
201 .vmux = 0, 229 .vmux = 0,
202 .amux = LINE2, 230 .amux = LINE2,
203// .gpio = 0x4000, 231/* .gpio = 0x4000, */
204 },{ 232 },{
205 .name = name_comp2, /* Composite input */ 233 .name = name_comp2, /* Composite input */
206 .vmux = 3, 234 .vmux = 3,
207 .amux = LINE2, 235 .amux = LINE2,
208// .gpio = 0x4000, 236/* .gpio = 0x4000, */
209 },{ 237 },{
210 .name = name_svideo, /* S-Video signal on S-Video input */ 238 .name = name_svideo, /* S-Video signal on S-Video input */
211 .vmux = 8, 239 .vmux = 8,
212 .amux = LINE2, 240 .amux = LINE2,
213// .gpio = 0x4000, 241/* .gpio = 0x4000, */
214 }}, 242 }},
215 .radio = { 243 .radio = {
216 .name = name_radio, 244 .name = name_radio,
217 .amux = TV, 245 .amux = TV,
218 .gpio = 0x00000, /* GP16=0 selects FM radio antenna */ 246 .gpio = 0x00000, /* GP16=0 selects FM radio antenna */
219 }, 247 },
248 .mute = {
249 .name = name_mute,
250 .amux = TV,
251 .gpio = 0x10000,
252 },
220 }, 253 },
221 [SAA7134_BOARD_EMPRESS] = { 254 [SAA7134_BOARD_EMPRESS] = {
222 /* "Gert Vervoort" <gert.vervoort@philips.com> */ 255 /* "Gert Vervoort" <gert.vervoort@philips.com> */
223 .name = "EMPRESS", 256 .name = "EMPRESS",
224 .audio_clock = 0x00187de7, 257 .audio_clock = 0x00187de7,
225 .tuner_type = TUNER_PHILIPS_PAL, 258 .tuner_type = TUNER_PHILIPS_PAL,
259 .radio_type = UNSET,
260 .tuner_addr = ADDR_UNSET,
261 .radio_addr = ADDR_UNSET,
262
226 .inputs = {{ 263 .inputs = {{
227 .name = name_comp1, 264 .name = name_comp1,
228 .vmux = 0, 265 .vmux = 0,
@@ -245,33 +282,40 @@ struct saa7134_board saa7134_boards[] = {
245 .video_out = CCIR656, 282 .video_out = CCIR656,
246 }, 283 },
247 [SAA7134_BOARD_MONSTERTV] = { 284 [SAA7134_BOARD_MONSTERTV] = {
248 /* "K.Ohta" <alpha292@bremen.or.jp> */ 285 /* "K.Ohta" <alpha292@bremen.or.jp> */
249 .name = "SKNet Monster TV", 286 .name = "SKNet Monster TV",
250 .audio_clock = 0x00187de7, 287 .audio_clock = 0x00187de7,
251 .tuner_type = TUNER_PHILIPS_NTSC_M, 288 .tuner_type = TUNER_PHILIPS_NTSC_M,
252 .inputs = {{ 289 .radio_type = UNSET,
253 .name = name_tv, 290 .tuner_addr = ADDR_UNSET,
254 .vmux = 1, 291 .radio_addr = ADDR_UNSET,
255 .amux = TV, 292
256 .tv = 1, 293 .inputs = {{
257 },{ 294 .name = name_tv,
258 .name = name_comp1, 295 .vmux = 1,
259 .vmux = 0, 296 .amux = TV,
260 .amux = LINE1, 297 .tv = 1,
261 },{ 298 },{
262 .name = name_svideo, 299 .name = name_comp1,
263 .vmux = 8, 300 .vmux = 0,
264 .amux = LINE1, 301 .amux = LINE1,
265 }}, 302 },{
266 .radio = { 303 .name = name_svideo,
267 .name = name_radio, 304 .vmux = 8,
268 .amux = LINE2, 305 .amux = LINE1,
269 }, 306 }},
307 .radio = {
308 .name = name_radio,
309 .amux = LINE2,
310 },
270 }, 311 },
271 [SAA7134_BOARD_MD9717] = { 312 [SAA7134_BOARD_MD9717] = {
272 .name = "Tevion MD 9717", 313 .name = "Tevion MD 9717",
273 .audio_clock = 0x00200000, 314 .audio_clock = 0x00200000,
274 .tuner_type = TUNER_PHILIPS_PAL, 315 .tuner_type = TUNER_PHILIPS_PAL,
316 .radio_type = UNSET,
317 .tuner_addr = ADDR_UNSET,
318 .radio_addr = ADDR_UNSET,
275 .inputs = {{ 319 .inputs = {{
276 .name = name_tv, 320 .name = name_tv,
277 .vmux = 1, 321 .vmux = 1,
@@ -302,10 +346,13 @@ struct saa7134_board saa7134_boards[] = {
302 }, 346 },
303 }, 347 },
304 [SAA7134_BOARD_TVSTATION_RDS] = { 348 [SAA7134_BOARD_TVSTATION_RDS] = {
305 /* Typhoon TV Tuner RDS: Art.Nr. 50694 */ 349 /* Typhoon TV Tuner RDS: Art.Nr. 50694 */
306 .name = "KNC One TV-Station RDS / Typhoon TV Tuner RDS", 350 .name = "KNC One TV-Station RDS / Typhoon TV Tuner RDS",
307 .audio_clock = 0x00200000, 351 .audio_clock = 0x00200000,
308 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 352 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
353 .radio_type = UNSET,
354 .tuner_addr = ADDR_UNSET,
355 .radio_addr = ADDR_UNSET,
309 .tda9887_conf = TDA9887_PRESENT, 356 .tda9887_conf = TDA9887_PRESENT,
310 .inputs = {{ 357 .inputs = {{
311 .name = name_tv, 358 .name = name_tv,
@@ -314,10 +361,10 @@ struct saa7134_board saa7134_boards[] = {
314 .tv = 1, 361 .tv = 1,
315 },{ 362 },{
316 .name = name_tv_mono, 363 .name = name_tv_mono,
317 .vmux = 1, 364 .vmux = 1,
318 .amux = LINE2, 365 .amux = LINE2,
319 .tv = 1, 366 .tv = 1,
320 },{ 367 },{
321 368
322 .name = name_svideo, 369 .name = name_svideo,
323 .vmux = 8, 370 .vmux = 8,
@@ -328,10 +375,10 @@ struct saa7134_board saa7134_boards[] = {
328 .amux = LINE1, 375 .amux = LINE1,
329 },{ 376 },{
330 377
331 .name = "CVid over SVid", 378 .name = "CVid over SVid",
332 .vmux = 0, 379 .vmux = 0,
333 .amux = LINE1, 380 .amux = LINE1,
334 }}, 381 }},
335 .radio = { 382 .radio = {
336 .name = name_radio, 383 .name = name_radio,
337 .amux = LINE2, 384 .amux = LINE2,
@@ -341,6 +388,9 @@ struct saa7134_board saa7134_boards[] = {
341 .name = "KNC One TV-Station DVR", 388 .name = "KNC One TV-Station DVR",
342 .audio_clock = 0x00200000, 389 .audio_clock = 0x00200000,
343 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 390 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
391 .radio_type = UNSET,
392 .tuner_addr = ADDR_UNSET,
393 .radio_addr = ADDR_UNSET,
344 .tda9887_conf = TDA9887_PRESENT, 394 .tda9887_conf = TDA9887_PRESENT,
345 .gpiomask = 0x820000, 395 .gpiomask = 0x820000,
346 .inputs = {{ 396 .inputs = {{
@@ -369,32 +419,38 @@ struct saa7134_board saa7134_boards[] = {
369 .video_out = CCIR656, 419 .video_out = CCIR656,
370 }, 420 },
371 [SAA7134_BOARD_CINERGY400] = { 421 [SAA7134_BOARD_CINERGY400] = {
372 .name = "Terratec Cinergy 400 TV", 422 .name = "Terratec Cinergy 400 TV",
373 .audio_clock = 0x00200000, 423 .audio_clock = 0x00200000,
374 .tuner_type = TUNER_PHILIPS_PAL, 424 .tuner_type = TUNER_PHILIPS_PAL,
375 .inputs = {{ 425 .radio_type = UNSET,
376 .name = name_tv, 426 .tuner_addr = ADDR_UNSET,
377 .vmux = 1, 427 .radio_addr = ADDR_UNSET,
378 .amux = TV, 428 .inputs = {{
379 .tv = 1, 429 .name = name_tv,
380 },{ 430 .vmux = 1,
381 .name = name_comp1, 431 .amux = TV,
382 .vmux = 4, 432 .tv = 1,
383 .amux = LINE1, 433 },{
384 },{ 434 .name = name_comp1,
385 .name = name_svideo, 435 .vmux = 4,
386 .vmux = 8, 436 .amux = LINE1,
387 .amux = LINE1, 437 },{
388 },{ 438 .name = name_svideo,
389 .name = name_comp2, // CVideo over SVideo Connector 439 .vmux = 8,
390 .vmux = 0, 440 .amux = LINE1,
391 .amux = LINE1, 441 },{
392 }} 442 .name = name_comp2, /* CVideo over SVideo Connector */
393 }, 443 .vmux = 0,
444 .amux = LINE1,
445 }}
446 },
394 [SAA7134_BOARD_MD5044] = { 447 [SAA7134_BOARD_MD5044] = {
395 .name = "Medion 5044", 448 .name = "Medion 5044",
396 .audio_clock = 0x00187de7, // was: 0x00200000, 449 .audio_clock = 0x00187de7, /* was: 0x00200000, */
397 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 450 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
451 .radio_type = UNSET,
452 .tuner_addr = ADDR_UNSET,
453 .radio_addr = ADDR_UNSET,
398 .tda9887_conf = TDA9887_PRESENT, 454 .tda9887_conf = TDA9887_PRESENT,
399 .inputs = {{ 455 .inputs = {{
400 .name = name_tv, 456 .name = name_tv,
@@ -426,57 +482,65 @@ struct saa7134_board saa7134_boards[] = {
426 }, 482 },
427 }, 483 },
428 [SAA7134_BOARD_KWORLD] = { 484 [SAA7134_BOARD_KWORLD] = {
429 .name = "Kworld/KuroutoShikou SAA7130-TVPCI", 485 .name = "Kworld/KuroutoShikou SAA7130-TVPCI",
430 .audio_clock = 0x00187de7, 486 .audio_clock = 0x00187de7,
431 .tuner_type = TUNER_PHILIPS_NTSC_M, 487 .tuner_type = TUNER_PHILIPS_NTSC_M,
432 .inputs = {{ 488 .radio_type = UNSET,
433 .name = name_svideo, 489 .tuner_addr = ADDR_UNSET,
434 .vmux = 8, 490 .radio_addr = ADDR_UNSET,
435 .amux = LINE1, 491 .inputs = {{
436 },{ 492 .name = name_svideo,
437 .name = name_comp1, 493 .vmux = 8,
438 .vmux = 3, 494 .amux = LINE1,
439 .amux = LINE1, 495 },{
440 },{ 496 .name = name_comp1,
441 .name = name_tv, 497 .vmux = 3,
442 .vmux = 1, 498 .amux = LINE1,
443 .amux = LINE2, 499 },{
444 .tv = 1, 500 .name = name_tv,
445 }}, 501 .vmux = 1,
446 }, 502 .amux = LINE2,
503 .tv = 1,
504 }},
505 },
447 [SAA7134_BOARD_CINERGY600] = { 506 [SAA7134_BOARD_CINERGY600] = {
448 .name = "Terratec Cinergy 600 TV", 507 .name = "Terratec Cinergy 600 TV",
449 .audio_clock = 0x00200000, 508 .audio_clock = 0x00200000,
450 .tuner_type = TUNER_PHILIPS_PAL, 509 .tuner_type = TUNER_PHILIPS_PAL,
510 .radio_type = UNSET,
511 .tuner_addr = ADDR_UNSET,
512 .radio_addr = ADDR_UNSET,
451 .tda9887_conf = TDA9887_PRESENT, 513 .tda9887_conf = TDA9887_PRESENT,
452 .inputs = {{ 514 .inputs = {{
453 .name = name_tv, 515 .name = name_tv,
454 .vmux = 1, 516 .vmux = 1,
455 .amux = TV, 517 .amux = TV,
456 .tv = 1, 518 .tv = 1,
457 },{ 519 },{
458 .name = name_comp1, 520 .name = name_comp1,
459 .vmux = 4, 521 .vmux = 4,
460 .amux = LINE1, 522 .amux = LINE1,
461 },{ 523 },{
462 .name = name_svideo, 524 .name = name_svideo,
463 .vmux = 8, 525 .vmux = 8,
464 .amux = LINE1, 526 .amux = LINE1,
465 },{ 527 },{
466 .name = name_comp2, // CVideo over SVideo Connector 528 .name = name_comp2, /* CVideo over SVideo Connector */
467 .vmux = 0, 529 .vmux = 0,
468 .amux = LINE1, 530 .amux = LINE1,
469 }}, 531 }},
470 .radio = { 532 .radio = {
471 .name = name_radio, 533 .name = name_radio,
472 .amux = LINE2, 534 .amux = LINE2,
473 }, 535 },
474 }, 536 },
475 [SAA7134_BOARD_MD7134] = { 537 [SAA7134_BOARD_MD7134] = {
476 .name = "Medion 7134", 538 .name = "Medion 7134",
477 //.audio_clock = 0x00200000,
478 .audio_clock = 0x00187de7, 539 .audio_clock = 0x00187de7,
479 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 540 .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3,
541 .radio_type = UNSET,
542 .tuner_addr = ADDR_UNSET,
543 .radio_addr = ADDR_UNSET,
480 .tda9887_conf = TDA9887_PRESENT, 544 .tda9887_conf = TDA9887_PRESENT,
481 .mpeg = SAA7134_MPEG_DVB, 545 .mpeg = SAA7134_MPEG_DVB,
482 .inputs = {{ 546 .inputs = {{
@@ -504,6 +568,9 @@ struct saa7134_board saa7134_boards[] = {
504 .name = "Typhoon TV+Radio 90031", 568 .name = "Typhoon TV+Radio 90031",
505 .audio_clock = 0x00200000, 569 .audio_clock = 0x00200000,
506 .tuner_type = TUNER_PHILIPS_PAL, 570 .tuner_type = TUNER_PHILIPS_PAL,
571 .radio_type = UNSET,
572 .tuner_addr = ADDR_UNSET,
573 .radio_addr = ADDR_UNSET,
507 .tda9887_conf = TDA9887_PRESENT, 574 .tda9887_conf = TDA9887_PRESENT,
508 .inputs = {{ 575 .inputs = {{
509 .name = name_tv, 576 .name = name_tv,
@@ -523,11 +590,14 @@ struct saa7134_board saa7134_boards[] = {
523 .name = name_radio, 590 .name = name_radio,
524 .amux = LINE2, 591 .amux = LINE2,
525 }, 592 },
526 }, 593 },
527 [SAA7134_BOARD_ELSA] = { 594 [SAA7134_BOARD_ELSA] = {
528 .name = "ELSA EX-VISION 300TV", 595 .name = "ELSA EX-VISION 300TV",
529 .audio_clock = 0x00187de7, 596 .audio_clock = 0x00187de7,
530 .tuner_type = TUNER_HITACHI_NTSC, 597 .tuner_type = TUNER_HITACHI_NTSC,
598 .radio_type = UNSET,
599 .tuner_addr = ADDR_UNSET,
600 .radio_addr = ADDR_UNSET,
531 .inputs = {{ 601 .inputs = {{
532 .name = name_svideo, 602 .name = name_svideo,
533 .vmux = 8, 603 .vmux = 8,
@@ -542,11 +612,14 @@ struct saa7134_board saa7134_boards[] = {
542 .amux = LINE2, 612 .amux = LINE2,
543 .tv = 1, 613 .tv = 1,
544 }}, 614 }},
545 }, 615 },
546 [SAA7134_BOARD_ELSA_500TV] = { 616 [SAA7134_BOARD_ELSA_500TV] = {
547 .name = "ELSA EX-VISION 500TV", 617 .name = "ELSA EX-VISION 500TV",
548 .audio_clock = 0x00187de7, 618 .audio_clock = 0x00187de7,
549 .tuner_type = TUNER_HITACHI_NTSC, 619 .tuner_type = TUNER_HITACHI_NTSC,
620 .radio_type = UNSET,
621 .tuner_addr = ADDR_UNSET,
622 .radio_addr = ADDR_UNSET,
550 .inputs = {{ 623 .inputs = {{
551 .name = name_svideo, 624 .name = name_svideo,
552 .vmux = 7, 625 .vmux = 7,
@@ -562,83 +635,100 @@ struct saa7134_board saa7134_boards[] = {
562 .amux = LINE2, 635 .amux = LINE2,
563 .tv = 1, 636 .tv = 1,
564 }}, 637 }},
565 }, 638 },
566 [SAA7134_BOARD_ASUSTeK_TVFM7134] = { 639 [SAA7134_BOARD_ASUSTeK_TVFM7134] = {
567 .name = "ASUS TV-FM 7134", 640 .name = "ASUS TV-FM 7134",
568 .audio_clock = 0x00187de7, 641 .audio_clock = 0x00187de7,
569 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 642 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
570 .tda9887_conf = TDA9887_PRESENT, 643 .radio_type = UNSET,
571 .inputs = {{ 644 .tuner_addr = ADDR_UNSET,
572 .name = name_tv, 645 .radio_addr = ADDR_UNSET,
573 .vmux = 1, 646 .tda9887_conf = TDA9887_PRESENT,
574 .amux = TV, 647 .inputs = {{
575 .tv = 1, 648 .name = name_tv,
576 },{ 649 .vmux = 1,
577 .name = name_comp1, 650 .amux = TV,
578 .vmux = 4, 651 .tv = 1,
579 .amux = LINE2, 652 },{
580 },{ 653 .name = name_comp1,
581 .name = name_svideo, 654 .vmux = 4,
582 .vmux = 6, 655 .amux = LINE2,
583 .amux = LINE2, 656 },{
584 }}, 657 .name = name_svideo,
585 .radio = { 658 .vmux = 6,
586 .name = name_radio, 659 .amux = LINE2,
587 .amux = LINE1, 660 }},
588 }, 661 .radio = {
589 }, 662 .name = name_radio,
590 [SAA7135_BOARD_ASUSTeK_TVFM7135] = { 663 .amux = LINE1,
591 .name = "ASUS TV-FM 7135", 664 },
592 .audio_clock = 0x00187de7, 665 },
593 .tuner_type = TUNER_PHILIPS_TDA8290, 666 [SAA7134_BOARD_ASUSTeK_TVFM7135] = {
667 .name = "ASUS TV-FM 7135",
668 .audio_clock = 0x00187de7,
669 .tuner_type = TUNER_PHILIPS_TDA8290,
670 .radio_type = UNSET,
671 .tuner_addr = ADDR_UNSET,
672 .radio_addr = ADDR_UNSET,
594 .gpiomask = 0x200000, 673 .gpiomask = 0x200000,
595 .inputs = {{ 674 .inputs = {{
596 .name = name_tv, 675 .name = name_tv,
597 .vmux = 1, 676 .vmux = 1,
598 .amux = TV, 677 .amux = TV,
599 .gpio = 0x0000, 678 .gpio = 0x0000,
600 .tv = 1, 679 .tv = 1,
601 },{ 680 },{
602 .name = name_comp1, 681 .name = name_comp1,
603 .vmux = 4, 682 .vmux = 4,
604 .amux = LINE2, 683 .amux = LINE2,
605 .gpio = 0x0000, 684 .gpio = 0x0000,
606 },{ 685 },{
607 .name = name_svideo, 686 .name = name_svideo,
608 .vmux = 6, 687 .vmux = 6,
609 .amux = LINE2, 688 .amux = LINE2,
610 .gpio = 0x0000, 689 .gpio = 0x0000,
611 }}, 690 }},
612 .radio = { 691 .radio = {
613 .name = name_radio, 692 .name = name_radio,
614 .amux = TV, 693 .amux = TV,
615 .gpio = 0x200000, 694 .gpio = 0x200000,
616 }, 695 },
696 .mute = {
697 .name = name_mute,
698 .gpio = 0x0000,
699 },
700
617 }, 701 },
618 [SAA7134_BOARD_VA1000POWER] = { 702 [SAA7134_BOARD_VA1000POWER] = {
619 .name = "AOPEN VA1000 POWER", 703 .name = "AOPEN VA1000 POWER",
620 .audio_clock = 0x00187de7, 704 .audio_clock = 0x00187de7,
621 .tuner_type = TUNER_PHILIPS_NTSC, 705 .tuner_type = TUNER_PHILIPS_NTSC,
622 .inputs = {{ 706 .radio_type = UNSET,
623 .name = name_svideo, 707 .tuner_addr = ADDR_UNSET,
624 .vmux = 8, 708 .radio_addr = ADDR_UNSET,
625 .amux = LINE1, 709 .inputs = {{
626 },{ 710 .name = name_svideo,
627 .name = name_comp1, 711 .vmux = 8,
628 .vmux = 3, 712 .amux = LINE1,
629 .amux = LINE1, 713 },{
630 },{ 714 .name = name_comp1,
631 .name = name_tv, 715 .vmux = 3,
632 .vmux = 1, 716 .amux = LINE1,
633 .amux = LINE2, 717 },{
634 .tv = 1, 718 .name = name_tv,
635 }}, 719 .vmux = 1,
720 .amux = LINE2,
721 .tv = 1,
722 }},
636 }, 723 },
637 [SAA7134_BOARD_10MOONSTVMASTER] = { 724 [SAA7134_BOARD_10MOONSTVMASTER] = {
638 /* "lilicheng" <llc@linuxfans.org> */ 725 /* "lilicheng" <llc@linuxfans.org> */
639 .name = "10MOONS PCI TV CAPTURE CARD", 726 .name = "10MOONS PCI TV CAPTURE CARD",
640 .audio_clock = 0x00200000, 727 .audio_clock = 0x00200000,
641 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 728 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
729 .radio_type = UNSET,
730 .tuner_addr = ADDR_UNSET,
731 .radio_addr = ADDR_UNSET,
642 .gpiomask = 0xe000, 732 .gpiomask = 0xe000,
643 .inputs = {{ 733 .inputs = {{
644 .name = name_tv, 734 .name = name_tv,
@@ -662,14 +752,14 @@ struct saa7134_board saa7134_boards[] = {
662 .amux = LINE2, 752 .amux = LINE2,
663 .gpio = 0x4000, 753 .gpio = 0x4000,
664 }}, 754 }},
665 .radio = { 755 .radio = {
666 .name = name_radio, 756 .name = name_radio,
667 .amux = LINE2, 757 .amux = LINE2,
668 .gpio = 0x2000, 758 .gpio = 0x2000,
669 }, 759 },
670 .mute = { 760 .mute = {
671 .name = name_mute, 761 .name = name_mute,
672 .amux = LINE2, 762 .amux = LINE2,
673 .gpio = 0x8000, 763 .gpio = 0x8000,
674 }, 764 },
675 }, 765 },
@@ -678,6 +768,9 @@ struct saa7134_board saa7134_boards[] = {
678 .name = "BMK MPEX No Tuner", 768 .name = "BMK MPEX No Tuner",
679 .audio_clock = 0x200000, 769 .audio_clock = 0x200000,
680 .tuner_type = TUNER_ABSENT, 770 .tuner_type = TUNER_ABSENT,
771 .radio_type = UNSET,
772 .tuner_addr = ADDR_UNSET,
773 .radio_addr = ADDR_UNSET,
681 .inputs = {{ 774 .inputs = {{
682 .name = name_comp1, 775 .name = name_comp1,
683 .vmux = 4, 776 .vmux = 4,
@@ -706,80 +799,94 @@ struct saa7134_board saa7134_boards[] = {
706 .name = "Compro VideoMate TV", 799 .name = "Compro VideoMate TV",
707 .audio_clock = 0x00187de7, 800 .audio_clock = 0x00187de7,
708 .tuner_type = TUNER_PHILIPS_NTSC_M, 801 .tuner_type = TUNER_PHILIPS_NTSC_M,
709 .inputs = {{ 802 .radio_type = UNSET,
710 .name = name_svideo, 803 .tuner_addr = ADDR_UNSET,
711 .vmux = 8, 804 .radio_addr = ADDR_UNSET,
712 .amux = LINE1, 805 .inputs = {{
713 },{ 806 .name = name_svideo,
714 .name = name_comp1, 807 .vmux = 8,
715 .vmux = 3, 808 .amux = LINE1,
716 .amux = LINE1, 809 },{
717 },{ 810 .name = name_comp1,
718 .name = name_tv, 811 .vmux = 3,
719 .vmux = 1, 812 .amux = LINE1,
720 .amux = LINE2, 813 },{
721 .tv = 1, 814 .name = name_tv,
722 }}, 815 .vmux = 1,
723 }, 816 .amux = LINE2,
724 [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = { 817 .tv = 1,
818 }},
819 },
820 [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = {
725 .name = "Compro VideoMate TV Gold+", 821 .name = "Compro VideoMate TV Gold+",
726 .audio_clock = 0x00187de7, 822 .audio_clock = 0x00187de7,
727 .tuner_type = TUNER_PHILIPS_NTSC_M, 823 .tuner_type = TUNER_PHILIPS_NTSC_M,
728 .gpiomask = 0x800c0000, 824 .gpiomask = 0x800c0000,
729 .inputs = {{ 825 .radio_type = UNSET,
730 .name = name_svideo, 826 .tuner_addr = ADDR_UNSET,
731 .vmux = 8, 827 .radio_addr = ADDR_UNSET,
732 .amux = LINE1, 828 .inputs = {{
733 .gpio = 0x06c00012, 829 .name = name_svideo,
734 },{ 830 .vmux = 8,
735 .name = name_comp1, 831 .amux = LINE1,
736 .vmux = 3, 832 .gpio = 0x06c00012,
737 .amux = LINE1, 833 },{
738 .gpio = 0x0ac20012, 834 .name = name_comp1,
739 },{ 835 .vmux = 3,
740 .name = name_tv, 836 .amux = LINE1,
741 .vmux = 1, 837 .gpio = 0x0ac20012,
742 .amux = LINE2, 838 },{
743 .gpio = 0x08c20012, 839 .name = name_tv,
744 .tv = 1, 840 .vmux = 1,
745 }}, 841 .amux = LINE2,
746 }, 842 .gpio = 0x08c20012,
843 .tv = 1,
844 }}, /* radio and probably mute is missing */
845 },
747 [SAA7134_BOARD_CRONOS_PLUS] = { 846 [SAA7134_BOARD_CRONOS_PLUS] = {
748 /* gpio pins: 847 /*
749 0 .. 3 BASE_ID 848 gpio pins:
750 4 .. 7 PROTECT_ID 849 0 .. 3 BASE_ID
751 8 .. 11 USER_OUT 850 4 .. 7 PROTECT_ID
752 12 .. 13 USER_IN 851 8 .. 11 USER_OUT
753 14 .. 15 VIDIN_SEL */ 852 12 .. 13 USER_IN
853 14 .. 15 VIDIN_SEL
854 */
754 .name = "Matrox CronosPlus", 855 .name = "Matrox CronosPlus",
755 .tuner_type = TUNER_ABSENT, 856 .tuner_type = TUNER_ABSENT,
857 .radio_type = UNSET,
858 .tuner_addr = ADDR_UNSET,
859 .radio_addr = ADDR_UNSET,
756 .gpiomask = 0xcf00, 860 .gpiomask = 0xcf00,
757 .inputs = {{ 861 .inputs = {{
758 .name = name_comp1, 862 .name = name_comp1,
759 .vmux = 0, 863 .vmux = 0,
760 .gpio = 2 << 14, 864 .gpio = 2 << 14,
761 },{ 865 },{
762 .name = name_comp2, 866 .name = name_comp2,
763 .vmux = 0, 867 .vmux = 0,
764 .gpio = 1 << 14, 868 .gpio = 1 << 14,
765 },{ 869 },{
766 .name = name_comp3, 870 .name = name_comp3,
767 .vmux = 0, 871 .vmux = 0,
768 .gpio = 0 << 14, 872 .gpio = 0 << 14,
769 },{ 873 },{
770 .name = name_comp4, 874 .name = name_comp4,
771 .vmux = 0, 875 .vmux = 0,
772 .gpio = 3 << 14, 876 .gpio = 3 << 14,
773 },{ 877 },{
774 .name = name_svideo, 878 .name = name_svideo,
775 .vmux = 8, 879 .vmux = 8,
776 .gpio = 2 << 14, 880 .gpio = 2 << 14,
777 }}, 881 }},
778 }, 882 },
779 [SAA7134_BOARD_MD2819] = { 883 [SAA7134_BOARD_MD2819] = {
780 .name = "AverMedia M156 / Medion 2819", 884 .name = "AverMedia M156 / Medion 2819",
781 .audio_clock = 0x00187de7, 885 .audio_clock = 0x00187de7,
782 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 886 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
887 .radio_type = UNSET,
888 .tuner_addr = ADDR_UNSET,
889 .radio_addr = ADDR_UNSET,
783 .tda9887_conf = TDA9887_PRESENT, 890 .tda9887_conf = TDA9887_PRESENT,
784 .inputs = {{ 891 .inputs = {{
785 .name = name_tv, 892 .name = name_tv,
@@ -809,6 +916,9 @@ struct saa7134_board saa7134_boards[] = {
809 .name = "BMK MPEX Tuner", 916 .name = "BMK MPEX Tuner",
810 .audio_clock = 0x200000, 917 .audio_clock = 0x200000,
811 .tuner_type = TUNER_PHILIPS_PAL, 918 .tuner_type = TUNER_PHILIPS_PAL,
919 .radio_type = UNSET,
920 .tuner_addr = ADDR_UNSET,
921 .radio_addr = ADDR_UNSET,
812 .inputs = {{ 922 .inputs = {{
813 .name = name_comp1, 923 .name = name_comp1,
814 .vmux = 1, 924 .vmux = 1,
@@ -825,62 +935,72 @@ struct saa7134_board saa7134_boards[] = {
825 }}, 935 }},
826 .mpeg = SAA7134_MPEG_EMPRESS, 936 .mpeg = SAA7134_MPEG_EMPRESS,
827 .video_out = CCIR656, 937 .video_out = CCIR656,
828 }, 938 },
829 [SAA7134_BOARD_ASUSTEK_TVFM7133] = { 939 [SAA7134_BOARD_ASUSTEK_TVFM7133] = {
830 .name = "ASUS TV-FM 7133", 940 .name = "ASUS TV-FM 7133",
831 .audio_clock = 0x00187de7, 941 .audio_clock = 0x00187de7,
832 // probably wrong, the 7133 one is the NTSC version ... 942 /* probably wrong, the 7133 one is the NTSC version ...
833 // .tuner_type = TUNER_PHILIPS_FM1236_MK3 943 * .tuner_type = TUNER_PHILIPS_FM1236_MK3 */
834 .tuner_type = TUNER_LG_NTSC_NEW_TAPC, 944 .tuner_type = TUNER_LG_NTSC_NEW_TAPC,
835 .tda9887_conf = TDA9887_PRESENT, 945 .radio_type = UNSET,
836 .inputs = {{ 946 .tuner_addr = ADDR_UNSET,
837 .name = name_tv, 947 .radio_addr = ADDR_UNSET,
838 .vmux = 1, 948 .tda9887_conf = TDA9887_PRESENT,
839 .amux = TV, 949 .inputs = {{
840 .tv = 1, 950 .name = name_tv,
841 },{ 951 .vmux = 1,
842 .name = name_comp1, 952 .amux = TV,
843 .vmux = 4, 953 .tv = 1,
844 .amux = LINE2, 954
845 },{ 955 },{
846 .name = name_svideo, 956 .name = name_comp1,
847 .vmux = 6, 957 .vmux = 4,
848 .amux = LINE2, 958 .amux = LINE2,
849 }}, 959 },{
850 .radio = { 960 .name = name_svideo,
851 .name = name_radio, 961 .vmux = 6,
852 .amux = LINE1, 962 .amux = LINE2,
853 }, 963 }},
854 }, 964 .radio = {
965 .name = name_radio,
966 .amux = LINE1,
967 },
968 },
855 [SAA7134_BOARD_PINNACLE_PCTV_STEREO] = { 969 [SAA7134_BOARD_PINNACLE_PCTV_STEREO] = {
856 .name = "Pinnacle PCTV Stereo (saa7134)", 970 .name = "Pinnacle PCTV Stereo (saa7134)",
857 .audio_clock = 0x00187de7, 971 .audio_clock = 0x00187de7,
858 .tuner_type = TUNER_MT2032, 972 .tuner_type = TUNER_MT2032,
859 .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, 973 .radio_type = UNSET,
860 .inputs = {{ 974 .tuner_addr = ADDR_UNSET,
861 .name = name_tv, 975 .radio_addr = ADDR_UNSET,
862 .vmux = 3, 976 .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER,
863 .amux = TV, 977 .inputs = {{
864 .tv = 1, 978 .name = name_tv,
865 },{ 979 .vmux = 3,
866 .name = name_comp1, 980 .amux = TV,
867 .vmux = 0, 981 .tv = 1,
868 .amux = LINE2, 982 },{
869 },{ 983 .name = name_comp1,
870 .name = name_comp2, 984 .vmux = 0,
871 .vmux = 1, 985 .amux = LINE2,
872 .amux = LINE2, 986 },{
873 },{ 987 .name = name_comp2,
874 .name = name_svideo, 988 .vmux = 1,
875 .vmux = 8, 989 .amux = LINE2,
876 .amux = LINE2, 990 },{
877 }}, 991 .name = name_svideo,
878 }, 992 .vmux = 8,
993 .amux = LINE2,
994 }},
995 },
879 [SAA7134_BOARD_MANLI_MTV002] = { 996 [SAA7134_BOARD_MANLI_MTV002] = {
880 /* Ognjen Nastic <ognjen@logosoft.ba> */ 997 /* Ognjen Nastic <ognjen@logosoft.ba> */
881 .name = "Manli MuchTV M-TV002/Behold TV 403 FM", 998 .name = "Manli MuchTV M-TV002/Behold TV 403 FM",
882 .audio_clock = 0x00200000, 999 .audio_clock = 0x00200000,
883 .tuner_type = TUNER_PHILIPS_PAL, 1000 .tuner_type = TUNER_PHILIPS_PAL,
1001 .radio_type = UNSET,
1002 .tuner_addr = ADDR_UNSET,
1003 .radio_addr = ADDR_UNSET,
884 .inputs = {{ 1004 .inputs = {{
885 .name = name_svideo, 1005 .name = name_svideo,
886 .vmux = 8, 1006 .vmux = 8,
@@ -905,6 +1025,9 @@ struct saa7134_board saa7134_boards[] = {
905 .name = "Manli MuchTV M-TV001/Behold TV 401", 1025 .name = "Manli MuchTV M-TV001/Behold TV 401",
906 .audio_clock = 0x00200000, 1026 .audio_clock = 0x00200000,
907 .tuner_type = TUNER_PHILIPS_PAL, 1027 .tuner_type = TUNER_PHILIPS_PAL,
1028 .radio_type = UNSET,
1029 .tuner_addr = ADDR_UNSET,
1030 .radio_addr = ADDR_UNSET,
908 .inputs = {{ 1031 .inputs = {{
909 .name = name_svideo, 1032 .name = name_svideo,
910 .vmux = 8, 1033 .vmux = 8,
@@ -921,14 +1044,17 @@ struct saa7134_board saa7134_boards[] = {
921 }}, 1044 }},
922 .mute = { 1045 .mute = {
923 .name = name_mute, 1046 .name = name_mute,
924 .amux = LINE1, 1047 .amux = LINE1,
925 }, 1048 },
926 }, 1049 },
927 [SAA7134_BOARD_TG3000TV] = { 1050 [SAA7134_BOARD_TG3000TV] = {
928 /* TransGear 3000TV */ 1051 /* TransGear 3000TV */
929 .name = "Nagase Sangyo TransGear 3000TV", 1052 .name = "Nagase Sangyo TransGear 3000TV",
930 .audio_clock = 0x00187de7, 1053 .audio_clock = 0x00187de7,
931 .tuner_type = TUNER_PHILIPS_NTSC_M, 1054 .tuner_type = TUNER_PHILIPS_NTSC_M,
1055 .radio_type = UNSET,
1056 .tuner_addr = ADDR_UNSET,
1057 .radio_addr = ADDR_UNSET,
932 .inputs = {{ 1058 .inputs = {{
933 .name = name_tv, 1059 .name = name_tv,
934 .vmux = 1, 1060 .vmux = 1,
@@ -944,81 +1070,90 @@ struct saa7134_board saa7134_boards[] = {
944 .amux = LINE2, 1070 .amux = LINE2,
945 }}, 1071 }},
946 }, 1072 },
947 [SAA7134_BOARD_ECS_TVP3XP] = { 1073 [SAA7134_BOARD_ECS_TVP3XP] = {
948 .name = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ", 1074 .name = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ",
949 .audio_clock = 0x187de7, // xtal 32.1 MHz 1075 .audio_clock = 0x187de7, /* xtal 32.1 MHz */
950 .tuner_type = TUNER_PHILIPS_PAL, 1076 .tuner_type = TUNER_PHILIPS_PAL,
951 .inputs = {{ 1077 .radio_type = UNSET,
952 .name = name_tv, 1078 .tuner_addr = ADDR_UNSET,
953 .vmux = 1, 1079 .radio_addr = ADDR_UNSET,
954 .amux = TV, 1080 .inputs = {{
955 .tv = 1, 1081 .name = name_tv,
956 },{ 1082 .vmux = 1,
957 .name = name_tv_mono, 1083 .amux = TV,
958 .vmux = 1, 1084 .tv = 1,
959 .amux = LINE2, 1085 },{
960 .tv = 1, 1086 .name = name_tv_mono,
961 },{ 1087 .vmux = 1,
962 .name = name_comp1, 1088 .amux = LINE2,
963 .vmux = 3, 1089 .tv = 1,
964 .amux = LINE1, 1090 },{
965 },{ 1091 .name = name_comp1,
966 .name = name_svideo, 1092 .vmux = 3,
967 .vmux = 8, 1093 .amux = LINE1,
968 .amux = LINE1, 1094 },{
1095 .name = name_svideo,
1096 .vmux = 8,
1097 .amux = LINE1,
969 },{ 1098 },{
970 .name = "CVid over SVid", 1099 .name = "CVid over SVid",
971 .vmux = 0, 1100 .vmux = 0,
972 .amux = LINE1, 1101 .amux = LINE1,
973 }}, 1102 }},
974 .radio = { 1103 .radio = {
975 .name = name_radio, 1104 .name = name_radio,
976 .amux = LINE2, 1105 .amux = LINE2,
977 }, 1106 },
978 }, 1107 },
979 [SAA7134_BOARD_ECS_TVP3XP_4CB5] = { 1108 [SAA7134_BOARD_ECS_TVP3XP_4CB5] = {
980 .name = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)", 1109 .name = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)",
981 .audio_clock = 0x187de7, 1110 .audio_clock = 0x187de7,
982 .tuner_type = TUNER_PHILIPS_NTSC, 1111 .tuner_type = TUNER_PHILIPS_NTSC,
983 .inputs = {{ 1112 .radio_type = UNSET,
984 .name = name_tv, 1113 .tuner_addr = ADDR_UNSET,
985 .vmux = 1, 1114 .radio_addr = ADDR_UNSET,
986 .amux = TV, 1115 .inputs = {{
987 .tv = 1, 1116 .name = name_tv,
988 },{ 1117 .vmux = 1,
989 .name = name_tv_mono, 1118 .amux = TV,
990 .vmux = 1, 1119 .tv = 1,
991 .amux = LINE2, 1120 },{
992 .tv = 1, 1121 .name = name_tv_mono,
993 },{ 1122 .vmux = 1,
994 .name = name_comp1, 1123 .amux = LINE2,
995 .vmux = 3, 1124 .tv = 1,
996 .amux = LINE1, 1125 },{
997 },{ 1126 .name = name_comp1,
998 .name = name_svideo, 1127 .vmux = 3,
999 .vmux = 8, 1128 .amux = LINE1,
1000 .amux = LINE1, 1129 },{
1001 },{ 1130 .name = name_svideo,
1002 .name = "CVid over SVid", 1131 .vmux = 8,
1003 .vmux = 0, 1132 .amux = LINE1,
1004 .amux = LINE1, 1133 },{
1005 }}, 1134 .name = "CVid over SVid",
1006 .radio = { 1135 .vmux = 0,
1007 .name = name_radio, 1136 .amux = LINE1,
1008 .amux = LINE2, 1137 }},
1009 }, 1138 .radio = {
1010 }, 1139 .name = name_radio,
1140 .amux = LINE2,
1141 },
1142 },
1011 [SAA7134_BOARD_AVACSSMARTTV] = { 1143 [SAA7134_BOARD_AVACSSMARTTV] = {
1012 /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */ 1144 /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */
1013 .name = "AVACS SmartTV", 1145 .name = "AVACS SmartTV",
1014 .audio_clock = 0x00187de7, 1146 .audio_clock = 0x00187de7,
1015 .tuner_type = TUNER_PHILIPS_PAL, 1147 .tuner_type = TUNER_PHILIPS_PAL,
1148 .radio_type = UNSET,
1149 .tuner_addr = ADDR_UNSET,
1150 .radio_addr = ADDR_UNSET,
1016 .inputs = {{ 1151 .inputs = {{
1017 .name = name_tv, 1152 .name = name_tv,
1018 .vmux = 1, 1153 .vmux = 1,
1019 .amux = TV, 1154 .amux = TV,
1020 .tv = 1, 1155 .tv = 1,
1021 },{ 1156 },{
1022 .name = name_tv_mono, 1157 .name = name_tv_mono,
1023 .vmux = 1, 1158 .vmux = 1,
1024 .amux = LINE2, 1159 .amux = LINE2,
@@ -1047,6 +1182,9 @@ struct saa7134_board saa7134_boards[] = {
1047 .name = "AVerMedia DVD EZMaker", 1182 .name = "AVerMedia DVD EZMaker",
1048 .audio_clock = 0x00187de7, 1183 .audio_clock = 0x00187de7,
1049 .tuner_type = TUNER_ABSENT, 1184 .tuner_type = TUNER_ABSENT,
1185 .radio_type = UNSET,
1186 .tuner_addr = ADDR_UNSET,
1187 .radio_addr = ADDR_UNSET,
1050 .inputs = {{ 1188 .inputs = {{
1051 .name = name_comp1, 1189 .name = name_comp1,
1052 .vmux = 3, 1190 .vmux = 3,
@@ -1055,28 +1193,34 @@ struct saa7134_board saa7134_boards[] = {
1055 .vmux = 8, 1193 .vmux = 8,
1056 }}, 1194 }},
1057 }, 1195 },
1058 [SAA7134_BOARD_NOVAC_PRIMETV7133] = { 1196 [SAA7134_BOARD_NOVAC_PRIMETV7133] = {
1059 /* toshii@netbsd.org */ 1197 /* toshii@netbsd.org */
1060 .name = "Noval Prime TV 7133", 1198 .name = "Noval Prime TV 7133",
1061 .audio_clock = 0x00200000, 1199 .audio_clock = 0x00200000,
1062 .tuner_type = TUNER_ALPS_TSBH1_NTSC, 1200 .tuner_type = TUNER_ALPS_TSBH1_NTSC,
1063 .inputs = {{ 1201 .radio_type = UNSET,
1064 .name = name_comp1, 1202 .tuner_addr = ADDR_UNSET,
1065 .vmux = 3, 1203 .radio_addr = ADDR_UNSET,
1066 },{ 1204 .inputs = {{
1067 .name = name_tv, 1205 .name = name_comp1,
1068 .vmux = 1, 1206 .vmux = 3,
1069 .amux = TV, 1207 },{
1070 .tv = 1, 1208 .name = name_tv,
1071 },{ 1209 .vmux = 1,
1072 .name = name_svideo, 1210 .amux = TV,
1073 .vmux = 8, 1211 .tv = 1,
1074 }}, 1212 },{
1075 }, 1213 .name = name_svideo,
1214 .vmux = 8,
1215 }},
1216 },
1076 [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = { 1217 [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = {
1077 .name = "AverMedia AverTV Studio 305", 1218 .name = "AverMedia AverTV Studio 305",
1078 .audio_clock = 0x00187de7, 1219 .audio_clock = 0x00187de7,
1079 .tuner_type = TUNER_PHILIPS_FM1256_IH3, 1220 .tuner_type = TUNER_PHILIPS_FM1256_IH3,
1221 .radio_type = UNSET,
1222 .tuner_addr = ADDR_UNSET,
1223 .radio_addr = ADDR_UNSET,
1080 .tda9887_conf = TDA9887_PRESENT, 1224 .tda9887_conf = TDA9887_PRESENT,
1081 .inputs = {{ 1225 .inputs = {{
1082 .name = name_tv, 1226 .name = name_tv,
@@ -1097,35 +1241,41 @@ struct saa7134_board saa7134_boards[] = {
1097 .amux = LINE2, 1241 .amux = LINE2,
1098 }}, 1242 }},
1099 .radio = { 1243 .radio = {
1100 .name = name_radio, 1244 .name = name_radio,
1101 .amux = LINE2, 1245 .amux = LINE2,
1102 }, 1246 },
1103 .mute = { 1247 .mute = {
1104 .name = name_mute, 1248 .name = name_mute,
1105 .amux = LINE1, 1249 .amux = LINE1,
1106 }, 1250 },
1107 }, 1251 },
1108 [SAA7133_BOARD_UPMOST_PURPLE_TV] = { 1252 [SAA7134_BOARD_UPMOST_PURPLE_TV] = {
1109 .name = "UPMOST PURPLE TV", 1253 .name = "UPMOST PURPLE TV",
1110 .audio_clock = 0x00187de7, 1254 .audio_clock = 0x00187de7,
1111 .tuner_type = TUNER_PHILIPS_FM1236_MK3, 1255 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1112 .tda9887_conf = TDA9887_PRESENT, 1256 .radio_type = UNSET,
1113 .inputs = {{ 1257 .tuner_addr = ADDR_UNSET,
1114 .name = name_tv, 1258 .radio_addr = ADDR_UNSET,
1115 .vmux = 7, 1259 .tda9887_conf = TDA9887_PRESENT,
1116 .amux = TV, 1260 .inputs = {{
1117 .tv = 1, 1261 .name = name_tv,
1118 },{ 1262 .vmux = 7,
1119 .name = name_svideo, 1263 .amux = TV,
1120 .vmux = 7, 1264 .tv = 1,
1121 .amux = LINE1, 1265 },{
1122 }}, 1266 .name = name_svideo,
1267 .vmux = 7,
1268 .amux = LINE1,
1269 }},
1123 }, 1270 },
1124 [SAA7134_BOARD_ITEMS_MTV005] = { 1271 [SAA7134_BOARD_ITEMS_MTV005] = {
1125 /* Norman Jonas <normanjonas@arcor.de> */ 1272 /* Norman Jonas <normanjonas@arcor.de> */
1126 .name = "Items MuchTV Plus / IT-005", 1273 .name = "Items MuchTV Plus / IT-005",
1127 .audio_clock = 0x00187de7, 1274 .audio_clock = 0x00187de7,
1128 .tuner_type = TUNER_PHILIPS_PAL, 1275 .tuner_type = TUNER_PHILIPS_PAL,
1276 .radio_type = UNSET,
1277 .tuner_addr = ADDR_UNSET,
1278 .radio_addr = ADDR_UNSET,
1129 .inputs = {{ 1279 .inputs = {{
1130 .name = name_tv, 1280 .name = name_tv,
1131 .vmux = 3, 1281 .vmux = 3,
@@ -1149,27 +1299,30 @@ struct saa7134_board saa7134_boards[] = {
1149 .name = "Terratec Cinergy 200 TV", 1299 .name = "Terratec Cinergy 200 TV",
1150 .audio_clock = 0x00200000, 1300 .audio_clock = 0x00200000,
1151 .tuner_type = TUNER_PHILIPS_PAL, 1301 .tuner_type = TUNER_PHILIPS_PAL,
1302 .radio_type = UNSET,
1303 .tuner_addr = ADDR_UNSET,
1304 .radio_addr = ADDR_UNSET,
1152 .inputs = {{ 1305 .inputs = {{
1153 .name = name_tv, 1306 .name = name_tv,
1154 .vmux = 1, 1307 .vmux = 1,
1155 .amux = LINE2, 1308 .amux = LINE2,
1156 .tv = 1, 1309 .tv = 1,
1157 },{ 1310 },{
1158 .name = name_comp1, 1311 .name = name_comp1,
1159 .vmux = 4, 1312 .vmux = 4,
1160 .amux = LINE1, 1313 .amux = LINE1,
1161 },{ 1314 },{
1162 .name = name_svideo, 1315 .name = name_svideo,
1163 .vmux = 8, 1316 .vmux = 8,
1164 .amux = LINE1, 1317 .amux = LINE1,
1165 },{ 1318 },{
1166 .name = name_comp2, // CVideo over SVideo Connector 1319 .name = name_comp2, /* CVideo over SVideo Connector */
1167 .vmux = 0, 1320 .vmux = 0,
1168 .amux = LINE1, 1321 .amux = LINE1,
1169 }}, 1322 }},
1170 .mute = { 1323 .mute = {
1171 .name = name_mute, 1324 .name = name_mute,
1172 .amux = LINE2, 1325 .amux = LINE2,
1173 }, 1326 },
1174 }, 1327 },
1175 [SAA7134_BOARD_VIDEOMATE_TV_PVR] = { 1328 [SAA7134_BOARD_VIDEOMATE_TV_PVR] = {
@@ -1177,84 +1330,96 @@ struct saa7134_board saa7134_boards[] = {
1177 .name = "Compro VideoMate TV PVR/FM", 1330 .name = "Compro VideoMate TV PVR/FM",
1178 .audio_clock = 0x00187de7, 1331 .audio_clock = 0x00187de7,
1179 .tuner_type = TUNER_PHILIPS_NTSC_M, 1332 .tuner_type = TUNER_PHILIPS_NTSC_M,
1333 .radio_type = UNSET,
1334 .tuner_addr = ADDR_UNSET,
1335 .radio_addr = ADDR_UNSET,
1180 .gpiomask = 0x808c0080, 1336 .gpiomask = 0x808c0080,
1181 .inputs = {{ 1337 .inputs = {{
1182 .name = name_svideo, 1338 .name = name_svideo,
1183 .vmux = 8, 1339 .vmux = 8,
1184 .amux = LINE1, 1340 .amux = LINE1,
1185 .gpio = 0x00080, 1341 .gpio = 0x00080,
1186 },{ 1342 },{
1187 .name = name_comp1, 1343 .name = name_comp1,
1188 .vmux = 3, 1344 .vmux = 3,
1189 .amux = LINE1, 1345 .amux = LINE1,
1190 .gpio = 0x00080, 1346 .gpio = 0x00080,
1191 },{ 1347 },{
1192 .name = name_tv, 1348 .name = name_tv,
1193 .vmux = 1, 1349 .vmux = 1,
1194 .amux = LINE2_LEFT, 1350 .amux = LINE2_LEFT,
1195 .tv = 1, 1351 .tv = 1,
1196 .gpio = 0x00080, 1352 .gpio = 0x00080,
1197 }}, 1353 }},
1198 .radio = { 1354 .radio = {
1199 .name = name_radio, 1355 .name = name_radio,
1200 .amux = LINE2, 1356 .amux = LINE2,
1201 .gpio = 0x80000, 1357 .gpio = 0x80000,
1202 }, 1358 },
1203 .mute = { 1359 .mute = {
1204 .name = name_mute, 1360 .name = name_mute,
1205 .amux = LINE2, 1361 .amux = LINE2,
1206 .gpio = 0x40000, 1362 .gpio = 0x40000,
1207 }, 1363 },
1208 }, 1364 },
1209 [SAA7134_BOARD_SABRENT_SBTTVFM] = { 1365 [SAA7134_BOARD_SABRENT_SBTTVFM] = {
1210 /* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */ 1366 /* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */
1211 .name = "Sabrent SBT-TVFM (saa7130)", 1367 .name = "Sabrent SBT-TVFM (saa7130)",
1212 .audio_clock = 0x00187de7, 1368 .audio_clock = 0x00187de7,
1213 .tuner_type = TUNER_PHILIPS_NTSC_M, 1369 .tuner_type = TUNER_PHILIPS_NTSC_M,
1214 .inputs = {{ 1370 .radio_type = UNSET,
1371 .tuner_addr = ADDR_UNSET,
1372 .radio_addr = ADDR_UNSET,
1373 .inputs = {{
1215 .name = name_comp1, 1374 .name = name_comp1,
1216 .vmux = 1, 1375 .vmux = 1,
1217 .amux = LINE2, 1376 .amux = LINE2,
1218 },{ 1377 },{
1219 .name = name_tv, 1378 .name = name_tv,
1220 .vmux = 3, 1379 .vmux = 3,
1221 .amux = LINE2, 1380 .amux = LINE2,
1222 .tv = 1, 1381 .tv = 1,
1223 },{ 1382 },{
1224 .name = name_svideo, 1383 .name = name_svideo,
1225 .vmux = 8, 1384 .vmux = 8,
1226 .amux = LINE2, 1385 .amux = LINE2,
1227 }}, 1386 }},
1228 .radio = { 1387 .radio = {
1229 .name = name_radio, 1388 .name = name_radio,
1230 .amux = LINE2, 1389 .amux = LINE2,
1231 }, 1390 },
1232 }, 1391 },
1233 [SAA7134_BOARD_ZOLID_XPERT_TV7134] = { 1392 [SAA7134_BOARD_ZOLID_XPERT_TV7134] = {
1234 /* Helge Jensen <helge.jensen@slog.dk> */ 1393 /* Helge Jensen <helge.jensen@slog.dk> */
1235 .name = ":Zolid Xpert TV7134", 1394 .name = ":Zolid Xpert TV7134",
1236 .audio_clock = 0x00187de7, 1395 .audio_clock = 0x00187de7,
1237 .tuner_type = TUNER_PHILIPS_NTSC, 1396 .tuner_type = TUNER_PHILIPS_NTSC,
1238 .inputs = {{ 1397 .radio_type = UNSET,
1398 .tuner_addr = ADDR_UNSET,
1399 .radio_addr = ADDR_UNSET,
1400 .inputs = {{
1239 .name = name_svideo, 1401 .name = name_svideo,
1240 .vmux = 8, 1402 .vmux = 8,
1241 .amux = LINE1, 1403 .amux = LINE1,
1242 },{ 1404 },{
1243 .name = name_comp1, 1405 .name = name_comp1,
1244 .vmux = 3, 1406 .vmux = 3,
1245 .amux = LINE1, 1407 .amux = LINE1,
1246 },{ 1408 },{
1247 .name = name_tv, 1409 .name = name_tv,
1248 .vmux = 1, 1410 .vmux = 1,
1249 .amux = LINE2, 1411 .amux = LINE2,
1250 .tv = 1, 1412 .tv = 1,
1251 }}, 1413 }},
1252 }, 1414 },
1253 [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = { 1415 [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = {
1254 /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */ 1416 /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */
1255 .name = "Empire PCI TV-Radio LE", 1417 .name = "Empire PCI TV-Radio LE",
1256 .audio_clock = 0x00187de7, 1418 .audio_clock = 0x00187de7,
1257 .tuner_type = TUNER_PHILIPS_PAL, 1419 .tuner_type = TUNER_PHILIPS_PAL,
1420 .radio_type = UNSET,
1421 .tuner_addr = ADDR_UNSET,
1422 .radio_addr = ADDR_UNSET,
1258 .gpiomask = 0x4000, 1423 .gpiomask = 0x4000,
1259 .inputs = {{ 1424 .inputs = {{
1260 .name = name_tv_mono, 1425 .name = name_tv_mono,
@@ -1273,18 +1438,18 @@ struct saa7134_board saa7134_boards[] = {
1273 .amux = LINE1, 1438 .amux = LINE1,
1274 .gpio = 0x8000, 1439 .gpio = 0x8000,
1275 }}, 1440 }},
1276 .radio = { 1441 .radio = {
1277 .name = name_radio, 1442 .name = name_radio,
1278 .amux = LINE1, 1443 .amux = LINE1,
1279 .gpio = 0x8000, 1444 .gpio = 0x8000,
1280 }, 1445 },
1281 .mute = { 1446 .mute = {
1282 .name = name_mute, 1447 .name = name_mute,
1283 .amux = TV, 1448 .amux = TV,
1284 .gpio =0x8000, 1449 .gpio =0x8000,
1285 } 1450 }
1286 }, 1451 },
1287 [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = { 1452 [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = {
1288 /* 1453 /*
1289 Nickolay V. Shmyrev <nshmyrev@yandex.ru> 1454 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
1290 Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> 1455 Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru>
@@ -1292,6 +1457,9 @@ struct saa7134_board saa7134_boards[] = {
1292 .name = "Avermedia AVerTV Studio 307", 1457 .name = "Avermedia AVerTV Studio 307",
1293 .audio_clock = 0x00187de7, 1458 .audio_clock = 0x00187de7,
1294 .tuner_type = TUNER_PHILIPS_FM1256_IH3, 1459 .tuner_type = TUNER_PHILIPS_FM1256_IH3,
1460 .radio_type = UNSET,
1461 .tuner_addr = ADDR_UNSET,
1462 .radio_addr = ADDR_UNSET,
1295 .tda9887_conf = TDA9887_PRESENT, 1463 .tda9887_conf = TDA9887_PRESENT,
1296 .gpiomask = 0x03, 1464 .gpiomask = 0x03,
1297 .inputs = {{ 1465 .inputs = {{
@@ -1321,13 +1489,21 @@ struct saa7134_board saa7134_boards[] = {
1321 .amux = LINE1, 1489 .amux = LINE1,
1322 .gpio = 0x01, 1490 .gpio = 0x01,
1323 }, 1491 },
1324 }, 1492 .mute = {
1325 [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = { 1493 .name = name_mute,
1494 .amux = LINE1,
1495 .gpio = 0x00,
1496 },
1497 },
1498 [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = {
1326 .name = "Avermedia AVerTV GO 007 FM", 1499 .name = "Avermedia AVerTV GO 007 FM",
1327 .audio_clock = 0x00187de7, 1500 .audio_clock = 0x00187de7,
1328 .tuner_type = TUNER_PHILIPS_TDA8290, 1501 .tuner_type = TUNER_PHILIPS_TDA8290,
1502 .radio_type = UNSET,
1503 .tuner_addr = ADDR_UNSET,
1504 .radio_addr = ADDR_UNSET,
1329 .gpiomask = 0x00300003, 1505 .gpiomask = 0x00300003,
1330// .gpiomask = 0x8c240003, 1506 /* .gpiomask = 0x8c240003, */
1331 .inputs = {{ 1507 .inputs = {{
1332 .name = name_tv, 1508 .name = name_tv,
1333 .vmux = 1, 1509 .vmux = 1,
@@ -1350,16 +1526,24 @@ struct saa7134_board saa7134_boards[] = {
1350 .amux = LINE1, 1526 .amux = LINE1,
1351 .gpio = 0x00300001, 1527 .gpio = 0x00300001,
1352 }, 1528 },
1353 }, 1529 .mute = {
1530 .name = name_mute,
1531 .amux = TV,
1532 .gpio = 0x01,
1533 },
1534 },
1354 [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { 1535 [SAA7134_BOARD_AVERMEDIA_CARDBUS] = {
1355 /* Jon Westgate <oryn@oryn.fsck.tv> */ 1536 /* Kees.Blom@cwi.nl */
1356 .name = "AVerMedia Cardbus TV/Radio", 1537 .name = "AVerMedia Cardbus TV/Radio (E500)",
1357 .audio_clock = 0x00200000, 1538 .audio_clock = 0x187de7,
1358 .tuner_type = TUNER_PHILIPS_PAL, 1539 .tuner_type = TUNER_PHILIPS_TDA8290,
1540 .radio_type = UNSET,
1541 .tuner_addr = ADDR_UNSET,
1542 .radio_addr = ADDR_UNSET,
1359 .inputs = {{ 1543 .inputs = {{
1360 .name = name_tv, 1544 .name = name_tv,
1361 .vmux = 1, 1545 .vmux = 1,
1362 .amux = LINE2, 1546 .amux = TV,
1363 .tv = 1, 1547 .tv = 1,
1364 },{ 1548 },{
1365 .name = name_comp1, 1549 .name = name_comp1,
@@ -1368,10 +1552,10 @@ struct saa7134_board saa7134_boards[] = {
1368 },{ 1552 },{
1369 .name = name_svideo, 1553 .name = name_svideo,
1370 .vmux = 8, 1554 .vmux = 8,
1371 .amux = LINE2, 1555 .amux = LINE1,
1372 }}, 1556 }},
1373 .radio = { 1557 .radio = {
1374 .name = name_radio, 1558 .name = name_radio,
1375 .amux = LINE1, 1559 .amux = LINE1,
1376 }, 1560 },
1377 }, 1561 },
@@ -1379,119 +1563,134 @@ struct saa7134_board saa7134_boards[] = {
1379 .name = "Terratec Cinergy 400 mobile", 1563 .name = "Terratec Cinergy 400 mobile",
1380 .audio_clock = 0x187de7, 1564 .audio_clock = 0x187de7,
1381 .tuner_type = TUNER_ALPS_TSBE5_PAL, 1565 .tuner_type = TUNER_ALPS_TSBE5_PAL,
1382 .tda9887_conf = TDA9887_PRESENT, 1566 .radio_type = UNSET,
1567 .tuner_addr = ADDR_UNSET,
1568 .radio_addr = ADDR_UNSET,
1569 .tda9887_conf = TDA9887_PRESENT,
1383 .inputs = {{ 1570 .inputs = {{
1384 .name = name_tv, 1571 .name = name_tv,
1385 .vmux = 1, 1572 .vmux = 1,
1386 .amux = TV, 1573 .amux = TV,
1387 .tv = 1, 1574 .tv = 1,
1388 },{ 1575 },{
1389 .name = name_tv_mono, 1576 .name = name_tv_mono,
1390 .vmux = 1, 1577 .vmux = 1,
1391 .amux = LINE2, 1578 .amux = LINE2,
1392 .tv = 1, 1579 .tv = 1,
1393 },{ 1580 },{
1394 .name = name_comp1, 1581 .name = name_comp1,
1395 .vmux = 3, 1582 .vmux = 3,
1396 .amux = LINE1, 1583 .amux = LINE1,
1397 },{ 1584 },{
1398 .name = name_svideo, 1585 .name = name_svideo,
1399 .vmux = 8, 1586 .vmux = 8,
1400 .amux = LINE1, 1587 .amux = LINE1,
1401 }}, 1588 }},
1402 }, 1589 },
1403 [SAA7134_BOARD_CINERGY600_MK3] = { 1590 [SAA7134_BOARD_CINERGY600_MK3] = {
1404 .name = "Terratec Cinergy 600 TV MK3", 1591 .name = "Terratec Cinergy 600 TV MK3",
1405 .audio_clock = 0x00200000, 1592 .audio_clock = 0x00200000,
1406 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 1593 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
1407 .tda9887_conf = TDA9887_PRESENT, 1594 .radio_type = UNSET,
1408 .inputs = {{ 1595 .tuner_addr = ADDR_UNSET,
1409 .name = name_tv, 1596 .radio_addr = ADDR_UNSET,
1410 .vmux = 1, 1597 .tda9887_conf = TDA9887_PRESENT,
1411 .amux = TV, 1598 .inputs = {{
1412 .tv = 1, 1599 .name = name_tv,
1413 },{ 1600 .vmux = 1,
1414 .name = name_comp1, 1601 .amux = TV,
1415 .vmux = 4, 1602 .tv = 1,
1416 .amux = LINE1, 1603 },{
1417 },{ 1604 .name = name_comp1,
1418 .name = name_svideo, 1605 .vmux = 4,
1419 .vmux = 8, 1606 .amux = LINE1,
1420 .amux = LINE1, 1607 },{
1421 },{ 1608 .name = name_svideo,
1422 .name = name_comp2, // CVideo over SVideo Connector 1609 .vmux = 8,
1423 .vmux = 0, 1610 .amux = LINE1,
1424 .amux = LINE1, 1611 },{
1425 }}, 1612 .name = name_comp2, /* CVideo over SVideo Connector */
1613 .vmux = 0,
1614 .amux = LINE1,
1615 }},
1426 .radio = { 1616 .radio = {
1427 .name = name_radio, 1617 .name = name_radio,
1428 .amux = LINE2, 1618 .amux = LINE2,
1429 }, 1619 },
1430 }, 1620 },
1431 [SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = { 1621 [SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = {
1432 /* Dylan Walkden <dylan_walkden@hotmail.com> */ 1622 /* Dylan Walkden <dylan_walkden@hotmail.com> */
1433 .name = "Compro VideoMate Gold+ Pal", 1623 .name = "Compro VideoMate Gold+ Pal",
1434 .audio_clock = 0x00187de7, 1624 .audio_clock = 0x00187de7,
1435 .tuner_type = TUNER_PHILIPS_PAL, 1625 .tuner_type = TUNER_PHILIPS_PAL,
1436 .gpiomask = 0x1ce780, 1626 .radio_type = UNSET,
1437 .inputs = {{ 1627 .tuner_addr = ADDR_UNSET,
1438 .name = name_svideo, 1628 .radio_addr = ADDR_UNSET,
1439 .vmux = 0, // CVideo over SVideo Connector - ok? 1629 .gpiomask = 0x1ce780,
1440 .amux = LINE1, 1630 .inputs = {{
1441 .gpio = 0x008080, 1631 .name = name_svideo,
1442 },{ 1632 .vmux = 0, /* CVideo over SVideo Connector - ok? */
1443 .name = name_comp1, 1633 .amux = LINE1,
1444 .vmux = 3, 1634 .gpio = 0x008080,
1445 .amux = LINE1, 1635 },{
1446 .gpio = 0x008080, 1636 .name = name_comp1,
1447 },{ 1637 .vmux = 3,
1448 .name = name_tv, 1638 .amux = LINE1,
1449 .vmux = 1, 1639 .gpio = 0x008080,
1450 .amux = TV, 1640 },{
1451 .tv = 1, 1641 .name = name_tv,
1452 .gpio = 0x008080, 1642 .vmux = 1,
1453 }}, 1643 .amux = TV,
1454 .radio = { 1644 .tv = 1,
1455 .name = name_radio, 1645 .gpio = 0x008080,
1456 .amux = LINE2, 1646 }},
1457 .gpio = 0x80000, 1647 .radio = {
1458 }, 1648 .name = name_radio,
1459 .mute = { 1649 .amux = LINE2,
1460 .name = name_mute, 1650 .gpio = 0x80000,
1461 .amux = LINE2, 1651 },
1462 .gpio = 0x0c8000, 1652 .mute = {
1463 }, 1653 .name = name_mute,
1464 }, 1654 .amux = LINE2,
1655 .gpio = 0x0c8000,
1656 },
1657 },
1465 [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = { 1658 [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = {
1466 .name = "Pinnacle PCTV 300i DVB-T + PAL", 1659 .name = "Pinnacle PCTV 300i DVB-T + PAL",
1467 .audio_clock = 0x00187de7, 1660 .audio_clock = 0x00187de7,
1468 .tuner_type = TUNER_MT2032, 1661 .tuner_type = TUNER_MT2032,
1469 .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, 1662 .radio_type = UNSET,
1663 .tuner_addr = ADDR_UNSET,
1664 .radio_addr = ADDR_UNSET,
1665 .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER,
1470 .mpeg = SAA7134_MPEG_DVB, 1666 .mpeg = SAA7134_MPEG_DVB,
1471 .inputs = {{ 1667 .inputs = {{
1472 .name = name_tv, 1668 .name = name_tv,
1473 .vmux = 3, 1669 .vmux = 3,
1474 .amux = TV, 1670 .amux = TV,
1475 .tv = 1, 1671 .tv = 1,
1476 },{ 1672 },{
1477 .name = name_comp1, 1673 .name = name_comp1,
1478 .vmux = 0, 1674 .vmux = 0,
1479 .amux = LINE2, 1675 .amux = LINE2,
1480 },{ 1676 },{
1481 .name = name_comp2, 1677 .name = name_comp2,
1482 .vmux = 1, 1678 .vmux = 1,
1483 .amux = LINE2, 1679 .amux = LINE2,
1484 },{ 1680 },{
1485 .name = name_svideo, 1681 .name = name_svideo,
1486 .vmux = 8, 1682 .vmux = 8,
1487 .amux = LINE2, 1683 .amux = LINE2,
1488 }}, 1684 }},
1489 }, 1685 },
1490 [SAA7134_BOARD_PROVIDEO_PV952] = { 1686 [SAA7134_BOARD_PROVIDEO_PV952] = {
1491 /* andreas.kretschmer@web.de */ 1687 /* andreas.kretschmer@web.de */
1492 .name = "ProVideo PV952", 1688 .name = "ProVideo PV952",
1493 .audio_clock = 0x00187de7, 1689 .audio_clock = 0x00187de7,
1494 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 1690 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
1691 .radio_type = UNSET,
1692 .tuner_addr = ADDR_UNSET,
1693 .radio_addr = ADDR_UNSET,
1495 .tda9887_conf = TDA9887_PRESENT, 1694 .tda9887_conf = TDA9887_PRESENT,
1496 .inputs = {{ 1695 .inputs = {{
1497 .name = name_comp1, 1696 .name = name_comp1,
@@ -1515,10 +1714,13 @@ struct saa7134_board saa7134_boards[] = {
1515 }, 1714 },
1516 [SAA7134_BOARD_AVERMEDIA_305] = { 1715 [SAA7134_BOARD_AVERMEDIA_305] = {
1517 /* much like the "studio" version but without radio 1716 /* much like the "studio" version but without radio
1518 * and another tuner (sirspiritus@yandex.ru) */ 1717 * and another tuner (sirspiritus@yandex.ru) */
1519 .name = "AverMedia AverTV/305", 1718 .name = "AverMedia AverTV/305",
1520 .audio_clock = 0x00187de7, 1719 .audio_clock = 0x00187de7,
1521 .tuner_type = TUNER_PHILIPS_FQ1216ME, 1720 .tuner_type = TUNER_PHILIPS_FQ1216ME,
1721 .radio_type = UNSET,
1722 .tuner_addr = ADDR_UNSET,
1723 .radio_addr = ADDR_UNSET,
1522 .tda9887_conf = TDA9887_PRESENT, 1724 .tda9887_conf = TDA9887_PRESENT,
1523 .inputs = {{ 1725 .inputs = {{
1524 .name = name_tv, 1726 .name = name_tv,
@@ -1539,115 +1741,268 @@ struct saa7134_board saa7134_boards[] = {
1539 .amux = LINE2, 1741 .amux = LINE2,
1540 }}, 1742 }},
1541 .mute = { 1743 .mute = {
1542 .name = name_mute, 1744 .name = name_mute,
1543 .amux = LINE1, 1745 .amux = LINE1,
1544 }, 1746 },
1545 }, 1747 },
1546 [SAA7134_BOARD_FLYDVBTDUO] = { 1748 [SAA7134_BOARD_FLYDVBTDUO] = {
1547 /* LifeView FlyDVB-T DUO */ 1749 /* LifeView FlyDVB-T DUO */
1548 /* "Nico Sabbi <nsabbi@tiscali.it> */ 1750 /* "Nico Sabbi <nsabbi@tiscali.it> Hartmut Hackmann hartmut.hackmann@t-online.de*/
1549 .name = "LifeView FlyDVB-T DUO", 1751 .name = "LifeView FlyDVB-T DUO",
1550 .audio_clock = 0x00200000, 1752 .audio_clock = 0x00200000,
1551 .tuner_type = TUNER_PHILIPS_TDA8290, 1753 .tuner_type = TUNER_PHILIPS_TDA8290,
1552// .gpiomask = 0xe000, 1754 .radio_type = UNSET,
1755 .tuner_addr = ADDR_UNSET,
1756 .radio_addr = ADDR_UNSET,
1757 .mpeg = SAA7134_MPEG_DVB,
1553 .inputs = {{ 1758 .inputs = {{
1554 .name = name_tv, 1759 .name = name_tv,
1555 .vmux = 1, 1760 .vmux = 1,
1556 .amux = TV, 1761 .amux = TV,
1557// .gpio = 0x0000,
1558 .tv = 1, 1762 .tv = 1,
1559 },{ 1763 },{
1560 .name = name_comp1, /* Composite signal on S-Video input */ 1764 .name = name_comp1, /* Composite signal on S-Video input */
1561 .vmux = 0, 1765 .vmux = 0,
1562 .amux = LINE2, 1766 .amux = LINE2,
1563// .gpio = 0x4000,
1564 },{ 1767 },{
1565 .name = name_comp2, /* Composite input */ 1768 .name = name_comp2, /* Composite input */
1566 .vmux = 3, 1769 .vmux = 3,
1567 .amux = LINE2, 1770 .amux = LINE2,
1568// .gpio = 0x4000,
1569 },{ 1771 },{
1570 .name = name_svideo, /* S-Video signal on S-Video input */ 1772 .name = name_svideo, /* S-Video signal on S-Video input */
1571 .vmux = 8, 1773 .vmux = 8,
1572 .amux = LINE2, 1774 .amux = LINE2,
1573// .gpio = 0x4000,
1574 }}, 1775 }},
1575 }, 1776 },
1576 [SAA7134_BOARD_AVERMEDIA_307] = { 1777 [SAA7134_BOARD_PHILIPS_TOUGH] = {
1577 /* 1778 .name = "Philips TOUGH DVB-T reference design",
1578 Davydov Vladimir <vladimir@iqmedia.com> 1779 .tuner_type = TUNER_ABSENT,
1579 */ 1780 .audio_clock = 0x00187de7,
1580 .name = "Avermedia AVerTV 307", 1781 .radio_type = UNSET,
1581 .audio_clock = 0x00187de7, 1782 .tuner_addr = ADDR_UNSET,
1582 .tuner_type = TUNER_PHILIPS_FQ1216ME, 1783 .radio_addr = ADDR_UNSET,
1583 .tda9887_conf = TDA9887_PRESENT, 1784 .mpeg = SAA7134_MPEG_DVB,
1584 .inputs = {{ 1785 .inputs = {{
1585 .name = name_tv, 1786 .name = name_comp1,
1586 .vmux = 1, 1787 .vmux = 0,
1587 .amux = TV, 1788 .amux = LINE1,
1588 .tv = 1, 1789 },{
1589 },{ 1790 .name = name_svideo,
1590 .name = name_comp1, 1791 .vmux = 8,
1591 .vmux = 0, 1792 .amux = LINE1,
1592 .amux = LINE1, 1793 }},
1593 },{ 1794 },
1594 .name = name_comp2, 1795 [SAA7134_BOARD_AVERMEDIA_307] = {
1595 .vmux = 3, 1796 /*
1596 .amux = LINE1, 1797 Davydov Vladimir <vladimir@iqmedia.com>
1597 },{ 1798 */
1598 .name = name_svideo, 1799 .name = "Avermedia AVerTV 307",
1599 .vmux = 8, 1800 .audio_clock = 0x00187de7,
1600 .amux = LINE1, 1801 .tuner_type = TUNER_PHILIPS_FQ1216ME,
1601 }}, 1802 .radio_type = UNSET,
1602 }, 1803 .tuner_addr = ADDR_UNSET,
1804 .radio_addr = ADDR_UNSET,
1805 .tda9887_conf = TDA9887_PRESENT,
1806 .inputs = {{
1807 .name = name_tv,
1808 .vmux = 1,
1809 .amux = TV,
1810 .tv = 1,
1811 },{
1812 .name = name_comp1,
1813 .vmux = 0,
1814 .amux = LINE1,
1815 },{
1816 .name = name_comp2,
1817 .vmux = 3,
1818 .amux = LINE1,
1819 },{
1820 .name = name_svideo,
1821 .vmux = 8,
1822 .amux = LINE1,
1823 }},
1824 },
1603 [SAA7134_BOARD_ADS_INSTANT_TV] = { 1825 [SAA7134_BOARD_ADS_INSTANT_TV] = {
1604 .name = "ADS Tech Instant TV (saa7135)", 1826 .name = "ADS Tech Instant TV (saa7135)",
1827 .audio_clock = 0x00187de7,
1828 .tuner_type = TUNER_PHILIPS_TDA8290,
1829 .radio_type = UNSET,
1830 .tuner_addr = ADDR_UNSET,
1831 .radio_addr = ADDR_UNSET,
1832 .inputs = {{
1833 .name = name_tv,
1834 .vmux = 1,
1835 .amux = TV,
1836 .tv = 1,
1837 },{
1838 .name = name_comp1,
1839 .vmux = 3,
1840 .amux = LINE2,
1841 },{
1842 .name = name_svideo,
1843 .vmux = 8,
1844 .amux = LINE2,
1845 }},
1846 },
1847 [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = {
1848 .name = "Kworld/Tevion V-Stream Xpert TV PVR7134",
1605 .audio_clock = 0x00187de7, 1849 .audio_clock = 0x00187de7,
1606 .tuner_type = TUNER_PHILIPS_TDA8290, 1850 .tuner_type = TUNER_PHILIPS_PAL_I,
1607 .inputs = {{ 1851 .radio_type = UNSET,
1608 .name = name_tv, 1852 .tuner_addr = ADDR_UNSET,
1609 .vmux = 1, 1853 .radio_addr = ADDR_UNSET,
1610 .amux = TV, 1854 .gpiomask = 0x0700,
1611 .tv = 1, 1855 .inputs = {{
1612 },{ 1856 .name = name_tv,
1613 .name = name_comp1, 1857 .vmux = 1,
1614 .vmux = 3, 1858 .amux = TV,
1615 .amux = LINE2, 1859 .tv = 1,
1616 },{ 1860 .gpio = 0x000,
1617 .name = name_svideo, 1861 },{
1618 .vmux = 8, 1862 .name = name_comp1,
1619 .amux = LINE2, 1863 .vmux = 3,
1620 }}, 1864 .amux = LINE1,
1621 }, 1865 .gpio = 0x200, /* gpio by DScaler */
1622 [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = { 1866 },{
1623 .name = "Kworld/Tevion V-Stream Xpert TV PVR7134", 1867 .name = name_svideo,
1624 .audio_clock = 0x00187de7, 1868 .vmux = 0,
1625 .tuner_type = TUNER_PHILIPS_PAL_I, 1869 .amux = LINE1,
1626 .gpiomask = 0x0700, 1870 .gpio = 0x200,
1627 .inputs = {{ 1871 }},
1628 .name = name_tv, 1872 .radio = {
1629 .vmux = 1, 1873 .name = name_radio,
1630 .amux = TV, 1874 .amux = LINE1,
1631 .tv = 1, 1875 .gpio = 0x100,
1632 .gpio = 0x000, 1876 },
1633 },{ 1877 .mute = {
1634 .name = name_comp1, 1878 .name = name_mute,
1635 .vmux = 3, 1879 .amux = TV,
1636 .amux = LINE1, 1880 .gpio = 0x000,
1637 .gpio = 0x200, //gpio by DScaler 1881 },
1638 },{ 1882 },
1639 .name = name_svideo, 1883 [SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS] = {
1640 .vmux = 0, 1884 .name = "Typhoon DVB-T Duo Digital/Analog Cardbus",
1641 .amux = LINE1, 1885 .audio_clock = 0x00200000,
1642 .gpio = 0x200, 1886 .tuner_type = TUNER_PHILIPS_TDA8290,
1643 }}, 1887 .radio_type = UNSET,
1644 .radio = { 1888 .tuner_addr = ADDR_UNSET,
1645 .name = name_radio, 1889 .radio_addr = ADDR_UNSET,
1646 .amux = LINE1, 1890 .mpeg = SAA7134_MPEG_DVB,
1647 .gpio = 0x100, 1891 /* .gpiomask = 0xe000, */
1648 }, 1892 .inputs = {{
1649 }, 1893 .name = name_tv,
1650 }; 1894 .vmux = 1,
1895 .amux = TV,
1896 /* .gpio = 0x0000, */
1897 .tv = 1,
1898 },{
1899 .name = name_comp1, /* Composite signal on S-Video input */
1900 .vmux = 0,
1901 .amux = LINE2,
1902 /* .gpio = 0x4000, */
1903 },{
1904 .name = name_comp2, /* Composite input */
1905 .vmux = 3,
1906 .amux = LINE2,
1907 /* .gpio = 0x4000, */
1908 },{
1909 .name = name_svideo, /* S-Video signal on S-Video input */
1910 .vmux = 8,
1911 .amux = LINE2,
1912 /* .gpio = 0x4000, */
1913 }},
1914 .radio = {
1915 .name = name_radio,
1916 .amux = LINE2,
1917 },
1918 .mute = {
1919 .name = name_mute,
1920 .amux = LINE1,
1921 },
1922 },
1923 [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = {
1924 .name = "Compro VideoMate TV Gold+II",
1925 .audio_clock = 0x002187de7,
1926 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1927 .radio_type = TUNER_TEA5767,
1928 .tuner_addr = 0x63,
1929 .radio_addr = 0x60,
1930 .gpiomask = 0x8c1880,
1931 .inputs = {{
1932 .name = name_svideo,
1933 .vmux = 0,
1934 .amux = LINE1,
1935 .gpio = 0x800800,
1936 },{
1937 .name = name_comp1,
1938 .vmux = 3,
1939 .amux = LINE1,
1940 .gpio = 0x801000,
1941 },{
1942 .name = name_tv,
1943 .vmux = 1,
1944 .amux = TV,
1945 .tv = 1,
1946 .gpio = 0x800000,
1947 }},
1948 .radio = {
1949 .name = name_radio,
1950 .amux = TV,
1951 .gpio = 0x880000,
1952 },
1953 .mute = {
1954 .name = name_mute,
1955 .amux = LINE2,
1956 .gpio = 0x840000,
1957 },
1958 },
1959 [SAA7134_BOARD_KWORLD_XPERT] = {
1960 /*
1961 FIXME:
1962 - Remote control doesn't initialize properly.
1963 - Audio volume starts muted,
1964 then gradually increases after channel change.
1965 - Overlay scaling problems (application error?)
1966 - Composite S-Video untested.
1967 From: Konrad Rzepecki <hannibal@megapolis.pl>
1968 */
1969 .name = "Kworld Xpert TV PVR7134",
1970 .audio_clock = 0x00187de7,
1971 .tuner_type = TUNER_TENA_9533_DI,
1972 .radio_type = TUNER_TEA5767,
1973 .tuner_addr = 0x61,
1974 .radio_addr = 0x60,
1975 .gpiomask = 0x0700,
1976 .inputs = {{
1977 .name = name_tv,
1978 .vmux = 1,
1979 .amux = TV,
1980 .tv = 1,
1981 .gpio = 0x000,
1982 },{
1983 .name = name_comp1,
1984 .vmux = 3,
1985 .amux = LINE1,
1986 .gpio = 0x200, /* gpio by DScaler */
1987 },{
1988 .name = name_svideo,
1989 .vmux = 0,
1990 .amux = LINE1,
1991 .gpio = 0x200,
1992 }},
1993 .radio = {
1994 .name = name_radio,
1995 .amux = LINE1,
1996 .gpio = 0x100,
1997 },
1998 .mute = {
1999 .name = name_mute,
2000 .amux = TV,
2001 .gpio = 0x000,
2002 },
2003 },
2004};
2005
1651 2006
1652const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 2007const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
1653 2008
@@ -1661,13 +2016,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
1661 .subvendor = PCI_VENDOR_ID_PHILIPS, 2016 .subvendor = PCI_VENDOR_ID_PHILIPS,
1662 .subdevice = 0x2001, 2017 .subdevice = 0x2001,
1663 .driver_data = SAA7134_BOARD_PROTEUS_PRO, 2018 .driver_data = SAA7134_BOARD_PROTEUS_PRO,
1664 },{ 2019 },{
1665 .vendor = PCI_VENDOR_ID_PHILIPS, 2020 .vendor = PCI_VENDOR_ID_PHILIPS,
1666 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2021 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1667 .subvendor = PCI_VENDOR_ID_PHILIPS, 2022 .subvendor = PCI_VENDOR_ID_PHILIPS,
1668 .subdevice = 0x2001, 2023 .subdevice = 0x2001,
1669 .driver_data = SAA7134_BOARD_PROTEUS_PRO, 2024 .driver_data = SAA7134_BOARD_PROTEUS_PRO,
1670 },{ 2025 },{
1671 .vendor = PCI_VENDOR_ID_PHILIPS, 2026 .vendor = PCI_VENDOR_ID_PHILIPS,
1672 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2027 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1673 .subvendor = PCI_VENDOR_ID_PHILIPS, 2028 .subvendor = PCI_VENDOR_ID_PHILIPS,
@@ -1676,70 +2031,70 @@ struct pci_device_id saa7134_pci_tbl[] = {
1676 },{ 2031 },{
1677 .vendor = PCI_VENDOR_ID_PHILIPS, 2032 .vendor = PCI_VENDOR_ID_PHILIPS,
1678 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2033 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1679 .subvendor = 0x1131, 2034 .subvendor = 0x1131,
1680 .subdevice = 0x4e85, 2035 .subdevice = 0x4e85,
1681 .driver_data = SAA7134_BOARD_MONSTERTV, 2036 .driver_data = SAA7134_BOARD_MONSTERTV,
1682 },{ 2037 },{
1683 .vendor = PCI_VENDOR_ID_PHILIPS, 2038 .vendor = PCI_VENDOR_ID_PHILIPS,
1684 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2039 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1685 .subvendor = 0x153B, 2040 .subvendor = 0x153B,
1686 .subdevice = 0x1142, 2041 .subdevice = 0x1142,
1687 .driver_data = SAA7134_BOARD_CINERGY400, 2042 .driver_data = SAA7134_BOARD_CINERGY400,
1688 },{ 2043 },{
1689 .vendor = PCI_VENDOR_ID_PHILIPS, 2044 .vendor = PCI_VENDOR_ID_PHILIPS,
1690 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2045 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1691 .subvendor = 0x153B, 2046 .subvendor = 0x153B,
1692 .subdevice = 0x1143, 2047 .subdevice = 0x1143,
1693 .driver_data = SAA7134_BOARD_CINERGY600, 2048 .driver_data = SAA7134_BOARD_CINERGY600,
1694 },{ 2049 },{
1695 .vendor = PCI_VENDOR_ID_PHILIPS, 2050 .vendor = PCI_VENDOR_ID_PHILIPS,
1696 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2051 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1697 .subvendor = 0x153B, 2052 .subvendor = 0x153B,
1698 .subdevice = 0x1158, 2053 .subdevice = 0x1158,
1699 .driver_data = SAA7134_BOARD_CINERGY600_MK3, 2054 .driver_data = SAA7134_BOARD_CINERGY600_MK3,
1700 },{ 2055 },{
1701 .vendor = PCI_VENDOR_ID_PHILIPS, 2056 .vendor = PCI_VENDOR_ID_PHILIPS,
1702 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2057 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1703 .subvendor = 0x153b, 2058 .subvendor = 0x153b,
1704 .subdevice = 0x1162, 2059 .subdevice = 0x1162,
1705 .driver_data = SAA7134_BOARD_CINERGY400_CARDBUS, 2060 .driver_data = SAA7134_BOARD_CINERGY400_CARDBUS,
1706 },{ 2061 },{
1707 .vendor = PCI_VENDOR_ID_PHILIPS, 2062 .vendor = PCI_VENDOR_ID_PHILIPS,
1708 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2063 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1709 .subvendor = 0x5168, 2064 .subvendor = 0x5168,
1710 .subdevice = 0x0138, 2065 .subdevice = 0x0138,
1711 .driver_data = SAA7134_BOARD_FLYVIDEO3000, 2066 .driver_data = SAA7134_BOARD_FLYVIDEO3000,
1712 },{ 2067 },{
1713 .vendor = PCI_VENDOR_ID_PHILIPS, 2068 .vendor = PCI_VENDOR_ID_PHILIPS,
1714 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2069 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1715 .subvendor = 0x4e42, //"Typhoon PCI Capture TV Card" Art.No. 50673 2070 .subvendor = 0x4e42, /* "Typhoon PCI Capture TV Card" Art.No. 50673 */
1716 .subdevice = 0x0138, 2071 .subdevice = 0x0138,
1717 .driver_data = SAA7134_BOARD_FLYVIDEO3000, 2072 .driver_data = SAA7134_BOARD_FLYVIDEO3000,
1718 },{ 2073 },{
1719 .vendor = PCI_VENDOR_ID_PHILIPS, 2074 .vendor = PCI_VENDOR_ID_PHILIPS,
1720 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2075 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1721 .subvendor = 0x5168, 2076 .subvendor = 0x5168,
1722 .subdevice = 0x0138, 2077 .subdevice = 0x0138,
1723 .driver_data = SAA7134_BOARD_FLYVIDEO2000, 2078 .driver_data = SAA7134_BOARD_FLYVIDEO2000,
1724 },{ 2079 },{
1725 .vendor = PCI_VENDOR_ID_PHILIPS, 2080 .vendor = PCI_VENDOR_ID_PHILIPS,
1726 .device = PCI_DEVICE_ID_PHILIPS_SAA7135, 2081 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1727 .subvendor = 0x5168, 2082 .subvendor = 0x5168,
1728 .subdevice = 0x0212, /* minipci, LR212 */ 2083 .subdevice = 0x0212, /* minipci, LR212 */
1729 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, 2084 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI,
1730 },{ 2085 },{
1731 .vendor = PCI_VENDOR_ID_PHILIPS, 2086 .vendor = PCI_VENDOR_ID_PHILIPS,
1732 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2087 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1733 .subvendor = 0x5168, /* Animation Technologies (LifeView) */ 2088 .subvendor = 0x5168, /* Animation Technologies (LifeView) */
1734 .subdevice = 0x0214, /* Standard PCI, LR214WF */ 2089 .subdevice = 0x0214, /* Standard PCI, LR214WF */
1735 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, 2090 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM,
1736 },{ 2091 },{
1737 .vendor = PCI_VENDOR_ID_PHILIPS, 2092 .vendor = PCI_VENDOR_ID_PHILIPS,
1738 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2093 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1739 .subvendor = 0x1489, /* KYE */ 2094 .subvendor = 0x1489, /* KYE */
1740 .subdevice = 0x0214, /* Genius VideoWonder ProTV */ 2095 .subdevice = 0x0214, /* Genius VideoWonder ProTV */
1741 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */ 2096 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */
1742 },{ 2097 },{
1743 .vendor = PCI_VENDOR_ID_PHILIPS, 2098 .vendor = PCI_VENDOR_ID_PHILIPS,
1744 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2099 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1745 .subvendor = 0x16be, 2100 .subvendor = 0x16be,
@@ -1758,36 +2113,36 @@ struct pci_device_id saa7134_pci_tbl[] = {
1758 .subdevice = 0x226b, 2113 .subdevice = 0x226b,
1759 .driver_data = SAA7134_BOARD_ELSA_500TV, 2114 .driver_data = SAA7134_BOARD_ELSA_500TV,
1760 },{ 2115 },{
1761 .vendor = PCI_VENDOR_ID_PHILIPS, 2116 .vendor = PCI_VENDOR_ID_PHILIPS,
1762 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2117 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1763 .subvendor = PCI_VENDOR_ID_ASUSTEK, 2118 .subvendor = PCI_VENDOR_ID_ASUSTEK,
1764 .subdevice = 0x4842, 2119 .subdevice = 0x4842,
1765 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, 2120 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134,
1766 },{ 2121 },{
1767 .vendor = PCI_VENDOR_ID_PHILIPS, 2122 .vendor = PCI_VENDOR_ID_PHILIPS,
1768 .device = PCI_DEVICE_ID_PHILIPS_SAA7135, 2123 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1769 .subvendor = PCI_VENDOR_ID_ASUSTEK, 2124 .subvendor = PCI_VENDOR_ID_ASUSTEK,
1770 .subdevice = 0x4845, 2125 .subdevice = 0x4845,
1771 .driver_data = SAA7135_BOARD_ASUSTeK_TVFM7135, 2126 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7135,
1772 },{ 2127 },{
1773 .vendor = PCI_VENDOR_ID_PHILIPS, 2128 .vendor = PCI_VENDOR_ID_PHILIPS,
1774 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2129 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1775 .subvendor = PCI_VENDOR_ID_ASUSTEK, 2130 .subvendor = PCI_VENDOR_ID_ASUSTEK,
1776 .subdevice = 0x4830, 2131 .subdevice = 0x4830,
1777 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, 2132 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134,
1778 },{ 2133 },{
1779 .vendor = PCI_VENDOR_ID_PHILIPS, 2134 .vendor = PCI_VENDOR_ID_PHILIPS,
1780 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2135 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1781 .subvendor = PCI_VENDOR_ID_ASUSTEK, 2136 .subvendor = PCI_VENDOR_ID_ASUSTEK,
1782 .subdevice = 0x4843, 2137 .subdevice = 0x4843,
1783 .driver_data = SAA7134_BOARD_ASUSTEK_TVFM7133, 2138 .driver_data = SAA7134_BOARD_ASUSTEK_TVFM7133,
2139 },{
2140 .vendor = PCI_VENDOR_ID_PHILIPS,
2141 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
2142 .subvendor = PCI_VENDOR_ID_ASUSTEK,
2143 .subdevice = 0x4840,
2144 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134,
1784 },{ 2145 },{
1785 .vendor = PCI_VENDOR_ID_PHILIPS,
1786 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1787 .subvendor = PCI_VENDOR_ID_ASUSTEK,
1788 .subdevice = 0x4840,
1789 .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134,
1790 },{
1791 .vendor = PCI_VENDOR_ID_PHILIPS, 2146 .vendor = PCI_VENDOR_ID_PHILIPS,
1792 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2147 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1793 .subvendor = PCI_VENDOR_ID_PHILIPS, 2148 .subvendor = PCI_VENDOR_ID_PHILIPS,
@@ -1808,118 +2163,118 @@ struct pci_device_id saa7134_pci_tbl[] = {
1808 },{ 2163 },{
1809 .vendor = PCI_VENDOR_ID_PHILIPS, 2164 .vendor = PCI_VENDOR_ID_PHILIPS,
1810 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2165 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1811 .subvendor = 0x1131, 2166 .subvendor = 0x1131,
1812 .subdevice = 0x7133, 2167 .subdevice = 0x7133,
1813 .driver_data = SAA7134_BOARD_VA1000POWER, 2168 .driver_data = SAA7134_BOARD_VA1000POWER,
1814 },{ 2169 },{
1815 .vendor = PCI_VENDOR_ID_PHILIPS, 2170 .vendor = PCI_VENDOR_ID_PHILIPS,
1816 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2171 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1817 .subvendor = PCI_VENDOR_ID_PHILIPS, 2172 .subvendor = PCI_VENDOR_ID_PHILIPS,
1818 .subdevice = 0x2001, 2173 .subdevice = 0x2001,
1819 .driver_data = SAA7134_BOARD_10MOONSTVMASTER, 2174 .driver_data = SAA7134_BOARD_10MOONSTVMASTER,
1820 },{ 2175 },{
1821 .vendor = PCI_VENDOR_ID_PHILIPS, 2176 .vendor = PCI_VENDOR_ID_PHILIPS,
1822 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2177 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1823 .subvendor = 0x185b, 2178 .subvendor = 0x185b,
1824 .subdevice = 0xc100, 2179 .subdevice = 0xc100,
1825 .driver_data = SAA7134_BOARD_VIDEOMATE_TV, 2180 .driver_data = SAA7134_BOARD_VIDEOMATE_TV,
1826 },{ 2181 },{
1827 .vendor = PCI_VENDOR_ID_PHILIPS, 2182 .vendor = PCI_VENDOR_ID_PHILIPS,
1828 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2183 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1829 .subvendor = 0x185b, 2184 .subvendor = 0x185b,
1830 .subdevice = 0xc100, 2185 .subdevice = 0xc100,
1831 .driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS, 2186 .driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS,
1832 },{ 2187 },{
1833 .vendor = PCI_VENDOR_ID_PHILIPS, 2188 .vendor = PCI_VENDOR_ID_PHILIPS,
1834 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2189 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1835 .subvendor = PCI_VENDOR_ID_MATROX, 2190 .subvendor = PCI_VENDOR_ID_MATROX,
1836 .subdevice = 0x48d0, 2191 .subdevice = 0x48d0,
1837 .driver_data = SAA7134_BOARD_CRONOS_PLUS, 2192 .driver_data = SAA7134_BOARD_CRONOS_PLUS,
1838 },{ 2193 },{
1839 .vendor = PCI_VENDOR_ID_PHILIPS, 2194 .vendor = PCI_VENDOR_ID_PHILIPS,
1840 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2195 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1841 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 2196 .subvendor = 0x1461, /* Avermedia Technologies Inc */
1842 .subdevice = 0xa70b, 2197 .subdevice = 0xa70b,
1843 .driver_data = SAA7134_BOARD_MD2819, 2198 .driver_data = SAA7134_BOARD_MD2819,
1844 },{ 2199 },{
1845 .vendor = PCI_VENDOR_ID_PHILIPS, 2200 .vendor = PCI_VENDOR_ID_PHILIPS,
1846 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2201 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1847 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 2202 .subvendor = 0x1461, /* Avermedia Technologies Inc */
1848 .subdevice = 0x2115, 2203 .subdevice = 0x2115,
1849 .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305, 2204 .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305,
1850 },{ 2205 },{
1851 .vendor = PCI_VENDOR_ID_PHILIPS, 2206 .vendor = PCI_VENDOR_ID_PHILIPS,
1852 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2207 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1853 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 2208 .subvendor = 0x1461, /* Avermedia Technologies Inc */
1854 .subdevice = 0x2108, 2209 .subdevice = 0x2108,
1855 .driver_data = SAA7134_BOARD_AVERMEDIA_305, 2210 .driver_data = SAA7134_BOARD_AVERMEDIA_305,
1856 },{ 2211 },{
1857 .vendor = PCI_VENDOR_ID_PHILIPS, 2212 .vendor = PCI_VENDOR_ID_PHILIPS,
1858 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2213 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1859 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 2214 .subvendor = 0x1461, /* Avermedia Technologies Inc */
1860 .subdevice = 0x10ff, 2215 .subdevice = 0x10ff,
1861 .driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER, 2216 .driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER,
1862 },{ 2217 },{
1863 /* AVerMedia CardBus */ 2218 /* AVerMedia CardBus */
1864 .vendor = PCI_VENDOR_ID_PHILIPS, 2219 .vendor = PCI_VENDOR_ID_PHILIPS,
1865 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2220 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1866 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 2221 .subvendor = 0x1461, /* Avermedia Technologies Inc */
1867 .subdevice = 0xd6ee, 2222 .subdevice = 0xd6ee,
1868 .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS, 2223 .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS,
1869 },{ 2224 },{
1870 /* TransGear 3000TV */ 2225 /* TransGear 3000TV */
1871 .vendor = PCI_VENDOR_ID_PHILIPS, 2226 .vendor = PCI_VENDOR_ID_PHILIPS,
1872 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2227 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1873 .subvendor = 0x1461, /* Avermedia Technologies Inc */ 2228 .subvendor = 0x1461, /* Avermedia Technologies Inc */
1874 .subdevice = 0x050c, 2229 .subdevice = 0x050c,
1875 .driver_data = SAA7134_BOARD_TG3000TV, 2230 .driver_data = SAA7134_BOARD_TG3000TV,
1876 },{ 2231 },{
1877 .vendor = PCI_VENDOR_ID_PHILIPS,
1878 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1879 .subvendor = 0x11bd,
1880 .subdevice = 0x002b,
1881 .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
1882 },{
1883 .vendor = PCI_VENDOR_ID_PHILIPS,
1884 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1885 .subvendor = 0x11bd,
1886 .subdevice = 0x002d,
1887 .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL,
1888 },{
1889 .vendor = PCI_VENDOR_ID_PHILIPS,
1890 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1891 .subvendor = 0x1019,
1892 .subdevice = 0x4cb4,
1893 .driver_data = SAA7134_BOARD_ECS_TVP3XP,
1894 },{
1895 .vendor = PCI_VENDOR_ID_PHILIPS,
1896 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1897 .subvendor = 0x1019,
1898 .subdevice = 0x4cb5,
1899 .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5,
1900 },{
1901 .vendor = PCI_VENDOR_ID_PHILIPS, 2232 .vendor = PCI_VENDOR_ID_PHILIPS,
1902 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2233 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1903 .subvendor = 0x12ab, 2234 .subvendor = 0x11bd,
1904 .subdevice = 0x0800, 2235 .subdevice = 0x002b,
1905 .driver_data = SAA7133_BOARD_UPMOST_PURPLE_TV, 2236 .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
2237 },{
2238 .vendor = PCI_VENDOR_ID_PHILIPS,
2239 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
2240 .subvendor = 0x11bd,
2241 .subdevice = 0x002d,
2242 .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL,
2243 },{
2244 .vendor = PCI_VENDOR_ID_PHILIPS,
2245 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
2246 .subvendor = 0x1019,
2247 .subdevice = 0x4cb4,
2248 .driver_data = SAA7134_BOARD_ECS_TVP3XP,
2249 },{
2250 .vendor = PCI_VENDOR_ID_PHILIPS,
2251 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2252 .subvendor = 0x1019,
2253 .subdevice = 0x4cb5,
2254 .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5,
2255 },{
2256 .vendor = PCI_VENDOR_ID_PHILIPS,
2257 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2258 .subvendor = 0x12ab,
2259 .subdevice = 0x0800,
2260 .driver_data = SAA7134_BOARD_UPMOST_PURPLE_TV,
1906 },{ 2261 },{
1907 .vendor = PCI_VENDOR_ID_PHILIPS, 2262 .vendor = PCI_VENDOR_ID_PHILIPS,
1908 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2263 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1909 .subvendor = 0x153B, 2264 .subvendor = 0x153B,
1910 .subdevice = 0x1152, 2265 .subdevice = 0x1152,
1911 .driver_data = SAA7134_BOARD_CINERGY200, 2266 .driver_data = SAA7134_BOARD_CINERGY200,
1912 },{ 2267 },{
1913 .vendor = PCI_VENDOR_ID_PHILIPS, 2268 .vendor = PCI_VENDOR_ID_PHILIPS,
1914 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2269 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1915 .subvendor = 0x185b, 2270 .subvendor = 0x185b,
1916 .subdevice = 0xc100, 2271 .subdevice = 0xc100,
1917 .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, 2272 .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR,
1918 },{ 2273 },{
1919 .vendor = PCI_VENDOR_ID_PHILIPS, 2274 .vendor = PCI_VENDOR_ID_PHILIPS,
1920 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2275 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1921 .subvendor = 0x1131, 2276 .subvendor = 0x1131,
1922 .subdevice = 0, 2277 .subdevice = 0,
1923 .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM, 2278 .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM,
1924 },{ 2279 },{
1925 .vendor = PCI_VENDOR_ID_PHILIPS, 2280 .vendor = PCI_VENDOR_ID_PHILIPS,
@@ -1939,18 +2294,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
1939 .subvendor = 0x185b, 2294 .subvendor = 0x185b,
1940 .subdevice = 0xc200, 2295 .subdevice = 0xc200,
1941 .driver_data = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS, 2296 .driver_data = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS,
1942 },{ 2297 },{
1943 .vendor = PCI_VENDOR_ID_PHILIPS, 2298 .vendor = PCI_VENDOR_ID_PHILIPS,
1944 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2299 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1945 .subvendor = 0x1540, 2300 .subvendor = 0x1540,
1946 .subdevice = 0x9524, 2301 .subdevice = 0x9524,
1947 .driver_data = SAA7134_BOARD_PROVIDEO_PV952, 2302 .driver_data = SAA7134_BOARD_PROVIDEO_PV952,
1948 2303
1949 },{ 2304 },{
1950 .vendor = PCI_VENDOR_ID_PHILIPS, 2305 .vendor = PCI_VENDOR_ID_PHILIPS,
1951 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2306 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1952 .subvendor = 0x5168, 2307 .subvendor = 0x5168,
1953 .subdevice = 0x0306, 2308 .subdevice = 0x0502, /* Cardbus version */
2309 .driver_data = SAA7134_BOARD_FLYDVBTDUO,
2310 },{
2311 .vendor = PCI_VENDOR_ID_PHILIPS,
2312 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2313 .subvendor = 0x5168,
2314 .subdevice = 0x0306, /* PCI version */
1954 .driver_data = SAA7134_BOARD_FLYDVBTDUO, 2315 .driver_data = SAA7134_BOARD_FLYDVBTDUO,
1955 },{ 2316 },{
1956 .vendor = PCI_VENDOR_ID_PHILIPS, 2317 .vendor = PCI_VENDOR_ID_PHILIPS,
@@ -1959,31 +2320,44 @@ struct pci_device_id saa7134_pci_tbl[] = {
1959 .subdevice = 0xf31f, 2320 .subdevice = 0xf31f,
1960 .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM, 2321 .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM,
1961 2322
1962 },{ 2323 },{
1963 .vendor = PCI_VENDOR_ID_PHILIPS, 2324 .vendor = PCI_VENDOR_ID_PHILIPS,
1964 .device = PCI_DEVICE_ID_PHILIPS_SAA7135, 2325 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
2326 .subvendor = PCI_VENDOR_ID_PHILIPS,
2327 .subdevice = 0x2004,
2328 .driver_data = SAA7134_BOARD_PHILIPS_TOUGH,
2329 },{
2330 .vendor = PCI_VENDOR_ID_PHILIPS,
2331 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1965 .subvendor = 0x1421, 2332 .subvendor = 0x1421,
1966 .subdevice = 0x0350, /* PCI version */ 2333 .subdevice = 0x0350, /* PCI version */
1967 .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, 2334 .driver_data = SAA7134_BOARD_ADS_INSTANT_TV,
1968 2335
1969 },{ 2336 },{
1970 .vendor = PCI_VENDOR_ID_PHILIPS, 2337 .vendor = PCI_VENDOR_ID_PHILIPS,
1971 .device = PCI_DEVICE_ID_PHILIPS_SAA7135, 2338 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
1972 .subvendor = 0x1421, 2339 .subvendor = 0x1421,
1973 .subdevice = 0x0370, /* cardbus version */ 2340 .subdevice = 0x0370, /* cardbus version */
1974 .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, 2341 .driver_data = SAA7134_BOARD_ADS_INSTANT_TV,
1975 2342
1976 },{ 2343 },{ /* Typhoon DVB-T Duo Digital/Analog Cardbus */
2344 .vendor = PCI_VENDOR_ID_PHILIPS,
2345 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2346 .subvendor = 0x4e42,
2347 .subdevice = 0x0502,
2348 .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS,
2349
2350 },{
1977 /* --- boards without eeprom + subsystem ID --- */ 2351 /* --- boards without eeprom + subsystem ID --- */
1978 .vendor = PCI_VENDOR_ID_PHILIPS, 2352 .vendor = PCI_VENDOR_ID_PHILIPS,
1979 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2353 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
1980 .subvendor = PCI_VENDOR_ID_PHILIPS, 2354 .subvendor = PCI_VENDOR_ID_PHILIPS,
1981 .subdevice = 0, 2355 .subdevice = 0,
1982 .driver_data = SAA7134_BOARD_NOAUTO, 2356 .driver_data = SAA7134_BOARD_NOAUTO,
1983 },{ 2357 },{
1984 .vendor = PCI_VENDOR_ID_PHILIPS, 2358 .vendor = PCI_VENDOR_ID_PHILIPS,
1985 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2359 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1986 .subvendor = PCI_VENDOR_ID_PHILIPS, 2360 .subvendor = PCI_VENDOR_ID_PHILIPS,
1987 .subdevice = 0, 2361 .subdevice = 0,
1988 .driver_data = SAA7134_BOARD_NOAUTO, 2362 .driver_data = SAA7134_BOARD_NOAUTO,
1989 },{ 2363 },{
@@ -1991,26 +2365,26 @@ struct pci_device_id saa7134_pci_tbl[] = {
1991 /* --- default catch --- */ 2365 /* --- default catch --- */
1992 .vendor = PCI_VENDOR_ID_PHILIPS, 2366 .vendor = PCI_VENDOR_ID_PHILIPS,
1993 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 2367 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
1994 .subvendor = PCI_ANY_ID, 2368 .subvendor = PCI_ANY_ID,
1995 .subdevice = PCI_ANY_ID, 2369 .subdevice = PCI_ANY_ID,
1996 .driver_data = SAA7134_BOARD_UNKNOWN, 2370 .driver_data = SAA7134_BOARD_UNKNOWN,
1997 },{ 2371 },{
1998 .vendor = PCI_VENDOR_ID_PHILIPS, 2372 .vendor = PCI_VENDOR_ID_PHILIPS,
1999 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 2373 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2000 .subvendor = PCI_ANY_ID, 2374 .subvendor = PCI_ANY_ID,
2001 .subdevice = PCI_ANY_ID, 2375 .subdevice = PCI_ANY_ID,
2002 .driver_data = SAA7134_BOARD_UNKNOWN, 2376 .driver_data = SAA7134_BOARD_UNKNOWN,
2003 },{ 2377 },{
2004 .vendor = PCI_VENDOR_ID_PHILIPS, 2378 .vendor = PCI_VENDOR_ID_PHILIPS,
2005 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2379 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
2006 .subvendor = PCI_ANY_ID, 2380 .subvendor = PCI_ANY_ID,
2007 .subdevice = PCI_ANY_ID, 2381 .subdevice = PCI_ANY_ID,
2008 .driver_data = SAA7134_BOARD_UNKNOWN, 2382 .driver_data = SAA7134_BOARD_UNKNOWN,
2009 },{ 2383 },{
2010 .vendor = PCI_VENDOR_ID_PHILIPS, 2384 .vendor = PCI_VENDOR_ID_PHILIPS,
2011 .device = PCI_DEVICE_ID_PHILIPS_SAA7135, 2385 .device = PCI_DEVICE_ID_PHILIPS_SAA7135,
2012 .subvendor = PCI_ANY_ID, 2386 .subvendor = PCI_ANY_ID,
2013 .subdevice = PCI_ANY_ID, 2387 .subdevice = PCI_ANY_ID,
2014 .driver_data = SAA7134_BOARD_UNKNOWN, 2388 .driver_data = SAA7134_BOARD_UNKNOWN,
2015 },{ 2389 },{
2016 /* --- end of list --- */ 2390 /* --- end of list --- */
@@ -2021,46 +2395,9 @@ MODULE_DEVICE_TABLE(pci, saa7134_pci_tbl);
2021/* ----------------------------------------------------------- */ 2395/* ----------------------------------------------------------- */
2022/* flyvideo tweaks */ 2396/* flyvideo tweaks */
2023 2397
2024#if 0
2025static struct {
2026 char *model;
2027 int tuner_type;
2028} fly_list[0x20] = {
2029 /* default catch ... */
2030 [ 0 ... 0x1f ] = {
2031 .model = "UNKNOWN",
2032 .tuner_type = TUNER_ABSENT,
2033 },
2034 /* ... the ones known so far */
2035 [ 0x05 ] = {
2036 .model = "PAL-BG",
2037 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
2038 },
2039 [ 0x10 ] = {
2040 .model = "PAL-BG / PAL-DK",
2041 .tuner_type = TUNER_PHILIPS_PAL,
2042 },
2043 [ 0x15 ] = {
2044 .model = "NTSC",
2045 .tuner_type = TUNER_ABSENT /* FIXME */,
2046 },
2047};
2048#endif
2049 2398
2050static void board_flyvideo(struct saa7134_dev *dev) 2399static void board_flyvideo(struct saa7134_dev *dev)
2051{ 2400{
2052#if 0
2053 /* non-working attempt to detect the correct tuner type ... */
2054 u32 value;
2055 int index;
2056
2057 value = dev->gpio_value;
2058 index = (value & 0x1f00) >> 8;
2059 printk(KERN_INFO "%s: flyvideo: gpio is 0x%x [model=%s,tuner=%d]\n",
2060 dev->name, value, fly_list[index].model,
2061 fly_list[index].tuner_type);
2062 dev->tuner_type = fly_list[index].tuner_type;
2063#endif
2064 printk("%s: there are different flyvideo cards with different tuners\n" 2401 printk("%s: there are different flyvideo cards with different tuners\n"
2065 "%s: out there, you might have to use the tuner=<nr> insmod\n" 2402 "%s: out there, you might have to use the tuner=<nr> insmod\n"
2066 "%s: option to override the default value.\n", 2403 "%s: option to override the default value.\n",
@@ -2071,7 +2408,7 @@ static void board_flyvideo(struct saa7134_dev *dev)
2071 2408
2072int saa7134_board_init1(struct saa7134_dev *dev) 2409int saa7134_board_init1(struct saa7134_dev *dev)
2073{ 2410{
2074 // Always print gpio, often manufacturers encode tuner type and other info. 2411 /* Always print gpio, often manufacturers encode tuner type and other info. */
2075 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0); 2412 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0);
2076 dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); 2413 dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
2077 printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value); 2414 printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value);
@@ -2082,7 +2419,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
2082 dev->has_remote = 1; 2419 dev->has_remote = 1;
2083 board_flyvideo(dev); 2420 board_flyvideo(dev);
2084 break; 2421 break;
2085 case SAA7134_BOARD_FLYTVPLATINUM_FM: 2422 case SAA7134_BOARD_FLYTVPLATINUM_FM:
2086 case SAA7134_BOARD_CINERGY400: 2423 case SAA7134_BOARD_CINERGY400:
2087 case SAA7134_BOARD_CINERGY600: 2424 case SAA7134_BOARD_CINERGY600:
2088 case SAA7134_BOARD_CINERGY600_MK3: 2425 case SAA7134_BOARD_CINERGY600_MK3:
@@ -2090,23 +2427,25 @@ int saa7134_board_init1(struct saa7134_dev *dev)
2090 case SAA7134_BOARD_ECS_TVP3XP_4CB5: 2427 case SAA7134_BOARD_ECS_TVP3XP_4CB5:
2091 case SAA7134_BOARD_MD2819: 2428 case SAA7134_BOARD_MD2819:
2092 case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: 2429 case SAA7134_BOARD_KWORLD_VSTREAM_XPERT:
2430 case SAA7134_BOARD_KWORLD_XPERT:
2093 case SAA7134_BOARD_AVERMEDIA_STUDIO_305: 2431 case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
2094 case SAA7134_BOARD_AVERMEDIA_305: 2432 case SAA7134_BOARD_AVERMEDIA_305:
2095 case SAA7134_BOARD_AVERMEDIA_STUDIO_307: 2433 case SAA7134_BOARD_AVERMEDIA_STUDIO_307:
2096 case SAA7134_BOARD_AVERMEDIA_307: 2434 case SAA7134_BOARD_AVERMEDIA_307:
2097 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 2435 case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
2098// case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */ 2436/* case SAA7134_BOARD_SABRENT_SBTTVFM: */ /* not finished yet */
2099 case SAA7134_BOARD_VIDEOMATE_TV_PVR: 2437 case SAA7134_BOARD_VIDEOMATE_TV_PVR:
2100 case SAA7134_BOARD_MANLI_MTV001: 2438 case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
2101 case SAA7134_BOARD_MANLI_MTV002: 2439 case SAA7134_BOARD_MANLI_MTV001:
2440 case SAA7134_BOARD_MANLI_MTV002:
2102 case SAA7134_BOARD_AVACSSMARTTV: 2441 case SAA7134_BOARD_AVACSSMARTTV:
2103 dev->has_remote = 1; 2442 dev->has_remote = 1;
2104 break; 2443 break;
2105 case SAA7134_BOARD_MD5044: 2444 case SAA7134_BOARD_MD5044:
2106 printk("%s: seems there are two different versions of the MD5044\n" 2445 printk("%s: seems there are two different versions of the MD5044\n"
2107 "%s: (with the same ID) out there. If sound doesn't work for\n" 2446 "%s: (with the same ID) out there. If sound doesn't work for\n"
2108 "%s: you try the audio_clock_override=0x200000 insmod option.\n", 2447 "%s: you try the audio_clock_override=0x200000 insmod option.\n",
2109 dev->name,dev->name,dev->name); 2448 dev->name,dev->name,dev->name);
2110 break; 2449 break;
2111 case SAA7134_BOARD_CINERGY400_CARDBUS: 2450 case SAA7134_BOARD_CINERGY400_CARDBUS:
2112 /* power-up tuner chip */ 2451 /* power-up tuner chip */
@@ -2114,11 +2453,19 @@ int saa7134_board_init1(struct saa7134_dev *dev)
2114 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); 2453 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);
2115 msleep(1); 2454 msleep(1);
2116 break; 2455 break;
2456 case SAA7134_BOARD_FLYDVBTDUO:
2457 case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS:
2458 /* turn the fan on Hac: static for the time being */
2459 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
2460 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06);
2461 break;
2462 case SAA7134_BOARD_AVERMEDIA_CARDBUS:
2463 /* power-up tuner chip */
2464 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff);
2465 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
2466 msleep(1);
2467 break;
2117 } 2468 }
2118 if (dev->has_remote)
2119 dev->irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 |
2120 SAA7134_IRQ2_INTE_GPIO18A |
2121 SAA7134_IRQ2_INTE_GPIO16 );
2122 return 0; 2469 return 0;
2123} 2470}
2124 2471
@@ -2139,10 +2486,85 @@ int saa7134_board_init2(struct saa7134_dev *dev)
2139 break; 2486 break;
2140 dev->board = board; 2487 dev->board = board;
2141 printk("%s: board type fixup: %s\n", dev->name, 2488 printk("%s: board type fixup: %s\n", dev->name,
2142 saa7134_boards[dev->board].name); 2489 saa7134_boards[dev->board].name);
2143 dev->tuner_type = saa7134_boards[dev->board].tuner_type; 2490 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
2144 if (TUNER_ABSENT != dev->tuner_type) 2491
2145 saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type); 2492 if (TUNER_ABSENT != dev->tuner_type) {
2493 struct tuner_setup tun_setup;
2494
2495 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
2496 tun_setup.type = dev->tuner_type;
2497 tun_setup.addr = ADDR_UNSET;
2498
2499 saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup);
2500 }
2501 break;
2502case SAA7134_BOARD_MD7134:
2503 {
2504 struct tuner_setup tun_setup;
2505 u8 subaddr;
2506 u8 data[3];
2507 int ret, tuner_t;
2508
2509 struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1},
2510 {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}};
2511 subaddr= 0x14;
2512 tuner_t = 0;
2513 ret = i2c_transfer(&dev->i2c_adap, msg, 2);
2514 if (ret != 2) {
2515 printk(KERN_ERR "EEPROM read failure\n");
2516 } else if ((data[0] != 0) && (data[0] != 0xff)) {
2517 /* old config structure */
2518 subaddr = data[0] + 2;
2519 msg[1].len = 2;
2520 i2c_transfer(&dev->i2c_adap, msg, 2);
2521 tuner_t = (data[0] << 8) + data[1];
2522 switch (tuner_t){
2523 case 0x0103:
2524 dev->tuner_type = TUNER_PHILIPS_PAL;
2525 break;
2526 case 0x010C:
2527 dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
2528 break;
2529 default:
2530 printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
2531 }
2532 } else if ((data[1] != 0) && (data[1] != 0xff)) {
2533 /* new config structure */
2534 subaddr = data[1] + 1;
2535 msg[1].len = 1;
2536 i2c_transfer(&dev->i2c_adap, msg, 2);
2537 subaddr = data[0] + 1;
2538 msg[1].len = 2;
2539 i2c_transfer(&dev->i2c_adap, msg, 2);
2540 tuner_t = (data[1] << 8) + data[0];
2541 switch (tuner_t) {
2542 case 0x0005:
2543 dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
2544 break;
2545 case 0x001d:
2546 dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3;
2547 printk(KERN_INFO "%s Board has DVB-T\n", dev->name);
2548 break;
2549 default:
2550 printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
2551 }
2552 } else {
2553 printk(KERN_ERR "%s unexpected config structure\n", dev->name);
2554 }
2555
2556 printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type);
2557 if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) {
2558 dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE;
2559 saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf);
2560 }
2561
2562 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
2563 tun_setup.type = dev->tuner_type;
2564 tun_setup.addr = ADDR_UNSET;
2565
2566 saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup);
2567 }
2146 break; 2568 break;
2147 } 2569 }
2148 return 0; 2570 return 0;
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index f61ed1849a2a..1dbe61755e9f 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-core.c,v 1.30 2005/05/22 19:23:39 nsh Exp $ 2 * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * driver core 5 * driver core
@@ -183,46 +183,6 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
183 183
184/* ------------------------------------------------------------------ */ 184/* ------------------------------------------------------------------ */
185 185
186#if 0
187static char *dec1_bits[8] = {
188 "DCSTD0", "DCSCT1", "WIPA", "GLIMB",
189 "GLIMT", "SLTCA", "HLCK"
190};
191static char *dec2_bits[8] = {
192 "RDCAP", "COPRO", "COLSTR", "TYPE3",
193 NULL, "FIDT", "HLVLN", "INTL"
194};
195static char *scale1_bits[8] = {
196 "VID_A", "VBI_A", NULL, NULL, "VID_B", "VBI_B"
197};
198static char *scale2_bits[8] = {
199 "TRERR", "CFERR", "LDERR", "WASRST",
200 "FIDSCI", "FIDSCO", "D6^D5", "TASK"
201};
202
203static void dump_statusreg(struct saa7134_dev *dev, int reg,
204 char *regname, char **bits)
205{
206 int value,i;
207
208 value = saa_readb(reg);
209 printk(KERN_DEBUG "%s: %s:", dev->name, regname);
210 for (i = 7; i >= 0; i--) {
211 if (NULL == bits[i])
212 continue;
213 printk(" %s=%d", bits[i], (value & (1 << i)) ? 1 : 0);
214 }
215 printk("\n");
216}
217
218static void dump_statusregs(struct saa7134_dev *dev)
219{
220 dump_statusreg(dev,SAA7134_STATUS_VIDEO1,"dec1",dec1_bits);
221 dump_statusreg(dev,SAA7134_STATUS_VIDEO2,"dec2",dec2_bits);
222 dump_statusreg(dev,SAA7134_SCALER_STATUS0,"scale0",scale1_bits);
223 dump_statusreg(dev,SAA7134_SCALER_STATUS1,"scale1",scale2_bits);
224}
225#endif
226 186
227/* ----------------------------------------------------------- */ 187/* ----------------------------------------------------------- */
228/* delayed request_module */ 188/* delayed request_module */
@@ -616,10 +576,6 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
616 if (irq_debug) 576 if (irq_debug)
617 print_irqstatus(dev,loop,report,status); 577 print_irqstatus(dev,loop,report,status);
618 578
619#if 0
620 if (report & SAA7134_IRQ_REPORT_CONF_ERR)
621 dump_statusregs(dev);
622#endif
623 579
624 if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */) 580 if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */)
625 saa7134_irq_video_intl(dev); 581 saa7134_irq_video_intl(dev);
@@ -711,7 +667,6 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
711 SAA7134_MAIN_CTRL_EVFE1 | 667 SAA7134_MAIN_CTRL_EVFE1 |
712 SAA7134_MAIN_CTRL_EVFE2 | 668 SAA7134_MAIN_CTRL_EVFE2 |
713 SAA7134_MAIN_CTRL_ESFE | 669 SAA7134_MAIN_CTRL_ESFE |
714 SAA7134_MAIN_CTRL_EBADC |
715 SAA7134_MAIN_CTRL_EBDAC); 670 SAA7134_MAIN_CTRL_EBDAC);
716 671
717 /* enable peripheral devices */ 672 /* enable peripheral devices */
@@ -726,14 +681,28 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
726/* late init (with i2c + irq) */ 681/* late init (with i2c + irq) */
727static int saa7134_hwinit2(struct saa7134_dev *dev) 682static int saa7134_hwinit2(struct saa7134_dev *dev)
728{ 683{
684 unsigned int irq2_mask;
729 dprintk("hwinit2\n"); 685 dprintk("hwinit2\n");
730 686
731 saa7134_video_init2(dev); 687 saa7134_video_init2(dev);
732 saa7134_tvaudio_init2(dev); 688 saa7134_tvaudio_init2(dev);
733 689
734 /* enable IRQ's */ 690 /* enable IRQ's */
691 irq2_mask =
692 SAA7134_IRQ2_INTE_DEC3 |
693 SAA7134_IRQ2_INTE_DEC2 |
694 SAA7134_IRQ2_INTE_DEC1 |
695 SAA7134_IRQ2_INTE_DEC0 |
696 SAA7134_IRQ2_INTE_PE |
697 SAA7134_IRQ2_INTE_AR;
698
699 if (dev->has_remote)
700 irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 |
701 SAA7134_IRQ2_INTE_GPIO18A |
702 SAA7134_IRQ2_INTE_GPIO16 );
703
735 saa_writel(SAA7134_IRQ1, 0); 704 saa_writel(SAA7134_IRQ1, 0);
736 saa_writel(SAA7134_IRQ2, dev->irq2_mask); 705 saa_writel(SAA7134_IRQ2, irq2_mask);
737 706
738 return 0; 707 return 0;
739} 708}
@@ -954,13 +923,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
954 } 923 }
955 924
956 /* initialize hardware #1 */ 925 /* initialize hardware #1 */
957 dev->irq2_mask =
958 SAA7134_IRQ2_INTE_DEC3 |
959 SAA7134_IRQ2_INTE_DEC2 |
960 SAA7134_IRQ2_INTE_DEC1 |
961 SAA7134_IRQ2_INTE_DEC0 |
962 SAA7134_IRQ2_INTE_PE |
963 SAA7134_IRQ2_INTE_AR;
964 saa7134_board_init1(dev); 926 saa7134_board_init1(dev);
965 saa7134_hwinit1(dev); 927 saa7134_hwinit1(dev);
966 928
@@ -990,6 +952,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
990 request_module("saa6752hs"); 952 request_module("saa6752hs");
991 request_module_depend("saa7134-empress",&need_empress); 953 request_module_depend("saa7134-empress",&need_empress);
992 } 954 }
955
993 if (card_is_dvb(dev)) 956 if (card_is_dvb(dev))
994 request_module_depend("saa7134-dvb",&need_dvb); 957 request_module_depend("saa7134-dvb",&need_dvb);
995 958
@@ -1144,9 +1107,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1144 release_mem_region(pci_resource_start(pci_dev,0), 1107 release_mem_region(pci_resource_start(pci_dev,0),
1145 pci_resource_len(pci_dev,0)); 1108 pci_resource_len(pci_dev,0));
1146 1109
1147#if 0 /* causes some trouble when reinserting the driver ... */
1148 pci_disable_device(pci_dev);
1149#endif
1150 pci_set_drvdata(pci_dev, NULL); 1110 pci_set_drvdata(pci_dev, NULL);
1151 1111
1152 /* free memory */ 1112 /* free memory */
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index aa8e2cf62d55..334bc1850092 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1,8 +1,11 @@
1/* 1/*
2 * $Id: saa7134-dvb.c,v 1.13 2005/06/12 04:19:19 mchehab Exp $ 2 * $Id: saa7134-dvb.c,v 1.18 2005/07/04 16:05:50 mkrufky Exp $
3 * 3 *
4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
5 * 5 *
6 * Extended 3 / 2005 by Hartmut Hackmann to support various
7 * cards with the tda10046 DVB-T channel decoder
8 *
6 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
@@ -27,23 +30,31 @@
27#include <linux/kthread.h> 30#include <linux/kthread.h>
28#include <linux/suspend.h> 31#include <linux/suspend.h>
29 32
33#define CONFIG_DVB_MT352 1
34#define CONFIG_DVB_TDA1004X 1
35
30#include "saa7134-reg.h" 36#include "saa7134-reg.h"
31#include "saa7134.h" 37#include "saa7134.h"
32 38
33#include "dvb-pll.h" 39#if CONFIG_DVB_MT352
34#include "mt352.h" 40# include "mt352.h"
35#include "mt352_priv.h" /* FIXME */ 41# include "mt352_priv.h" /* FIXME */
36#include "tda1004x.h" 42#endif
43#if CONFIG_DVB_TDA1004X
44# include "tda1004x.h"
45#endif
37 46
38MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 47MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
39MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
40 49
41static unsigned int antenna_pwr = 0; 50static unsigned int antenna_pwr = 0;
51
42module_param(antenna_pwr, int, 0444); 52module_param(antenna_pwr, int, 0444);
43MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); 53MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
44 54
45/* ------------------------------------------------------------------ */ 55/* ------------------------------------------------------------------ */
46 56
57#if CONFIG_DVB_MT352
47static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) 58static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
48{ 59{
49 u32 ok; 60 u32 ok;
@@ -138,51 +149,390 @@ static struct mt352_config pinnacle_300i = {
138 .demod_init = mt352_pinnacle_init, 149 .demod_init = mt352_pinnacle_init,
139 .pll_set = mt352_pinnacle_pll_set, 150 .pll_set = mt352_pinnacle_pll_set,
140}; 151};
152#endif
141 153
142/* ------------------------------------------------------------------ */ 154/* ------------------------------------------------------------------ */
143 155
144static int medion_cardbus_init(struct dvb_frontend* fe) 156#if CONFIG_DVB_TDA1004X
157static int philips_tu1216_pll_init(struct dvb_frontend *fe)
145{ 158{
146 /* anything to do here ??? */ 159 struct saa7134_dev *dev = fe->dvb->priv;
160 static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab };
161 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) };
162
163 /* setup PLL configuration */
164 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
165 return -EIO;
166 msleep(1);
167
147 return 0; 168 return 0;
148} 169}
149 170
150static int medion_cardbus_pll_set(struct dvb_frontend* fe, 171static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
151 struct dvb_frontend_parameters* params)
152{ 172{
153 struct saa7134_dev *dev = fe->dvb->priv; 173 struct saa7134_dev *dev = fe->dvb->priv;
154 struct v4l2_frequency f; 174 u8 tuner_buf[4];
175 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len =
176 sizeof(tuner_buf) };
177 int tuner_frequency = 0;
178 u8 band, cp, filter;
179
180 /* determine charge pump */
181 tuner_frequency = params->frequency + 36166000;
182 if (tuner_frequency < 87000000)
183 return -EINVAL;
184 else if (tuner_frequency < 130000000)
185 cp = 3;
186 else if (tuner_frequency < 160000000)
187 cp = 5;
188 else if (tuner_frequency < 200000000)
189 cp = 6;
190 else if (tuner_frequency < 290000000)
191 cp = 3;
192 else if (tuner_frequency < 420000000)
193 cp = 5;
194 else if (tuner_frequency < 480000000)
195 cp = 6;
196 else if (tuner_frequency < 620000000)
197 cp = 3;
198 else if (tuner_frequency < 830000000)
199 cp = 5;
200 else if (tuner_frequency < 895000000)
201 cp = 7;
202 else
203 return -EINVAL;
204
205 /* determine band */
206 if (params->frequency < 49000000)
207 return -EINVAL;
208 else if (params->frequency < 161000000)
209 band = 1;
210 else if (params->frequency < 444000000)
211 band = 2;
212 else if (params->frequency < 861000000)
213 band = 4;
214 else
215 return -EINVAL;
216
217 /* setup PLL filter */
218 switch (params->u.ofdm.bandwidth) {
219 case BANDWIDTH_6_MHZ:
220 filter = 0;
221 break;
155 222
156 /* 223 case BANDWIDTH_7_MHZ:
157 * this instructs tuner.o to set the frequency, the call will 224 filter = 0;
158 * end up in tuner_command(), VIDIOC_S_FREQUENCY switch. 225 break;
159 * tda9887.o will see that as well. 226
227 case BANDWIDTH_8_MHZ:
228 filter = 1;
229 break;
230
231 default:
232 return -EINVAL;
233 }
234
235 /* calculate divisor
236 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
160 */ 237 */
161 f.tuner = 0; 238 tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000;
162 f.type = V4L2_TUNER_DIGITAL_TV; 239
163 f.frequency = params->frequency / 1000 * 16 / 1000; 240 /* setup tuner buffer */
164 saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); 241 tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
242 tuner_buf[1] = tuner_frequency & 0xff;
243 tuner_buf[2] = 0xca;
244 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
245
246 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
247 return -EIO;
248
249 msleep(1);
165 return 0; 250 return 0;
166} 251}
167 252
168static int fe_request_firmware(struct dvb_frontend* fe, 253static int philips_tu1216_request_firmware(struct dvb_frontend *fe,
169 const struct firmware **fw, char* name) 254 const struct firmware **fw, char *name)
170{ 255{
171 struct saa7134_dev *dev = fe->dvb->priv; 256 struct saa7134_dev *dev = fe->dvb->priv;
172 return request_firmware(fw, name, &dev->pci->dev); 257 return request_firmware(fw, name, &dev->pci->dev);
173} 258}
174 259
260static struct tda1004x_config philips_tu1216_config = {
261
262 .demod_address = 0x8,
263 .invert = 1,
264 .invert_oclk = 1,
265 .xtal_freq = TDA10046_XTAL_4M,
266 .agc_config = TDA10046_AGC_DEFAULT,
267 .if_freq = TDA10046_FREQ_3617,
268 .pll_init = philips_tu1216_pll_init,
269 .pll_set = philips_tu1216_pll_set,
270 .pll_sleep = NULL,
271 .request_firmware = philips_tu1216_request_firmware,
272};
273
274/* ------------------------------------------------------------------ */
275
276
277static int philips_fmd1216_pll_init(struct dvb_frontend *fe)
278{
279 struct saa7134_dev *dev = fe->dvb->priv;
280 /* this message is to set up ATC and ALC */
281 static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 };
282 struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) };
283
284 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
285 return -EIO;
286 msleep(1);
287
288 return 0;
289}
290
291static void philips_fmd1216_analog(struct dvb_frontend *fe)
292{
293 struct saa7134_dev *dev = fe->dvb->priv;
294 /* this message actually turns the tuner back to analog mode */
295 static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 };
296 struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) };
297
298 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
299 msleep(1);
300 fmd1216_init[2] = 0x86;
301 fmd1216_init[3] = 0x54;
302 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
303 msleep(1);
304}
305
306static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
307{
308 struct saa7134_dev *dev = fe->dvb->priv;
309 u8 tuner_buf[4];
310 struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len =
311 sizeof(tuner_buf) };
312 int tuner_frequency = 0;
313 int divider = 0;
314 u8 band, mode, cp;
315
316 /* determine charge pump */
317 tuner_frequency = params->frequency + 36130000;
318 if (tuner_frequency < 87000000)
319 return -EINVAL;
320 /* low band */
321 else if (tuner_frequency < 180000000) {
322 band = 1;
323 mode = 7;
324 cp = 0;
325 } else if (tuner_frequency < 195000000) {
326 band = 1;
327 mode = 6;
328 cp = 1;
329 /* mid band */
330 } else if (tuner_frequency < 366000000) {
331 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
332 band = 10;
333 } else {
334 band = 2;
335 }
336 mode = 7;
337 cp = 0;
338 } else if (tuner_frequency < 478000000) {
339 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
340 band = 10;
341 } else {
342 band = 2;
343 }
344 mode = 6;
345 cp = 1;
346 /* high band */
347 } else if (tuner_frequency < 662000000) {
348 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
349 band = 12;
350 } else {
351 band = 4;
352 }
353 mode = 7;
354 cp = 0;
355 } else if (tuner_frequency < 840000000) {
356 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
357 band = 12;
358 } else {
359 band = 4;
360 }
361 mode = 6;
362 cp = 1;
363 } else {
364 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
365 band = 12;
366 } else {
367 band = 4;
368 }
369 mode = 7;
370 cp = 1;
371
372 }
373 /* calculate divisor */
374 /* ((36166000 + Finput) / 166666) rounded! */
375 divider = (tuner_frequency + 83333) / 166667;
376
377 /* setup tuner buffer */
378 tuner_buf[0] = (divider >> 8) & 0x7f;
379 tuner_buf[1] = divider & 0xff;
380 tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4;
381 tuner_buf[3] = 0x40 | band;
382
383 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
384 return -EIO;
385 return 0;
386}
387
388
175static struct tda1004x_config medion_cardbus = { 389static struct tda1004x_config medion_cardbus = {
176 .demod_address = 0x08, /* not sure this is correct */ 390 .demod_address = 0x08,
177 .invert = 0, 391 .invert = 1,
178 .invert_oclk = 0, 392 .invert_oclk = 0,
179 .pll_init = medion_cardbus_init, 393 .xtal_freq = TDA10046_XTAL_16M,
180 .pll_set = medion_cardbus_pll_set, 394 .agc_config = TDA10046_AGC_IFO_AUTO_NEG,
181 .request_firmware = fe_request_firmware, 395 .if_freq = TDA10046_FREQ_3613,
396 .pll_init = philips_fmd1216_pll_init,
397 .pll_set = philips_fmd1216_pll_set,
398 .pll_sleep = philips_fmd1216_analog,
399 .request_firmware = NULL,
182}; 400};
183 401
184/* ------------------------------------------------------------------ */ 402/* ------------------------------------------------------------------ */
185 403
404struct tda827x_data {
405 u32 lomax;
406 u8 spd;
407 u8 bs;
408 u8 bp;
409 u8 cp;
410 u8 gc3;
411 u8 div1p5;
412};
413
414static struct tda827x_data tda827x_dvbt[] = {
415 { .lomax = 62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
416 { .lomax = 66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
417 { .lomax = 76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
418 { .lomax = 84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
419 { .lomax = 93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
420 { .lomax = 98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
421 { .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
422 { .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
423 { .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
424 { .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
425 { .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
426 { .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0},
427 { .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
428 { .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
429 { .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
430 { .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
431 { .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
432 { .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
433 { .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
434 { .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
435 { .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
436 { .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
437 { .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
438 { .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
439 { .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
440 { .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
441 { .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
442 { .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
443 { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0}
444};
445
446static int philips_tda827x_pll_init(struct dvb_frontend *fe)
447{
448 return 0;
449}
450
451static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
452{
453 struct saa7134_dev *dev = fe->dvb->priv;
454 u8 tuner_buf[14];
455
456 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,
457 .len = sizeof(tuner_buf) };
458 int i, tuner_freq, if_freq;
459 u32 N;
460 switch (params->u.ofdm.bandwidth) {
461 case BANDWIDTH_6_MHZ:
462 if_freq = 4000000;
463 break;
464 case BANDWIDTH_7_MHZ:
465 if_freq = 4500000;
466 break;
467 default: /* 8 MHz or Auto */
468 if_freq = 5000000;
469 break;
470 }
471 tuner_freq = params->frequency + if_freq;
472
473 i = 0;
474 while (tda827x_dvbt[i].lomax < tuner_freq) {
475 if(tda827x_dvbt[i + 1].lomax == 0)
476 break;
477 i++;
478 }
479
480 N = ((tuner_freq + 125000) / 250000) << (tda827x_dvbt[i].spd + 2);
481 tuner_buf[0] = 0;
482 tuner_buf[1] = (N>>8) | 0x40;
483 tuner_buf[2] = N & 0xff;
484 tuner_buf[3] = 0;
485 tuner_buf[4] = 0x52;
486 tuner_buf[5] = (tda827x_dvbt[i].spd << 6) + (tda827x_dvbt[i].div1p5 << 5) +
487 (tda827x_dvbt[i].bs << 3) + tda827x_dvbt[i].bp;
488 tuner_buf[6] = (tda827x_dvbt[i].gc3 << 4) + 0x8f;
489 tuner_buf[7] = 0xbf;
490 tuner_buf[8] = 0x2a;
491 tuner_buf[9] = 0x05;
492 tuner_buf[10] = 0xff;
493 tuner_buf[11] = 0x00;
494 tuner_buf[12] = 0x00;
495 tuner_buf[13] = 0x40;
496
497 tuner_msg.len = 14;
498 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
499 return -EIO;
500
501 msleep(500);
502 /* correct CP value */
503 tuner_buf[0] = 0x30;
504 tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp;
505 tuner_msg.len = 2;
506 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
507
508 return 0;
509}
510
511static void philips_tda827x_pll_sleep(struct dvb_frontend *fe)
512{
513 struct saa7134_dev *dev = fe->dvb->priv;
514 static u8 tda827x_sleep[] = { 0x30, 0xd0};
515 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep,
516 .len = sizeof(tda827x_sleep) };
517 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
518}
519
520static struct tda1004x_config tda827x_lifeview_config = {
521 .demod_address = 0x08,
522 .invert = 1,
523 .invert_oclk = 0,
524 .xtal_freq = TDA10046_XTAL_16M,
525 .agc_config = TDA10046_AGC_TDA827X,
526 .if_freq = TDA10046_FREQ_045,
527 .pll_init = philips_tda827x_pll_init,
528 .pll_set = philips_tda827x_pll_set,
529 .pll_sleep = philips_tda827x_pll_sleep,
530 .request_firmware = NULL,
531};
532#endif
533
534/* ------------------------------------------------------------------ */
535
186static int dvb_init(struct saa7134_dev *dev) 536static int dvb_init(struct saa7134_dev *dev)
187{ 537{
188 /* init struct videobuf_dvb */ 538 /* init struct videobuf_dvb */
@@ -197,18 +547,31 @@ static int dvb_init(struct saa7134_dev *dev)
197 dev); 547 dev);
198 548
199 switch (dev->board) { 549 switch (dev->board) {
550#if CONFIG_DVB_MT352
200 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 551 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
201 printk("%s: pinnacle 300i dvb setup\n",dev->name); 552 printk("%s: pinnacle 300i dvb setup\n",dev->name);
202 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 553 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
203 &dev->i2c_adap); 554 &dev->i2c_adap);
204 break; 555 break;
556#endif
557#if CONFIG_DVB_TDA1004X
205 case SAA7134_BOARD_MD7134: 558 case SAA7134_BOARD_MD7134:
206 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 559 dev->dvb.frontend = tda10046_attach(&medion_cardbus,
207 &dev->i2c_adap); 560 &dev->i2c_adap);
208 if (NULL == dev->dvb.frontend)
209 printk("%s: Hmm, looks like this is the old MD7134 "
210 "version without DVB-T support\n",dev->name);
211 break; 561 break;
562 case SAA7134_BOARD_PHILIPS_TOUGH:
563 dev->dvb.frontend = tda10046_attach(&philips_tu1216_config,
564 &dev->i2c_adap);
565 break;
566 case SAA7134_BOARD_FLYDVBTDUO:
567 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
568 &dev->i2c_adap);
569 break;
570 case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS:
571 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
572 &dev->i2c_adap);
573 break;
574#endif
212 default: 575 default:
213 printk("%s: Huh? unknown DVB card?\n",dev->name); 576 printk("%s: Huh? unknown DVB card?\n",dev->name);
214 break; 577 break;
@@ -227,8 +590,6 @@ static int dvb_fini(struct saa7134_dev *dev)
227{ 590{
228 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; 591 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
229 592
230 printk("%s: %s\n",dev->name,__FUNCTION__);
231
232 switch (dev->board) { 593 switch (dev->board) {
233 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 594 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
234 /* otherwise we don't detect the tuner on next insmod */ 595 /* otherwise we don't detect the tuner on next insmod */
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index b6f002e8421d..93dd61978541 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $ 2 * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * i2c interface support 5 * i2c interface support
@@ -197,10 +197,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
197 enum i2c_status status; 197 enum i2c_status status;
198 __u32 dword; 198 __u32 dword;
199 199
200#if 0
201 i2c_set_attr(dev,attr);
202 saa_writeb(SAA7134_I2C_DATA, data);
203#else
204 /* have to write both attr + data in one 32bit word */ 200 /* have to write both attr + data in one 32bit word */
205 dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); 201 dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2);
206 dword &= 0x0f; 202 dword &= 0x0f;
@@ -210,7 +206,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
210// dword |= 0x40 << 16; /* 400 kHz */ 206// dword |= 0x40 << 16; /* 400 kHz */
211 dword |= 0xf0 << 24; 207 dword |= 0xf0 << 24;
212 saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); 208 saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword);
213#endif
214 d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); 209 d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data);
215 210
216 if (!i2c_is_busy_wait(dev)) 211 if (!i2c_is_busy_wait(dev))
@@ -331,12 +326,44 @@ static u32 functionality(struct i2c_adapter *adap)
331 326
332static int attach_inform(struct i2c_client *client) 327static int attach_inform(struct i2c_client *client)
333{ 328{
334 struct saa7134_dev *dev = client->adapter->algo_data; 329 struct saa7134_dev *dev = client->adapter->algo_data;
335 int tuner = dev->tuner_type; 330 int tuner = dev->tuner_type;
336 int conf = dev->tda9887_conf; 331 int conf = dev->tda9887_conf;
332 struct tuner_setup tun_setup;
333
334 d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
335 client->driver->name,client->addr,i2c_clientname(client));
336
337 if (!client->driver->command)
338 return 0;
339
340 if (saa7134_boards[dev->board].radio_type != UNSET) {
341
342 tun_setup.type = saa7134_boards[dev->board].radio_type;
343 tun_setup.addr = saa7134_boards[dev->board].radio_addr;
344
345 if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) {
346 tun_setup.mode_mask = T_RADIO;
347
348 client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup);
349 }
350 }
351
352 if (tuner != UNSET) {
353
354 tun_setup.type = tuner;
355 tun_setup.addr = saa7134_boards[dev->board].tuner_addr;
356
357 if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) {
358
359 tun_setup.mode_mask = T_ANALOG_TV;
360
361 client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup);
362 }
363 }
364
365 client->driver->command(client, TDA9887_SET_CONFIG, &conf);
337 366
338 saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&tuner);
339 saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf);
340 return 0; 367 return 0;
341} 368}
342 369
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index aba2b9de60de..213740122fe6 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-input.c,v 1.19 2005/06/07 18:02:26 nsh Exp $ 2 * $Id: saa7134-input.c,v 1.21 2005/06/22 23:37:34 nsh Exp $
3 * 3 *
4 * handle saa7134 IR remotes via linux kernel input layer. 4 * handle saa7134 IR remotes via linux kernel input layer.
5 * 5 *
@@ -68,10 +68,8 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
68 [ 6 ] = KEY_AGAIN, // Recal 68 [ 6 ] = KEY_AGAIN, // Recal
69 [ 16 ] = KEY_KPENTER, // Enter 69 [ 16 ] = KEY_KPENTER, // Enter
70 70
71#if 1 /* FIXME */
72 [ 26 ] = KEY_F22, // Stereo 71 [ 26 ] = KEY_F22, // Stereo
73 [ 24 ] = KEY_EDIT, // AV Source 72 [ 24 ] = KEY_EDIT, // AV Source
74#endif
75}; 73};
76 74
77static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { 75static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = {
@@ -172,45 +170,45 @@ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = {
172}; 170};
173 171
174static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { 172static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = {
175 [ 30 ] = KEY_POWER, // power 173 [ 30 ] = KEY_POWER, // power
176 [ 28 ] = KEY_SEARCH, // scan 174 [ 28 ] = KEY_SEARCH, // scan
177 [ 7 ] = KEY_SELECT, // source 175 [ 7 ] = KEY_SELECT, // source
178 176
179 [ 22 ] = KEY_VOLUMEUP, 177 [ 22 ] = KEY_VOLUMEUP,
180 [ 20 ] = KEY_VOLUMEDOWN, 178 [ 20 ] = KEY_VOLUMEDOWN,
181 [ 31 ] = KEY_CHANNELUP, 179 [ 31 ] = KEY_CHANNELUP,
182 [ 23 ] = KEY_CHANNELDOWN, 180 [ 23 ] = KEY_CHANNELDOWN,
183 [ 24 ] = KEY_MUTE, 181 [ 24 ] = KEY_MUTE,
184 182
185 [ 2 ] = KEY_KP0, 183 [ 2 ] = KEY_KP0,
186 [ 1 ] = KEY_KP1, 184 [ 1 ] = KEY_KP1,
187 [ 11 ] = KEY_KP2, 185 [ 11 ] = KEY_KP2,
188 [ 27 ] = KEY_KP3, 186 [ 27 ] = KEY_KP3,
189 [ 5 ] = KEY_KP4, 187 [ 5 ] = KEY_KP4,
190 [ 9 ] = KEY_KP5, 188 [ 9 ] = KEY_KP5,
191 [ 21 ] = KEY_KP6, 189 [ 21 ] = KEY_KP6,
192 [ 6 ] = KEY_KP7, 190 [ 6 ] = KEY_KP7,
193 [ 10 ] = KEY_KP8, 191 [ 10 ] = KEY_KP8,
194 [ 18 ] = KEY_KP9, 192 [ 18 ] = KEY_KP9,
195 [ 16 ] = KEY_KPDOT, 193 [ 16 ] = KEY_KPDOT,
196 194
197 [ 3 ] = KEY_TUNER, // tv/fm 195 [ 3 ] = KEY_TUNER, // tv/fm
198 [ 4 ] = KEY_REWIND, // fm tuning left or function left 196 [ 4 ] = KEY_REWIND, // fm tuning left or function left
199 [ 12 ] = KEY_FORWARD, // fm tuning right or function right 197 [ 12 ] = KEY_FORWARD, // fm tuning right or function right
200 198
201 [ 0 ] = KEY_RECORD, 199 [ 0 ] = KEY_RECORD,
202 [ 8 ] = KEY_STOP, 200 [ 8 ] = KEY_STOP,
203 [ 17 ] = KEY_PLAY, 201 [ 17 ] = KEY_PLAY,
204 202
205 [ 25 ] = KEY_ZOOM, 203 [ 25 ] = KEY_ZOOM,
206 [ 14 ] = KEY_MENU, // function 204 [ 14 ] = KEY_MENU, // function
207 [ 19 ] = KEY_AGAIN, // recall 205 [ 19 ] = KEY_AGAIN, // recall
208 [ 29 ] = KEY_RESTART, // reset 206 [ 29 ] = KEY_RESTART, // reset
207 [ 26 ] = KEY_SHUFFLE, // snapshot/shuffle
209 208
210// FIXME 209// FIXME
211 [ 13 ] = KEY_F21, // mts 210 [ 13 ] = KEY_F21, // mts
212 [ 15 ] = KEY_F22, // min 211 [ 15 ] = KEY_F22, // min
213 [ 26 ] = KEY_F23, // freeze
214}; 212};
215 213
216/* Alex Hermann <gaaf@gmx.net> */ 214/* Alex Hermann <gaaf@gmx.net> */
@@ -489,13 +487,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
489 break; 487 break;
490 case SAA7134_BOARD_ECS_TVP3XP: 488 case SAA7134_BOARD_ECS_TVP3XP:
491 case SAA7134_BOARD_ECS_TVP3XP_4CB5: 489 case SAA7134_BOARD_ECS_TVP3XP_4CB5:
492 ir_codes = eztv_codes; 490 ir_codes = eztv_codes;
493 mask_keycode = 0x00017c; 491 mask_keycode = 0x00017c;
494 mask_keyup = 0x000002; 492 mask_keyup = 0x000002;
495 polling = 50; // ms 493 polling = 50; // ms
496 break; 494 break;
495 case SAA7134_BOARD_KWORLD_XPERT:
497 case SAA7134_BOARD_AVACSSMARTTV: 496 case SAA7134_BOARD_AVACSSMARTTV:
498 ir_codes = avacssmart_codes; 497 ir_codes = avacssmart_codes;
499 mask_keycode = 0x00001F; 498 mask_keycode = 0x00001F;
500 mask_keyup = 0x000020; 499 mask_keyup = 0x000020;
501 polling = 50; // ms 500 polling = 50; // ms
@@ -524,6 +523,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
524 polling = 50; // ms 523 polling = 50; // ms
525 break; 524 break;
526 case SAA7134_BOARD_VIDEOMATE_TV_PVR: 525 case SAA7134_BOARD_VIDEOMATE_TV_PVR:
526 case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
527 ir_codes = videomate_tv_pvr_codes; 527 ir_codes = videomate_tv_pvr_codes;
528 mask_keycode = 0x00003F; 528 mask_keycode = 0x00003F;
529 mask_keyup = 0x400000; 529 mask_keyup = 0x400000;
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 81732904623f..b5bede95dbf5 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-oss.c,v 1.14 2005/05/18 22:45:16 hhackmann Exp $ 2 * $Id: saa7134-oss.c,v 1.17 2005/06/28 23:41:47 mkrufky Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * oss dsp interface 5 * oss dsp interface
@@ -556,21 +556,28 @@ mixer_recsrc_7134(struct saa7134_dev *dev)
556static int 556static int
557mixer_recsrc_7133(struct saa7134_dev *dev) 557mixer_recsrc_7133(struct saa7134_dev *dev)
558{ 558{
559 u32 value = 0xbbbbbb; 559 u32 anabar, xbarin;
560 560
561 xbarin = 0x03; // adc
562 anabar = 0;
561 switch (dev->oss.input) { 563 switch (dev->oss.input) {
562 case TV: 564 case TV:
563 value = 0xbbbb10; /* MAIN */ 565 xbarin = 0; // Demodulator
566 anabar = 2; // DACs
564 break; 567 break;
565 case LINE1: 568 case LINE1:
566 value = 0xbbbb32; /* AUX1 */ 569 anabar = 0; // aux1, aux1
567 break; 570 break;
568 case LINE2: 571 case LINE2:
569 case LINE2_LEFT: 572 case LINE2_LEFT:
570 value = 0xbbbb54; /* AUX2 */ 573 anabar = 9; // aux2, aux2
571 break; 574 break;
572 } 575 }
573 saa_dsp_writel(dev, 0x46c >> 2, value); 576 /* output xbar always main channel */
577 saa_dsp_writel(dev, 0x46c >> 2, 0xbbbb10);
578 saa_dsp_writel(dev, 0x464 >> 2, xbarin);
579 saa_writel(0x594 >> 2, anabar);
580
574 return 0; 581 return 0;
575} 582}
576 583
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
index 345eb2a8c28d..4dd9f1b23928 100644
--- a/drivers/media/video/saa7134/saa7134-ts.c
+++ b/drivers/media/video/saa7134/saa7134-ts.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-ts.c,v 1.14 2005/02/03 10:24:33 kraxel Exp $ 2 * $Id: saa7134-ts.c,v 1.15 2005/06/14 22:48:18 hhackmann Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * video4linux video interface 5 * video4linux video interface
@@ -221,10 +221,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status)
221 if (dev->ts_q.curr) { 221 if (dev->ts_q.curr) {
222 field = dev->ts_q.curr->vb.field; 222 field = dev->ts_q.curr->vb.field;
223 if (field == V4L2_FIELD_TOP) { 223 if (field == V4L2_FIELD_TOP) {
224 if ((status & 0x100000) != 0x000000) 224 if ((status & 0x100000) != 0x100000)
225 goto done; 225 goto done;
226 } else { 226 } else {
227 if ((status & 0x100000) != 0x100000) 227 if ((status & 0x100000) != 0x000000)
228 goto done; 228 goto done;
229 } 229 }
230 saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); 230 saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 3617e7f7a410..eeafa5a71d2b 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-tvaudio.c,v 1.25 2005/06/07 19:00:38 nsh Exp $ 2 * $Id: saa7134-tvaudio.c,v 1.30 2005/06/28 23:41:47 mkrufky Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * tv audio decoder (fm stereo, nicam, ...) 5 * tv audio decoder (fm stereo, nicam, ...)
@@ -169,7 +169,7 @@ static void tvaudio_init(struct saa7134_dev *dev)
169 int clock = saa7134_boards[dev->board].audio_clock; 169 int clock = saa7134_boards[dev->board].audio_clock;
170 170
171 if (UNSET != audio_clock_override) 171 if (UNSET != audio_clock_override)
172 clock = audio_clock_override; 172 clock = audio_clock_override;
173 173
174 /* init all audio registers */ 174 /* init all audio registers */
175 saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); 175 saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00);
@@ -219,14 +219,17 @@ static void mute_input_7134(struct saa7134_dev *dev)
219 in = dev->input; 219 in = dev->input;
220 mute = (dev->ctl_mute || 220 mute = (dev->ctl_mute ||
221 (dev->automute && (&card(dev).radio) != in)); 221 (dev->automute && (&card(dev).radio) != in));
222 if (PCI_DEVICE_ID_PHILIPS_SAA7130 == dev->pci->device && 222 if (card(dev).mute.name) {
223 card(dev).mute.name) { 223 /*
224 /* 7130 - we'll mute using some unconnected audio input */ 224 * 7130 - we'll mute using some unconnected audio input
225 * 7134 - we'll probably should switch external mux with gpio
226 */
225 if (mute) 227 if (mute)
226 in = &card(dev).mute; 228 in = &card(dev).mute;
227 } 229 }
230
228 if (dev->hw_mute == mute && 231 if (dev->hw_mute == mute &&
229 dev->hw_input == in) { 232 dev->hw_input == in) {
230 dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", 233 dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
231 mute,in->name); 234 mute,in->name);
232 return; 235 return;
@@ -260,6 +263,7 @@ static void mute_input_7134(struct saa7134_dev *dev)
260 /* switch gpio-connected external audio mux */ 263 /* switch gpio-connected external audio mux */
261 if (0 == card(dev).gpiomask) 264 if (0 == card(dev).gpiomask)
262 return; 265 return;
266
263 mask = card(dev).gpiomask; 267 mask = card(dev).gpiomask;
264 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); 268 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
265 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); 269 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio);
@@ -339,13 +343,8 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
339 set_current_state(TASK_INTERRUPTIBLE); 343 set_current_state(TASK_INTERRUPTIBLE);
340 schedule(); 344 schedule();
341 } else { 345 } else {
342#if 0
343 /* hmm, that one doesn't return on wakeup ... */
344 msleep_interruptible(timeout);
345#else
346 set_current_state(TASK_INTERRUPTIBLE); 346 set_current_state(TASK_INTERRUPTIBLE);
347 schedule_timeout(msecs_to_jiffies(timeout)); 347 schedule_timeout(msecs_to_jiffies(timeout));
348#endif
349 } 348 }
350 } 349 }
351 remove_wait_queue(&dev->thread.wq, &wait); 350 remove_wait_queue(&dev->thread.wq, &wait);
@@ -400,27 +399,10 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan)
400 return value; 399 return value;
401} 400}
402 401
403#if 0
404static void sifdebug_dump_regs(struct saa7134_dev *dev)
405{
406 print_regb(AUDIO_STATUS);
407 print_regb(IDENT_SIF);
408 print_regb(LEVEL_READOUT1);
409 print_regb(LEVEL_READOUT2);
410 print_regb(DCXO_IDENT_CTRL);
411 print_regb(DEMODULATOR);
412 print_regb(AGC_GAIN_SELECT);
413 print_regb(MONITOR_SELECT);
414 print_regb(FM_DEEMPHASIS);
415 print_regb(FM_DEMATRIX);
416 print_regb(SIF_SAMPLE_FREQ);
417 print_regb(ANALOG_IO_SELECT);
418}
419#endif
420 402
421static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio) 403static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio)
422{ 404{
423 __u32 idp,nicam; 405 __u32 idp, nicam, nicam_status;
424 int retval = -1; 406 int retval = -1;
425 407
426 switch (audio->mode) { 408 switch (audio->mode) {
@@ -442,18 +424,24 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
442 break; 424 break;
443 case TVAUDIO_NICAM_FM: 425 case TVAUDIO_NICAM_FM:
444 case TVAUDIO_NICAM_AM: 426 case TVAUDIO_NICAM_AM:
445 nicam = saa_readb(SAA7134_NICAM_STATUS); 427 nicam = saa_readb(SAA7134_AUDIO_STATUS);
446 dprintk("getstereo: nicam=0x%x\n",nicam); 428 dprintk("getstereo: nicam=0x%x\n",nicam);
447 switch (nicam & 0x0b) { 429 if (nicam & 0x1) {
448 case 0x08: 430 nicam_status = saa_readb(SAA7134_NICAM_STATUS);
449 retval = V4L2_TUNER_SUB_MONO; 431 dprintk("getstereo: nicam_status=0x%x\n", nicam_status);
450 break; 432
451 case 0x09: 433 switch (nicam_status & 0x03) {
452 retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; 434 case 0x01:
453 break; 435 retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
454 case 0x0a: 436 break;
455 retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; 437 case 0x02:
456 break; 438 retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
439 break;
440 default:
441 retval = V4L2_TUNER_SUB_MONO;
442 }
443 } else {
444 /* No nicam detected */
457 } 445 }
458 break; 446 break;
459 } 447 }
@@ -489,15 +477,15 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
489 break; 477 break;
490 case TVAUDIO_FM_K_STEREO: 478 case TVAUDIO_FM_K_STEREO:
491 case TVAUDIO_FM_BG_STEREO: 479 case TVAUDIO_FM_BG_STEREO:
480 case TVAUDIO_NICAM_AM:
481 case TVAUDIO_NICAM_FM:
492 dprintk("setstereo [fm] => %s\n", 482 dprintk("setstereo [fm] => %s\n",
493 name[ mode % ARRAY_SIZE(name) ]); 483 name[ mode % ARRAY_SIZE(name) ]);
494 reg = fm[ mode % ARRAY_SIZE(fm) ]; 484 reg = fm[ mode % ARRAY_SIZE(fm) ];
495 saa_writeb(SAA7134_FM_DEMATRIX, reg); 485 saa_writeb(SAA7134_FM_DEMATRIX, reg);
496 break; 486 break;
497 case TVAUDIO_FM_SAT_STEREO: 487 case TVAUDIO_FM_SAT_STEREO:
498 case TVAUDIO_NICAM_AM: 488 /* Not implemented */
499 case TVAUDIO_NICAM_FM:
500 /* FIXME */
501 break; 489 break;
502 } 490 }
503 return 0; 491 return 0;
@@ -596,7 +584,7 @@ static int tvaudio_thread(void *data)
596 /* find the exact tv audio norm */ 584 /* find the exact tv audio norm */
597 for (audio = UNSET, i = 0; i < TVAUDIO; i++) { 585 for (audio = UNSET, i = 0; i < TVAUDIO; i++) {
598 if (dev->tvnorm->id != UNSET && 586 if (dev->tvnorm->id != UNSET &&
599 !(dev->tvnorm->id & tvaudio[i].std)) 587 !(dev->tvnorm->id & tvaudio[i].std))
600 continue; 588 continue;
601 if (tvaudio[i].carr1 != carrier) 589 if (tvaudio[i].carr1 != carrier)
602 continue; 590 continue;
@@ -703,24 +691,6 @@ static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit)
703 return 0; 691 return 0;
704} 692}
705 693
706#if 0
707static int saa_dsp_readl(struct saa7134_dev *dev, int reg, u32 *value)
708{
709 int err;
710
711 d2printk("dsp read reg 0x%x\n", reg<<2);
712 saa_readl(reg);
713 err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_RDB);
714 if (err < 0)
715 return err;
716 *value = saa_readl(reg);
717 d2printk("dsp read => 0x%06x\n", *value & 0xffffff);
718 err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_IDA);
719 if (err < 0)
720 return err;
721 return 0;
722}
723#endif
724 694
725int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) 695int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value)
726{ 696{
@@ -753,31 +723,50 @@ static int getstereo_7133(struct saa7134_dev *dev)
753static int mute_input_7133(struct saa7134_dev *dev) 723static int mute_input_7133(struct saa7134_dev *dev)
754{ 724{
755 u32 reg = 0; 725 u32 reg = 0;
726 u32 xbarin, xbarout;
756 int mask; 727 int mask;
728 struct saa7134_input *in;
757 729
730 /* Hac 0506 route OSS sound simultanously */
731 xbarin = 0x03;
758 switch (dev->input->amux) { 732 switch (dev->input->amux) {
759 case TV: 733 case TV:
760 reg = 0x02; 734 reg = 0x02;
735 xbarin = 0;
761 break; 736 break;
762 case LINE1: 737 case LINE1:
763 reg = 0x00; 738 reg = 0x00;
764 break; 739 break;
765 case LINE2: 740 case LINE2:
766 case LINE2_LEFT: 741 case LINE2_LEFT:
767 reg = 0x01; 742 reg = 0x09;
768 break; 743 break;
769 } 744 }
770 if (dev->ctl_mute) 745 saa_dsp_writel(dev, 0x464 >> 2, xbarin);
746 if (dev->ctl_mute) {
771 reg = 0x07; 747 reg = 0x07;
748 xbarout = 0xbbbbbb;
749 } else
750 xbarout = 0xbbbb10;
751 saa_dsp_writel(dev, 0x46c >> 2, xbarout);
752
772 saa_writel(0x594 >> 2, reg); 753 saa_writel(0x594 >> 2, reg);
773 754
755
774 /* switch gpio-connected external audio mux */ 756 /* switch gpio-connected external audio mux */
775 if (0 != card(dev).gpiomask) { 757 if (0 != card(dev).gpiomask) {
776 mask = card(dev).gpiomask; 758 mask = card(dev).gpiomask;
759
760 if (card(dev).mute.name && dev->ctl_mute)
761 in = &card(dev).mute;
762 else
763 in = dev->input;
764
777 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); 765 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
778 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio); 766 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio);
779 saa7134_track_gpio(dev,dev->input->name); 767 saa7134_track_gpio(dev,in->name);
780 } 768 }
769
781 return 0; 770 return 0;
782} 771}
783 772
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c
index 3c33c591cc85..29e51cad2aaf 100644
--- a/drivers/media/video/saa7134/saa7134-vbi.c
+++ b/drivers/media/video/saa7134/saa7134-vbi.c
@@ -130,13 +130,7 @@ static int buffer_prepare(struct videobuf_queue *q,
130 lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; 130 lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1;
131 if (lines > VBI_LINE_COUNT) 131 if (lines > VBI_LINE_COUNT)
132 lines = VBI_LINE_COUNT; 132 lines = VBI_LINE_COUNT;
133#if 1
134 llength = VBI_LINE_LENGTH; 133 llength = VBI_LINE_LENGTH;
135#else
136 llength = (norm->h_stop - norm->h_start +1) * 2;
137 if (llength > VBI_LINE_LENGTH)
138 llength = VBI_LINE_LENGTH;
139#endif
140 size = lines * llength * 2; 134 size = lines * llength * 2;
141 if (0 != buf->vb.baddr && buf->vb.bsize < size) 135 if (0 != buf->vb.baddr && buf->vb.bsize < size)
142 return -EINVAL; 136 return -EINVAL;
@@ -178,13 +172,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
178 int llength,lines; 172 int llength,lines;
179 173
180 lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; 174 lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1;
181#if 1
182 llength = VBI_LINE_LENGTH; 175 llength = VBI_LINE_LENGTH;
183#else
184 llength = (norm->h_stop - norm->h_start +1) * 2;
185 if (llength > VBI_LINE_LENGTH)
186 llength = VBI_LINE_LENGTH;
187#endif
188 *size = lines * llength * 2; 176 *size = lines * llength * 2;
189 if (0 == *count) 177 if (0 == *count)
190 *count = vbibufs; 178 *count = vbibufs;
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index c0a2ee520531..a4c2f751d097 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-video.c,v 1.30 2005/06/07 19:00:38 nsh Exp $ 2 * $Id: saa7134-video.c,v 1.36 2005/06/28 23:41:47 mkrufky Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * video4linux video interface 5 * video4linux video interface
@@ -274,7 +274,7 @@ static struct saa7134_tvnorm tvnorms[] = {
274 274
275 .h_start = 0, 275 .h_start = 0,
276 .h_stop = 719, 276 .h_stop = 719,
277 .video_v_start = 23, 277 .video_v_start = 23,
278 .video_v_stop = 262, 278 .video_v_stop = 262,
279 .vbi_v_start_0 = 10, 279 .vbi_v_start_0 = 10,
280 .vbi_v_stop_0 = 21, 280 .vbi_v_stop_0 = 21,
@@ -1204,7 +1204,6 @@ static int video_open(struct inode *inode, struct file *file)
1204 struct list_head *list; 1204 struct list_head *list;
1205 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1205 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1206 int radio = 0; 1206 int radio = 0;
1207
1208 list_for_each(list,&saa7134_devlist) { 1207 list_for_each(list,&saa7134_devlist) {
1209 h = list_entry(list, struct saa7134_dev, devlist); 1208 h = list_entry(list, struct saa7134_dev, devlist);
1210 if (h->video_dev && (h->video_dev->minor == minor)) 1209 if (h->video_dev && (h->video_dev->minor == minor))
@@ -1256,12 +1255,12 @@ static int video_open(struct inode *inode, struct file *file)
1256 if (fh->radio) { 1255 if (fh->radio) {
1257 /* switch to radio mode */ 1256 /* switch to radio mode */
1258 saa7134_tvaudio_setinput(dev,&card(dev).radio); 1257 saa7134_tvaudio_setinput(dev,&card(dev).radio);
1259 saa7134_i2c_call_clients(dev,AUDC_SET_RADIO,NULL); 1258 saa7134_i2c_call_clients(dev,AUDC_SET_RADIO, NULL);
1260 } else { 1259 } else {
1261 /* switch to video/vbi mode */ 1260 /* switch to video/vbi mode */
1262 video_mux(dev,dev->ctl_input); 1261 video_mux(dev,dev->ctl_input);
1263 } 1262 }
1264 return 0; 1263 return 0;
1265} 1264}
1266 1265
1267static ssize_t 1266static ssize_t
@@ -1304,10 +1303,10 @@ video_poll(struct file *file, struct poll_table_struct *wait)
1304 } else { 1303 } else {
1305 down(&fh->cap.lock); 1304 down(&fh->cap.lock);
1306 if (UNSET == fh->cap.read_off) { 1305 if (UNSET == fh->cap.read_off) {
1307 /* need to capture a new frame */ 1306 /* need to capture a new frame */
1308 if (res_locked(fh->dev,RESOURCE_VIDEO)) { 1307 if (res_locked(fh->dev,RESOURCE_VIDEO)) {
1309 up(&fh->cap.lock); 1308 up(&fh->cap.lock);
1310 return POLLERR; 1309 return POLLERR;
1311 } 1310 }
1312 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { 1311 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) {
1313 up(&fh->cap.lock); 1312 up(&fh->cap.lock);
@@ -1363,6 +1362,36 @@ static int video_release(struct inode *inode, struct file *file)
1363 res_free(dev,fh,RESOURCE_VBI); 1362 res_free(dev,fh,RESOURCE_VBI);
1364 } 1363 }
1365 1364
1365 /* ts-capture will not work in planar mode, so turn it off Hac: 04.05*/
1366 saa_andorb(SAA7134_OFMT_VIDEO_A, 0x1f, 0);
1367 saa_andorb(SAA7134_OFMT_VIDEO_B, 0x1f, 0);
1368 saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0);
1369 saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
1370
1371 if (dev->tuner_type == TUNER_PHILIPS_TDA8290) {
1372 u8 data[2];
1373 int ret;
1374 struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2};
1375 data[0] = 0x21;
1376 data[1] = 0xc0;
1377 ret = i2c_transfer(&dev->i2c_adap, &msg, 1);
1378 if (ret != 1)
1379 printk(KERN_ERR "TDA8290 access failure\n");
1380 msg.addr = I2C_ADDR_TDA8275;
1381 data[0] = 0x30;
1382 data[1] = 0xd0;
1383 ret = i2c_transfer(&dev->i2c_adap, &msg, 1);
1384 if (ret != 1)
1385 printk(KERN_ERR "TDA8275 access failure\n");
1386 msg.addr = I2C_ADDR_TDA8290;
1387 data[0] = 0x21;
1388 data[1] = 0x80;
1389 i2c_transfer(&dev->i2c_adap, &msg, 1);
1390 data[0] = 0x00;
1391 data[1] = 0x02;
1392 i2c_transfer(&dev->i2c_adap, &msg, 1);
1393 }
1394
1366 /* free stuff */ 1395 /* free stuff */
1367 videobuf_mmap_free(&fh->cap); 1396 videobuf_mmap_free(&fh->cap);
1368 videobuf_mmap_free(&fh->vbi); 1397 videobuf_mmap_free(&fh->vbi);
@@ -1399,13 +1428,6 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
1399 f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; 1428 f->fmt.vbi.count[1] = f->fmt.vbi.count[0];
1400 f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ 1429 f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */
1401 1430
1402#if 0
1403 if (V4L2_STD_PAL == norm->id) {
1404 /* FIXME */
1405 f->fmt.vbi.start[0] += 3;
1406 f->fmt.vbi.start[1] += 3*2;
1407 }
1408#endif
1409} 1431}
1410 1432
1411static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, 1433static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
@@ -2120,8 +2142,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
2120 2142
2121 memset(t,0,sizeof(*t)); 2143 memset(t,0,sizeof(*t));
2122 strcpy(t->name, "Radio"); 2144 strcpy(t->name, "Radio");
2123 t->rangelow = (int)(65*16);
2124 t->rangehigh = (int)(108*16);
2125 2145
2126 saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); 2146 saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t);
2127 2147
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index d6b1c0d4d0f9..6836c07794fc 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134.h,v 1.41 2005/06/07 18:02:26 nsh Exp $ 2 * $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $
3 * 3 *
4 * v4l2 device driver for philips saa7134 based TV cards 4 * v4l2 device driver for philips saa7134 based TV cards
5 * 5 *
@@ -46,8 +46,6 @@
46#endif 46#endif
47#define UNSET (-1U) 47#define UNSET (-1U)
48 48
49/* 2.4 / 2.5 driver compatibility stuff */
50
51/* ----------------------------------------------------------- */ 49/* ----------------------------------------------------------- */
52/* enums */ 50/* enums */
53 51
@@ -159,7 +157,7 @@ struct saa7134_format {
159#define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 157#define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33
160#define SAA7134_BOARD_NOVAC_PRIMETV7133 34 158#define SAA7134_BOARD_NOVAC_PRIMETV7133 34
161#define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35 159#define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35
162#define SAA7133_BOARD_UPMOST_PURPLE_TV 36 160#define SAA7134_BOARD_UPMOST_PURPLE_TV 36
163#define SAA7134_BOARD_ITEMS_MTV005 37 161#define SAA7134_BOARD_ITEMS_MTV005 37
164#define SAA7134_BOARD_CINERGY200 38 162#define SAA7134_BOARD_CINERGY200 38
165#define SAA7134_BOARD_FLYTVPLATINUM_MINI 39 163#define SAA7134_BOARD_FLYTVPLATINUM_MINI 39
@@ -176,13 +174,17 @@ struct saa7134_format {
176#define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 174#define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50
177#define SAA7134_BOARD_PROVIDEO_PV952 51 175#define SAA7134_BOARD_PROVIDEO_PV952 51
178#define SAA7134_BOARD_AVERMEDIA_305 52 176#define SAA7134_BOARD_AVERMEDIA_305 52
179#define SAA7135_BOARD_ASUSTeK_TVFM7135 53 177#define SAA7134_BOARD_ASUSTeK_TVFM7135 53
180#define SAA7134_BOARD_FLYTVPLATINUM_FM 54 178#define SAA7134_BOARD_FLYTVPLATINUM_FM 54
181#define SAA7134_BOARD_FLYDVBTDUO 55 179#define SAA7134_BOARD_FLYDVBTDUO 55
182#define SAA7134_BOARD_AVERMEDIA_307 56 180#define SAA7134_BOARD_AVERMEDIA_307 56
183#define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 181#define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57
184#define SAA7134_BOARD_ADS_INSTANT_TV 58 182#define SAA7134_BOARD_ADS_INSTANT_TV 58
185#define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 183#define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59
184#define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60
185#define SAA7134_BOARD_PHILIPS_TOUGH 61
186#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62
187#define SAA7134_BOARD_KWORLD_XPERT 63
186 188
187#define SAA7134_MAXBOARDS 8 189#define SAA7134_MAXBOARDS 8
188#define SAA7134_INPUT_MAX 8 190#define SAA7134_INPUT_MAX 8
@@ -213,6 +215,10 @@ struct saa7134_board {
213 215
214 /* i2c chip info */ 216 /* i2c chip info */
215 unsigned int tuner_type; 217 unsigned int tuner_type;
218 unsigned int radio_type;
219 unsigned char tuner_addr;
220 unsigned char radio_addr;
221
216 unsigned int tda9887_conf; 222 unsigned int tda9887_conf;
217 223
218 /* peripheral I/O */ 224 /* peripheral I/O */
@@ -403,9 +409,12 @@ struct saa7134_dev {
403 /* config info */ 409 /* config info */
404 unsigned int board; 410 unsigned int board;
405 unsigned int tuner_type; 411 unsigned int tuner_type;
412 unsigned int radio_type;
413 unsigned char tuner_addr;
414 unsigned char radio_addr;
415
406 unsigned int tda9887_conf; 416 unsigned int tda9887_conf;
407 unsigned int gpio_value; 417 unsigned int gpio_value;
408 unsigned int irq2_mask;
409 418
410 /* i2c i/o */ 419 /* i2c i/o */
411 struct i2c_adapter i2c_adap; 420 struct i2c_adapter i2c_adap;
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 07ba6d3ed08c..7cb1fb3e66f9 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -243,19 +243,6 @@ static int tda7432_write(struct i2c_client *client, int subaddr, int val)
243} 243}
244 244
245/* I don't think we ever actually _read_ the chip... */ 245/* I don't think we ever actually _read_ the chip... */
246#if 0
247static int tda7432_read(struct i2c_client *client)
248{
249 unsigned char buffer;
250 d2printk("tda7432: In tda7432_read\n");
251 if (1 != i2c_master_recv(client,&buffer,1)) {
252 printk(KERN_WARNING "tda7432: I/O error, trying (read)\n");
253 return -1;
254 }
255 dprintk("tda7432: Read 0x%02x\n", buffer);
256 return buffer;
257}
258#endif
259 246
260static int tda7432_set(struct i2c_client *client) 247static int tda7432_set(struct i2c_client *client)
261{ 248{
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index f59d4601cc63..a8b6a8df5109 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tda8290.c,v 1.11 2005/06/18 06:09:06 nsh Exp $ 2 * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls the philips tda8290+75 tuner chip combo. 5 * controls the philips tda8290+75 tuner chip combo.
@@ -136,15 +136,12 @@ static int tda8290_tune(struct i2c_client *c)
136 return 0; 136 return 0;
137} 137}
138 138
139static void set_frequency(struct tuner *t, u16 ifc) 139static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq)
140{ 140{
141 u32 freq;
142 u32 N; 141 u32 N;
143 142
144 if (t->mode == V4L2_TUNER_RADIO) 143 if (t->mode == V4L2_TUNER_RADIO)
145 freq = t->freq / 1000; 144 freq = freq / 1000;
146 else
147 freq = t->freq;
148 145
149 N = (((freq<<3)+ifc)&0x3fffc); 146 N = (((freq<<3)+ifc)&0x3fffc);
150 147
@@ -187,14 +184,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
187 struct tuner *t = i2c_get_clientdata(c); 184 struct tuner *t = i2c_get_clientdata(c);
188 185
189 set_audio(t); 186 set_audio(t);
190 set_frequency(t, 864); 187 set_frequency(t, 864, freq);
191 tda8290_tune(c); 188 tda8290_tune(c);
192} 189}
193 190
194static void set_radio_freq(struct i2c_client *c, unsigned int freq) 191static void set_radio_freq(struct i2c_client *c, unsigned int freq)
195{ 192{
196 struct tuner *t = i2c_get_clientdata(c); 193 struct tuner *t = i2c_get_clientdata(c);
197 set_frequency(t, 704); 194 set_frequency(t, 704, freq);
198 tda8290_tune(c); 195 tda8290_tune(c);
199} 196}
200 197
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
index 97b113e070f3..566e1a5ca135 100644
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -123,19 +123,6 @@ static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char v
123 return 0; 123 return 0;
124} 124}
125 125
126#if 0
127static int tda9875_read(struct i2c_client *client)
128{
129 unsigned char buffer;
130 dprintk("In tda9875_read\n");
131 if (1 != i2c_master_recv(client,&buffer,1)) {
132 printk(KERN_WARNING "tda9875: I/O error, trying (read)\n");
133 return -1;
134 }
135 dprintk("Read 0x%02x\n", buffer);
136 return buffer;
137}
138#endif
139 126
140static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg) 127static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg)
141{ 128{
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index ee35562f4d1a..108c3ad7d622 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -569,15 +569,6 @@ static int tda9887_configure(struct tda9887 *t)
569 tda9887_set_config(t,buf); 569 tda9887_set_config(t,buf);
570 tda9887_set_insmod(t,buf); 570 tda9887_set_insmod(t,buf);
571 571
572#if 0
573 /* This as-is breaks some cards, must be fixed in a
574 * card-specific way, probably using TDA9887_SET_CONFIG to
575 * turn on/off port2 */
576 if (t->std & V4L2_STD_SECAM_L) {
577 /* secam fixup (FIXME: move this to tvnorms array?) */
578 buf[1] &= ~cOutputPort2Inactive;
579 }
580#endif
581 572
582 dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", 573 dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
583 buf[1],buf[2],buf[3]); 574 buf[1],buf[2],buf[3]);
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index a29f08f81f63..b53c748caf2a 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview 2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
3 * I2C address is allways 0xC0. 3 * I2C address is allways 0xC0.
4 * 4 *
5 * $Id: tea5767.c,v 1.11 2005/06/21 15:40:33 mchehab Exp $ 5 * $Id: tea5767.c,v 1.18 2005/07/07 03:02:55 mchehab Exp $
6 * 6 *
7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) 7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
8 * This code is placed under the terms of the GNU General Public License 8 * This code is placed under the terms of the GNU General Public License
@@ -11,23 +11,11 @@
11 * from their contributions on DScaler. 11 * from their contributions on DScaler.
12 */ 12 */
13 13
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h>
19#include <linux/timer.h>
20#include <linux/delay.h>
21#include <linux/errno.h>
22#include <linux/slab.h>
23#include <linux/videodev.h>
24#include <linux/i2c.h> 14#include <linux/i2c.h>
25#include <linux/i2c-algo-bit.h> 15#include <linux/videodev.h>
26 16#include <linux/delay.h>
17#include <media/tuner.h>
27#include <media/tuner.h> 18#include <media/tuner.h>
28
29/* Declared at tuner-core.c */
30extern unsigned int tuner_debug;
31 19
32#define PREFIX "TEA5767 " 20#define PREFIX "TEA5767 "
33 21
@@ -38,8 +26,8 @@ extern unsigned int tuner_debug;
38 ******************************/ 26 ******************************/
39 27
40/* First register */ 28/* First register */
41#define TEA5767_MUTE 0x80 /* Mutes output */ 29#define TEA5767_MUTE 0x80 /* Mutes output */
42#define TEA5767_SEARCH 0x40 /* Activates station search */ 30#define TEA5767_SEARCH 0x40 /* Activates station search */
43/* Bits 0-5 for divider MSB */ 31/* Bits 0-5 for divider MSB */
44 32
45/* Second register */ 33/* Second register */
@@ -130,6 +118,14 @@ extern unsigned int tuner_debug;
130/* Reserved for future extensions */ 118/* Reserved for future extensions */
131#define TEA5767_RESERVED_MASK 0xff 119#define TEA5767_RESERVED_MASK 0xff
132 120
121enum tea5767_xtal_freq {
122 TEA5767_LOW_LO_32768 = 0,
123 TEA5767_HIGH_LO_32768 = 1,
124 TEA5767_LOW_LO_13MHz = 2,
125 TEA5767_HIGH_LO_13MHz = 3,
126};
127
128
133/*****************************************************************************/ 129/*****************************************************************************/
134 130
135static void set_tv_freq(struct i2c_client *c, unsigned int freq) 131static void set_tv_freq(struct i2c_client *c, unsigned int freq)
@@ -153,103 +149,112 @@ static void tea5767_status_dump(unsigned char *buffer)
153 else 149 else
154 printk(PREFIX "Tuner not at band limit\n"); 150 printk(PREFIX "Tuner not at band limit\n");
155 151
156 div=((buffer[0]&0x3f)<<8) | buffer[1]; 152 div = ((buffer[0] & 0x3f) << 8) | buffer[1];
157 153
158 switch (TEA5767_HIGH_LO_32768) { 154 switch (TEA5767_HIGH_LO_32768) {
159 case TEA5767_HIGH_LO_13MHz: 155 case TEA5767_HIGH_LO_13MHz:
160 frq = 1000*(div*50-700-225)/4; /* Freq in KHz */ 156 frq = 1000 * (div * 50 - 700 - 225) / 4; /* Freq in KHz */
161 break; 157 break;
162 case TEA5767_LOW_LO_13MHz: 158 case TEA5767_LOW_LO_13MHz:
163 frq = 1000*(div*50+700+225)/4; /* Freq in KHz */ 159 frq = 1000 * (div * 50 + 700 + 225) / 4; /* Freq in KHz */
164 break; 160 break;
165 case TEA5767_LOW_LO_32768: 161 case TEA5767_LOW_LO_32768:
166 frq = 1000*(div*32768/1000+700+225)/4; /* Freq in KHz */ 162 frq = 1000 * (div * 32768 / 1000 + 700 + 225) / 4; /* Freq in KHz */
167 break; 163 break;
168 case TEA5767_HIGH_LO_32768: 164 case TEA5767_HIGH_LO_32768:
169 default: 165 default:
170 frq = 1000*(div*32768/1000-700-225)/4; /* Freq in KHz */ 166 frq = 1000 * (div * 32768 / 1000 - 700 - 225) / 4; /* Freq in KHz */
171 break; 167 break;
172 } 168 }
173 buffer[0] = (div>>8) & 0x3f; 169 buffer[0] = (div >> 8) & 0x3f;
174 buffer[1] = div & 0xff; 170 buffer[1] = div & 0xff;
175 171
176 printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n", 172 printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n",
177 frq/1000,frq%1000,div); 173 frq / 1000, frq % 1000, div);
178 174
179 if (TEA5767_STEREO_MASK & buffer[2]) 175 if (TEA5767_STEREO_MASK & buffer[2])
180 printk(PREFIX "Stereo\n"); 176 printk(PREFIX "Stereo\n");
181 else 177 else
182 printk(PREFIX "Mono\n"); 178 printk(PREFIX "Mono\n");
183 179
184 printk(PREFIX "IF Counter = %d\n",buffer[2] & TEA5767_IF_CNTR_MASK); 180 printk(PREFIX "IF Counter = %d\n", buffer[2] & TEA5767_IF_CNTR_MASK);
185 181
186 printk(PREFIX "ADC Level = %d\n",(buffer[3] & TEA5767_ADC_LEVEL_MASK)>>4); 182 printk(PREFIX "ADC Level = %d\n",
183 (buffer[3] & TEA5767_ADC_LEVEL_MASK) >> 4);
187 184
188 printk(PREFIX "Chip ID = %d\n",(buffer[3] & TEA5767_CHIP_ID_MASK)); 185 printk(PREFIX "Chip ID = %d\n", (buffer[3] & TEA5767_CHIP_ID_MASK));
189 186
190 printk(PREFIX "Reserved = 0x%02x\n",(buffer[4] & TEA5767_RESERVED_MASK)); 187 printk(PREFIX "Reserved = 0x%02x\n",
188 (buffer[4] & TEA5767_RESERVED_MASK));
191} 189}
192 190
193/* Freq should be specifyed at 62.5 Hz */ 191/* Freq should be specifyed at 62.5 Hz */
194static void set_radio_freq(struct i2c_client *c, unsigned int frq) 192static void set_radio_freq(struct i2c_client *c, unsigned int frq)
195{ 193{
196 struct tuner *t = i2c_get_clientdata(c); 194 struct tuner *t = i2c_get_clientdata(c);
197 unsigned char buffer[5]; 195 unsigned char buffer[5];
198 unsigned div; 196 unsigned div;
199 int rc; 197 int rc;
200 198
201 if ( tuner_debug ) 199 tuner_dbg (PREFIX "radio freq counter %d\n", frq);
202 printk(PREFIX "radio freq counter %d\n",frq);
203 200
204 /* Rounds freq to next decimal value - for 62.5 KHz step */ 201 /* Rounds freq to next decimal value - for 62.5 KHz step */
205 /* frq = 20*(frq/16)+radio_frq[frq%16]; */ 202 /* frq = 20*(frq/16)+radio_frq[frq%16]; */
206 203
207 buffer[2] = TEA5767_PORT1_HIGH; 204 buffer[2] = TEA5767_PORT1_HIGH;
208 buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; 205 buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL |
209 buffer[4]=0; 206 TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
207 buffer[4] = 0;
208
209 if (t->mode == T_STANDBY) {
210 tuner_dbg("TEA5767 set to standby mode\n");
211 buffer[3] |= TEA5767_STDBY;
212 }
210 213
211 if (t->audmode == V4L2_TUNER_MODE_MONO) { 214 if (t->audmode == V4L2_TUNER_MODE_MONO) {
212 tuner_dbg("TEA5767 set to mono\n"); 215 tuner_dbg("TEA5767 set to mono\n");
213 buffer[2] |= TEA5767_MONO; 216 buffer[2] |= TEA5767_MONO;
214 } else 217 } else {
215 tuner_dbg("TEA5767 set to stereo\n"); 218 tuner_dbg("TEA5767 set to stereo\n");
219 }
216 220
217 switch (t->type) { 221 /* Should be replaced */
222 switch (TEA5767_HIGH_LO_32768) {
218 case TEA5767_HIGH_LO_13MHz: 223 case TEA5767_HIGH_LO_13MHz:
219 tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); 224 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
220 buffer[2] |= TEA5767_HIGH_LO_INJECT; 225 buffer[2] |= TEA5767_HIGH_LO_INJECT;
221 buffer[4] |= TEA5767_PLLREF_ENABLE; 226 buffer[4] |= TEA5767_PLLREF_ENABLE;
222 div = (frq*4/16+700+225+25)/50; 227 div = (frq * 4 / 16 + 700 + 225 + 25) / 50;
223 break; 228 break;
224 case TEA5767_LOW_LO_13MHz: 229 case TEA5767_LOW_LO_13MHz:
225 tuner_dbg("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); 230 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
226 231
227 buffer[4] |= TEA5767_PLLREF_ENABLE; 232 buffer[4] |= TEA5767_PLLREF_ENABLE;
228 div = (frq*4/16-700-225+25)/50; 233 div = (frq * 4 / 16 - 700 - 225 + 25) / 50;
229 break; 234 break;
230 case TEA5767_LOW_LO_32768: 235 case TEA5767_LOW_LO_32768:
231 tuner_dbg("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); 236 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
232 buffer[3] |= TEA5767_XTAL_32768; 237 buffer[3] |= TEA5767_XTAL_32768;
233 /* const 700=4000*175 Khz - to adjust freq to right value */ 238 /* const 700=4000*175 Khz - to adjust freq to right value */
234 div = (1000*(frq*4/16-700-225)+16384)>>15; 239 div = (1000 * (frq * 4 / 16 - 700 - 225) + 16384) >> 15;
235 break; 240 break;
236 case TEA5767_HIGH_LO_32768: 241 case TEA5767_HIGH_LO_32768:
237 default: 242 default:
238 tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n"); 243 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n");
239 244
240 buffer[2] |= TEA5767_HIGH_LO_INJECT; 245 buffer[2] |= TEA5767_HIGH_LO_INJECT;
241 buffer[3] |= TEA5767_XTAL_32768; 246 buffer[3] |= TEA5767_XTAL_32768;
242 div = (1000*(frq*4/16+700+225)+16384)>>15; 247 div = (1000 * (frq * 4 / 16 + 700 + 225) + 16384) >> 15;
243 break; 248 break;
244 } 249 }
245 buffer[0] = (div>>8) & 0x3f; 250 buffer[0] = (div >> 8) & 0x3f;
246 buffer[1] = div & 0xff; 251 buffer[1] = div & 0xff;
247 252
248 if ( tuner_debug ) 253 if (tuner_debug)
249 tea5767_status_dump(buffer); 254 tea5767_status_dump(buffer);
250 255
251 if (5 != (rc = i2c_master_send(c,buffer,5))) 256 if (5 != (rc = i2c_master_send(c, buffer, 5)))
252 tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc); 257 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
253} 258}
254 259
255static int tea5767_signal(struct i2c_client *c) 260static int tea5767_signal(struct i2c_client *c)
@@ -258,11 +263,11 @@ static int tea5767_signal(struct i2c_client *c)
258 int rc; 263 int rc;
259 struct tuner *t = i2c_get_clientdata(c); 264 struct tuner *t = i2c_get_clientdata(c);
260 265
261 memset(buffer,0,sizeof(buffer)); 266 memset(buffer, 0, sizeof(buffer));
262 if (5 != (rc = i2c_master_recv(c,buffer,5))) 267 if (5 != (rc = i2c_master_recv(c, buffer, 5)))
263 tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc); 268 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
264 269
265 return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4)); 270 return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) << (13 - 4));
266} 271}
267 272
268static int tea5767_stereo(struct i2c_client *c) 273static int tea5767_stereo(struct i2c_client *c)
@@ -271,47 +276,46 @@ static int tea5767_stereo(struct i2c_client *c)
271 int rc; 276 int rc;
272 struct tuner *t = i2c_get_clientdata(c); 277 struct tuner *t = i2c_get_clientdata(c);
273 278
274 memset(buffer,0,sizeof(buffer)); 279 memset(buffer, 0, sizeof(buffer));
275 if (5 != (rc = i2c_master_recv(c,buffer,5))) 280 if (5 != (rc = i2c_master_recv(c, buffer, 5)))
276 tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc); 281 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
277 282
278 rc = buffer[2] & TEA5767_STEREO_MASK; 283 rc = buffer[2] & TEA5767_STEREO_MASK;
279 284
280 if ( tuner_debug ) 285 tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
281 tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
282 286
283 return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0); 287 return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0);
284} 288}
285 289
286int tea_detection(struct i2c_client *c) 290int tea5767_autodetection(struct i2c_client *c)
287{ 291{
288 unsigned char buffer[5]= { 0xff, 0xff, 0xff, 0xff, 0xff }; 292 unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff };
289 int rc; 293 int rc;
290 struct tuner *t = i2c_get_clientdata(c); 294 struct tuner *t = i2c_get_clientdata(c);
291 295
292 if (5 != (rc = i2c_master_recv(c,buffer,5))) { 296 if (5 != (rc = i2c_master_recv(c, buffer, 5))) {
293 tuner_warn ( "it is not a TEA5767. Received %i chars.\n",rc ); 297 tuner_warn("it is not a TEA5767. Received %i chars.\n", rc);
294 return EINVAL; 298 return EINVAL;
295 } 299 }
296 300
297 /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ 301 /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */
298 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && 302 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
299 buffer[0] == buffer[3] && buffer[0] == buffer[4]) { 303 buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
300 tuner_warn ( "All bytes are equal. It is not a TEA5767\n" ); 304 tuner_warn("All bytes are equal. It is not a TEA5767\n");
301 return EINVAL; 305 return EINVAL;
302 } 306 }
303 307
304 /* Status bytes: 308 /* Status bytes:
305 * Byte 4: bit 3:1 : CI (Chip Identification) == 0 309 * Byte 4: bit 3:1 : CI (Chip Identification) == 0
306 * bit 0 : internally set to 0 310 * bit 0 : internally set to 0
307 * Byte 5: bit 7:0 : == 0 311 * Byte 5: bit 7:0 : == 0
308 */ 312 */
309 313
310 if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { 314 if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) {
311 tuner_warn ( "Chip ID is not zero. It is not a TEA5767\n" ); 315 tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
312 return EINVAL; 316 return EINVAL;
313 } 317 }
314 tuner_warn ( "TEA5767 detected.\n" ); 318 tuner_warn("TEA5767 detected.\n");
315 return 0; 319 return 0;
316} 320}
317 321
@@ -319,16 +323,16 @@ int tea5767_tuner_init(struct i2c_client *c)
319{ 323{
320 struct tuner *t = i2c_get_clientdata(c); 324 struct tuner *t = i2c_get_clientdata(c);
321 325
322 if (tea_detection(c)==EINVAL) return EINVAL; 326 if (tea5767_autodetection(c) == EINVAL)
327 return EINVAL;
323 328
324 tuner_info("type set to %d (%s)\n", 329 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
325 t->type, TEA5767_TUNER_NAME); 330 strlcpy(c->name, "tea5767", sizeof(c->name));
326 strlcpy(c->name, TEA5767_TUNER_NAME, sizeof(c->name));
327 331
328 t->tv_freq = set_tv_freq; 332 t->tv_freq = set_tv_freq;
329 t->radio_freq = set_radio_freq; 333 t->radio_freq = set_radio_freq;
330 t->has_signal = tea5767_signal; 334 t->has_signal = tea5767_signal;
331 t->is_stereo = tea5767_stereo; 335 t->is_stereo = tea5767_stereo;
332 336
333 return (0); 337 return (0);
334} 338}
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c
index 51748c6578d1..7d825e510ffd 100644
--- a/drivers/media/video/tuner-3036.c
+++ b/drivers/media/video/tuner-3036.c
@@ -152,7 +152,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
152 152
153 switch (cmd) 153 switch (cmd)
154 { 154 {
155 case TUNER_SET_TVFREQ: 155 case VIDIOCSFREQ:
156 set_tv_freq(client, *iarg); 156 set_tv_freq(client, *iarg);
157 break; 157 break;
158 158
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6f6bf4a633fc..de190630babb 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-core.c,v 1.29 2005/06/21 15:40:33 mchehab Exp $ 2 * $Id: tuner-core.c,v 1.55 2005/07/08 13:20:33 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * core core, i.e. kernel interfaces, registering and so on 5 * core core, i.e. kernel interfaces, registering and so on
@@ -23,42 +23,36 @@
23#include <media/tuner.h> 23#include <media/tuner.h>
24#include <media/audiochip.h> 24#include <media/audiochip.h>
25 25
26/*
27 * comment line bellow to return to old behavor, where only one I2C device is supported
28 */
29
30#define UNSET (-1U) 26#define UNSET (-1U)
31 27
32/* standard i2c insmod options */ 28/* standard i2c insmod options */
33static unsigned short normal_i2c[] = { 29static unsigned short normal_i2c[] = {
34 0x4b, /* tda8290 */ 30 0x4b, /* tda8290 */
35 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 31 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
36 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 32 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
37 I2C_CLIENT_END 33 I2C_CLIENT_END
38}; 34};
35
39I2C_CLIENT_INSMOD; 36I2C_CLIENT_INSMOD;
40 37
41/* insmod options used at init time => read/only */ 38/* insmod options used at init time => read/only */
42static unsigned int addr = 0; 39static unsigned int addr = 0;
43module_param(addr, int, 0444); 40module_param(addr, int, 0444);
44 41
45/* insmod options used at runtime => read/write */ 42/* insmod options used at runtime => read/write */
46unsigned int tuner_debug = 0; 43unsigned int tuner_debug = 0;
47module_param(tuner_debug, int, 0644); 44module_param(tuner_debug, int, 0644);
48 45
49static unsigned int tv_range[2] = { 44, 958 }; 46static unsigned int tv_range[2] = { 44, 958 };
50static unsigned int radio_range[2] = { 65, 108 }; 47static unsigned int radio_range[2] = { 65, 108 };
51 48
52module_param_array(tv_range, int, NULL, 0644); 49module_param_array(tv_range, int, NULL, 0644);
53module_param_array(radio_range, int, NULL, 0644); 50module_param_array(radio_range, int, NULL, 0644);
54 51
55MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners"); 52MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
56MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); 53MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
57MODULE_LICENSE("GPL"); 54MODULE_LICENSE("GPL");
58 55
59static int this_adap;
60static unsigned short first_tuner, tv_tuner, radio_tuner;
61
62static struct i2c_driver driver; 56static struct i2c_driver driver;
63static struct i2c_client client_template; 57static struct i2c_client client_template;
64 58
@@ -70,18 +64,19 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
70 struct tuner *t = i2c_get_clientdata(c); 64 struct tuner *t = i2c_get_clientdata(c);
71 65
72 if (t->type == UNSET) { 66 if (t->type == UNSET) {
73 tuner_info("tuner type not set\n"); 67 tuner_warn ("tuner type not set\n");
74 return; 68 return;
75 } 69 }
76 if (NULL == t->tv_freq) { 70 if (NULL == t->tv_freq) {
77 tuner_info("Huh? tv_set is NULL?\n"); 71 tuner_warn ("Tuner has no way to set tv freq\n");
78 return; 72 return;
79 } 73 }
80 if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { 74 if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) {
81 tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", 75 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n",
82 freq/16,freq%16*100/16,tv_range[0],tv_range[1]); 76 freq / 16, freq % 16 * 100 / 16, tv_range[0],
77 tv_range[1]);
83 } 78 }
84 t->tv_freq(c,freq); 79 t->tv_freq(c, freq);
85} 80}
86 81
87static void set_radio_freq(struct i2c_client *c, unsigned int freq) 82static void set_radio_freq(struct i2c_client *c, unsigned int freq)
@@ -89,24 +84,20 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
89 struct tuner *t = i2c_get_clientdata(c); 84 struct tuner *t = i2c_get_clientdata(c);
90 85
91 if (t->type == UNSET) { 86 if (t->type == UNSET) {
92 tuner_info("tuner type not set\n"); 87 tuner_warn ("tuner type not set\n");
93 return; 88 return;
94 } 89 }
95 if (NULL == t->radio_freq) { 90 if (NULL == t->radio_freq) {
96 tuner_info("no radio tuning for this one, sorry.\n"); 91 tuner_warn ("tuner has no way to set radio frequency\n");
97 return; 92 return;
98 } 93 }
99 if (freq >= radio_range[0]*16000 && freq <= radio_range[1]*16000) { 94 if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) {
100 if (tuner_debug) 95 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n",
101 tuner_info("radio freq step 62.5Hz (%d.%06d)\n", 96 freq / 16000, freq % 16000 * 100 / 16000,
102 freq/16000,freq%16000*1000/16); 97 radio_range[0], radio_range[1]);
103 t->radio_freq(c,freq);
104 } else {
105 tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n",
106 freq/16,freq%16*100/16,
107 radio_range[0],radio_range[1]);
108 } 98 }
109 99
100 t->radio_freq(c, freq);
110 return; 101 return;
111} 102}
112 103
@@ -117,42 +108,45 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
117 switch (t->mode) { 108 switch (t->mode) {
118 case V4L2_TUNER_RADIO: 109 case V4L2_TUNER_RADIO:
119 tuner_dbg("radio freq set to %lu.%02lu\n", 110 tuner_dbg("radio freq set to %lu.%02lu\n",
120 freq/16,freq%16*100/16); 111 freq / 16000, freq % 16000 * 100 / 16000);
121 set_radio_freq(c,freq); 112 set_radio_freq(c, freq);
122 break; 113 break;
123 case V4L2_TUNER_ANALOG_TV: 114 case V4L2_TUNER_ANALOG_TV:
124 case V4L2_TUNER_DIGITAL_TV: 115 case V4L2_TUNER_DIGITAL_TV:
125 tuner_dbg("tv freq set to %lu.%02lu\n", 116 tuner_dbg("tv freq set to %lu.%02lu\n",
126 freq/16,freq%16*100/16); 117 freq / 16, freq % 16 * 100 / 16);
127 set_tv_freq(c, freq); 118 set_tv_freq(c, freq);
128 break; 119 break;
129 } 120 }
130 t->freq = freq; 121 t->freq = freq;
131} 122}
132 123
133static void set_type(struct i2c_client *c, unsigned int type) 124static void set_type(struct i2c_client *c, unsigned int type,
125 unsigned int new_mode_mask)
134{ 126{
135 struct tuner *t = i2c_get_clientdata(c); 127 struct tuner *t = i2c_get_clientdata(c);
136 unsigned char buffer[4]; 128 unsigned char buffer[4];
137 129
138 /* sanity check */ 130 if (type == UNSET || type == TUNER_ABSENT) {
139 if (type == UNSET || type == TUNER_ABSENT) 131 tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr);
140 return; 132 return;
141 if (type >= tuner_count) 133 }
134
135 if (type >= tuner_count) {
136 tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count);
142 return; 137 return;
138 }
143 139
140 /* This code detects calls by card attach_inform */
144 if (NULL == t->i2c.dev.driver) { 141 if (NULL == t->i2c.dev.driver) {
145 /* not registered yet */ 142 tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr);
146 t->type = type; 143
144 t->type=type;
147 return; 145 return;
148 } 146 }
149 if ((t->initialized) && (t->type == type))
150 /* run only once except type change Hac 04/05*/
151 return;
152
153 t->initialized = 1;
154 147
155 t->type = type; 148 t->type = type;
149
156 switch (t->type) { 150 switch (t->type) {
157 case TUNER_MT2032: 151 case TUNER_MT2032:
158 microtune_init(c); 152 microtune_init(c);
@@ -161,136 +155,194 @@ static void set_type(struct i2c_client *c, unsigned int type)
161 tda8290_init(c); 155 tda8290_init(c);
162 break; 156 break;
163 case TUNER_TEA5767: 157 case TUNER_TEA5767:
164 if (tea5767_tuner_init(c)==EINVAL) t->type=TUNER_ABSENT; 158 if (tea5767_tuner_init(c) == EINVAL) {
159 t->type = TUNER_ABSENT;
160 t->mode_mask = T_UNINITIALIZED;
161 return;
162 }
163 t->mode_mask = T_RADIO;
165 break; 164 break;
166 case TUNER_PHILIPS_FMD1216ME_MK3: 165 case TUNER_PHILIPS_FMD1216ME_MK3:
167 buffer[0] = 0x0b; 166 buffer[0] = 0x0b;
168 buffer[1] = 0xdc; 167 buffer[1] = 0xdc;
169 buffer[2] = 0x9c; 168 buffer[2] = 0x9c;
170 buffer[3] = 0x60; 169 buffer[3] = 0x60;
171 i2c_master_send(c,buffer,4); 170 i2c_master_send(c, buffer, 4);
172 mdelay(1); 171 mdelay(1);
173 buffer[2] = 0x86; 172 buffer[2] = 0x86;
174 buffer[3] = 0x54; 173 buffer[3] = 0x54;
175 i2c_master_send(c,buffer,4); 174 i2c_master_send(c, buffer, 4);
176 default_tuner_init(c); 175 default_tuner_init(c);
177 break; 176 break;
178 default: 177 default:
179 /* TEA5767 autodetection code */
180 if (tea5767_tuner_init(c)!=EINVAL) {
181 t->type = TUNER_TEA5767;
182 if (first_tuner == 0x60)
183 first_tuner++;
184 break;
185 }
186
187 default_tuner_init(c); 178 default_tuner_init(c);
188 break; 179 break;
189 } 180 }
190 tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); 181
182 if (t->mode_mask == T_UNINITIALIZED)
183 t->mode_mask = new_mode_mask;
184
185 set_freq(c, t->freq);
186 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
187 c->adapter->name, c->driver->name, c->addr << 1, type,
188 t->mode_mask);
191} 189}
192 190
193#define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ 191/*
194 return 0; } else if (tuner_debug) \ 192 * This function apply tuner config to tuner specified
195 tuner_info ("Cmd %s accepted to "tun"\n",cmd); 193 * by tun_setup structure. I addr is unset, then admin status
196#define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ 194 * and tun addr status is more precise then current status,
197 CHECK_ADDR(radio_tuner,cmd,"radio") } else \ 195 * it's applied. Otherwise status and type are applied only to
198 { CHECK_ADDR(tv_tuner,cmd,"TV"); } 196 * tuner with exactly the same addr.
197*/
198
199static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
200{
201 struct tuner *t = i2c_get_clientdata(c);
202
203 if (tun_setup->addr == ADDR_UNSET) {
204 if (t->mode_mask & tun_setup->mode_mask)
205 set_type(c, tun_setup->type, tun_setup->mode_mask);
206 } else if (tun_setup->addr == c->addr) {
207 set_type(c, tun_setup->type, tun_setup->mode_mask);
208 }
209}
199 210
200static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) 211static inline int check_mode(struct tuner *t, char *cmd)
201{ 212{
202 /* ADDR_UNSET defaults to first available tuner */ 213 if (1 << t->mode & t->mode_mask) {
203 if ( tun_addr->addr == ADDR_UNSET ) { 214 switch (t->mode) {
204 if (first_tuner != c->addr)
205 return;
206 switch (tun_addr->v4l2_tuner) {
207 case V4L2_TUNER_RADIO: 215 case V4L2_TUNER_RADIO:
208 radio_tuner=c->addr; 216 tuner_dbg("Cmd %s accepted for radio\n", cmd);
209 break; 217 break;
210 default: 218 case V4L2_TUNER_ANALOG_TV:
211 tv_tuner=c->addr; 219 tuner_dbg("Cmd %s accepted for analog TV\n", cmd);
220 break;
221 case V4L2_TUNER_DIGITAL_TV:
222 tuner_dbg("Cmd %s accepted for digital TV\n", cmd);
212 break; 223 break;
213 } 224 }
214 } else { 225 return 0;
215 /* Sets tuner to its configured value */
216 switch (tun_addr->v4l2_tuner) {
217 case V4L2_TUNER_RADIO:
218 radio_tuner=tun_addr->addr;
219 if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type);
220 return;
221 default:
222 tv_tuner=tun_addr->addr;
223 if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type);
224 return;
225 }
226 } 226 }
227 set_type(c,tun_addr->type); 227 return EINVAL;
228} 228}
229 229
230static char pal[] = "-"; 230static char pal[] = "-";
231module_param_string(pal, pal, sizeof(pal), 0644); 231module_param_string(pal, pal, sizeof(pal), 0644);
232static char secam[] = "-";
233module_param_string(secam, secam, sizeof(secam), 0644);
232 234
235/* get more precise norm info from insmod option */
233static int tuner_fixup_std(struct tuner *t) 236static int tuner_fixup_std(struct tuner *t)
234{ 237{
235 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { 238 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
236 /* get more precise norm info from insmod option */
237 switch (pal[0]) { 239 switch (pal[0]) {
238 case 'b': 240 case 'b':
239 case 'B': 241 case 'B':
240 case 'g': 242 case 'g':
241 case 'G': 243 case 'G':
242 tuner_dbg("insmod fixup: PAL => PAL-BG\n"); 244 tuner_dbg ("insmod fixup: PAL => PAL-BG\n");
243 t->std = V4L2_STD_PAL_BG; 245 t->std = V4L2_STD_PAL_BG;
244 break; 246 break;
245 case 'i': 247 case 'i':
246 case 'I': 248 case 'I':
247 tuner_dbg("insmod fixup: PAL => PAL-I\n"); 249 tuner_dbg ("insmod fixup: PAL => PAL-I\n");
248 t->std = V4L2_STD_PAL_I; 250 t->std = V4L2_STD_PAL_I;
249 break; 251 break;
250 case 'd': 252 case 'd':
251 case 'D': 253 case 'D':
252 case 'k': 254 case 'k':
253 case 'K': 255 case 'K':
254 tuner_dbg("insmod fixup: PAL => PAL-DK\n"); 256 tuner_dbg ("insmod fixup: PAL => PAL-DK\n");
255 t->std = V4L2_STD_PAL_DK; 257 t->std = V4L2_STD_PAL_DK;
256 break; 258 break;
259 case 'M':
260 case 'm':
261 tuner_dbg ("insmod fixup: PAL => PAL-M\n");
262 t->std = V4L2_STD_PAL_M;
263 break;
264 case 'N':
265 case 'n':
266 tuner_dbg ("insmod fixup: PAL => PAL-N\n");
267 t->std = V4L2_STD_PAL_N;
268 break;
257 } 269 }
258 } 270 }
271 if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
272 switch (secam[0]) {
273 case 'd':
274 case 'D':
275 case 'k':
276 case 'K':
277 tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n");
278 t->std = V4L2_STD_SECAM_DK;
279 break;
280 case 'l':
281 case 'L':
282 tuner_dbg ("insmod fixup: SECAM => SECAM-L\n");
283 t->std = V4L2_STD_SECAM_L;
284 break;
285 }
286 }
287
259 return 0; 288 return 0;
260} 289}
261 290
262/* ---------------------------------------------------------------------- */ 291/* ---------------------------------------------------------------------- */
263 292
293/* static var Used only in tuner_attach and tuner_probe */
294static unsigned default_mode_mask;
295
296/* During client attach, set_type is called by adapter's attach_inform callback.
297 set_type must then be completed by tuner_attach.
298 */
264static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) 299static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
265{ 300{
266 struct tuner *t; 301 struct tuner *t;
267 302
268 /* by default, first I2C card is both tv and radio tuner */ 303 client_template.adapter = adap;
269 if (this_adap == 0) { 304 client_template.addr = addr;
270 first_tuner = addr;
271 tv_tuner = addr;
272 radio_tuner = addr;
273 }
274 this_adap++;
275
276 client_template.adapter = adap;
277 client_template.addr = addr;
278 305
279 t = kmalloc(sizeof(struct tuner),GFP_KERNEL); 306 t = kmalloc(sizeof(struct tuner), GFP_KERNEL);
280 if (NULL == t) 307 if (NULL == t)
281 return -ENOMEM; 308 return -ENOMEM;
282 memset(t,0,sizeof(struct tuner)); 309 memset(t, 0, sizeof(struct tuner));
283 memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); 310 memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
284 i2c_set_clientdata(&t->i2c, t); 311 i2c_set_clientdata(&t->i2c, t);
285 t->type = UNSET; 312 t->type = UNSET;
286 t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ 313 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
287 t->audmode = V4L2_TUNER_MODE_STEREO; 314 t->audmode = V4L2_TUNER_MODE_STEREO;
315 t->mode_mask = T_UNINITIALIZED;
316
317
318 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
319
320 /* TEA5767 autodetection code - only for addr = 0xc0 */
321 if (addr == 0x60) {
322 if (tea5767_autodetection(&t->i2c) != EINVAL) {
323 t->type = TUNER_TEA5767;
324 t->mode_mask = T_RADIO;
325 t->mode = T_STANDBY;
326 t->freq = 87.5 * 16; /* Sets freq to FM range */
327 default_mode_mask &= ~T_RADIO;
328
329 i2c_attach_client (&t->i2c);
330 set_type(&t->i2c,t->type, t->mode_mask);
331 return 0;
332 }
333 }
288 334
289 i2c_attach_client(&t->i2c); 335 /* Initializes only the first adapter found */
290 tuner_info("chip found @ 0x%x (%s)\n", 336 if (default_mode_mask != T_UNINITIALIZED) {
291 addr << 1, adap->name); 337 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask);
338 t->mode_mask = default_mode_mask;
339 t->freq = 400 * 16; /* Sets freq to VHF High */
340 default_mode_mask = T_UNINITIALIZED;
341 }
292 342
293 set_type(&t->i2c, t->type); 343 /* Should be just before return */
344 i2c_attach_client (&t->i2c);
345 set_type (&t->i2c,t->type, t->mode_mask);
294 return 0; 346 return 0;
295} 347}
296 348
@@ -300,11 +352,8 @@ static int tuner_probe(struct i2c_adapter *adap)
300 normal_i2c[0] = addr; 352 normal_i2c[0] = addr;
301 normal_i2c[1] = I2C_CLIENT_END; 353 normal_i2c[1] = I2C_CLIENT_END;
302 } 354 }
303 this_adap = 0;
304 355
305 first_tuner = 0; 356 default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
306 tv_tuner = 0;
307 radio_tuner = 0;
308 357
309 if (adap->class & I2C_CLASS_TV_ANALOG) 358 if (adap->class & I2C_CLASS_TV_ANALOG)
310 return i2c_probe(adap, &addr_data, tuner_attach); 359 return i2c_probe(adap, &addr_data, tuner_attach);
@@ -316,9 +365,10 @@ static int tuner_detach(struct i2c_client *client)
316 struct tuner *t = i2c_get_clientdata(client); 365 struct tuner *t = i2c_get_clientdata(client);
317 int err; 366 int err;
318 367
319 err=i2c_detach_client(&t->i2c); 368 err = i2c_detach_client(&t->i2c);
320 if (err) { 369 if (err) {
321 tuner_warn ("Client deregistration failed, client not detached.\n"); 370 tuner_warn
371 ("Client deregistration failed, client not detached.\n");
322 return err; 372 return err;
323 } 373 }
324 374
@@ -326,37 +376,65 @@ static int tuner_detach(struct i2c_client *client)
326 return 0; 376 return 0;
327} 377}
328 378
329#define SWITCH_V4L2 if (!t->using_v4l2 && tuner_debug) \ 379/*
330 tuner_info("switching to v4l2\n"); \ 380 * Switch tuner to other mode. If tuner support both tv and radio,
331 t->using_v4l2 = 1; 381 * set another frequency to some value (This is needed for some pal
332#define CHECK_V4L2 if (t->using_v4l2) { if (tuner_debug) \ 382 * tuners to avoid locking). Otherwise, just put second tuner in
333 tuner_info("ignore v4l1 call\n"); \ 383 * standby mode.
334 return 0; } 384 */
385
386static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
387{
388 if (mode != t->mode) {
389
390 t->mode = mode;
391 if (check_mode(t, cmd) == EINVAL) {
392 t->mode = T_STANDBY;
393 if (V4L2_TUNER_RADIO == mode) {
394 set_tv_freq(client, 400 * 16);
395 } else {
396 set_radio_freq(client, 87.5 * 16000);
397 }
398 return EINVAL;
399 }
400 }
401 return 0;
402}
403
404#define switch_v4l2() if (!t->using_v4l2) \
405 tuner_dbg("switching to v4l2\n"); \
406 t->using_v4l2 = 1;
407
408static inline int check_v4l2(struct tuner *t)
409{
410 if (t->using_v4l2) {
411 tuner_dbg ("ignore v4l1 call\n");
412 return EINVAL;
413 }
414 return 0;
415}
335 416
336static int 417static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
337tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
338{ 418{
339 struct tuner *t = i2c_get_clientdata(client); 419 struct tuner *t = i2c_get_clientdata(client);
340 unsigned int *iarg = (int*)arg; 420 unsigned int *iarg = (int *)arg;
341 421
342 switch (cmd) { 422 switch (cmd) {
343 /* --- configuration --- */ 423 /* --- configuration --- */
344 case TUNER_SET_TYPE:
345 set_type(client,*iarg);
346 break;
347 case TUNER_SET_TYPE_ADDR: 424 case TUNER_SET_TYPE_ADDR:
348 set_addr(client,(struct tuner_addr *)arg); 425 tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n",
426 ((struct tuner_setup *)arg)->type,
427 ((struct tuner_setup *)arg)->addr,
428 ((struct tuner_setup *)arg)->mode_mask);
429
430 set_addr(client, (struct tuner_setup *)arg);
349 break; 431 break;
350 case AUDC_SET_RADIO: 432 case AUDC_SET_RADIO:
351 t->mode = V4L2_TUNER_RADIO; 433 set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO");
352 CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV");
353
354 if (V4L2_TUNER_RADIO != t->mode) {
355 set_tv_freq(client,400 * 16);
356 }
357 break; 434 break;
358 case AUDC_CONFIG_PINNACLE: 435 case AUDC_CONFIG_PINNACLE:
359 CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV"); 436 if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL)
437 return 0;
360 switch (*iarg) { 438 switch (*iarg) {
361 case 2: 439 case 2:
362 tuner_dbg("pinnacle pal\n"); 440 tuner_dbg("pinnacle pal\n");
@@ -368,219 +446,238 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
368 break; 446 break;
369 } 447 }
370 break; 448 break;
449 case TDA9887_SET_CONFIG:
450 break;
371 /* --- v4l ioctls --- */ 451 /* --- v4l ioctls --- */
372 /* take care: bttv does userspace copying, we'll get a 452 /* take care: bttv does userspace copying, we'll get a
373 kernel pointer here... */ 453 kernel pointer here... */
374 case VIDIOCSCHAN: 454 case VIDIOCSCHAN:
375 { 455 {
376 static const v4l2_std_id map[] = { 456 static const v4l2_std_id map[] = {
377 [ VIDEO_MODE_PAL ] = V4L2_STD_PAL, 457 [VIDEO_MODE_PAL] = V4L2_STD_PAL,
378 [ VIDEO_MODE_NTSC ] = V4L2_STD_NTSC_M, 458 [VIDEO_MODE_NTSC] = V4L2_STD_NTSC_M,
379 [ VIDEO_MODE_SECAM ] = V4L2_STD_SECAM, 459 [VIDEO_MODE_SECAM] = V4L2_STD_SECAM,
380 [ 4 /* bttv */ ] = V4L2_STD_PAL_M, 460 [4 /* bttv */ ] = V4L2_STD_PAL_M,
381 [ 5 /* bttv */ ] = V4L2_STD_PAL_N, 461 [5 /* bttv */ ] = V4L2_STD_PAL_N,
382 [ 6 /* bttv */ ] = V4L2_STD_NTSC_M_JP, 462 [6 /* bttv */ ] = V4L2_STD_NTSC_M_JP,
383 }; 463 };
384 struct video_channel *vc = arg; 464 struct video_channel *vc = arg;
385 465
386 CHECK_V4L2; 466 if (check_v4l2(t) == EINVAL)
387 t->mode = V4L2_TUNER_ANALOG_TV; 467 return 0;
388 CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV"); 468
389 469 if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL)
390 if (vc->norm < ARRAY_SIZE(map)) 470 return 0;
391 t->std = map[vc->norm]; 471
392 tuner_fixup_std(t); 472 if (vc->norm < ARRAY_SIZE(map))
393 if (t->freq) 473 t->std = map[vc->norm];
394 set_tv_freq(client,t->freq); 474 tuner_fixup_std(t);
395 return 0; 475 if (t->freq)
396 } 476 set_tv_freq(client, t->freq);
477 return 0;
478 }
397 case VIDIOCSFREQ: 479 case VIDIOCSFREQ:
398 { 480 {
399 unsigned long *v = arg; 481 unsigned long *v = arg;
400 482
401 CHECK_MODE("VIDIOCSFREQ"); 483 if (check_mode(t, "VIDIOCSFREQ") == EINVAL)
402 CHECK_V4L2; 484 return 0;
403 set_freq(client,*v); 485 if (check_v4l2(t) == EINVAL)
404 return 0; 486 return 0;
405 } 487
488 set_freq(client, *v);
489 return 0;
490 }
406 case VIDIOCGTUNER: 491 case VIDIOCGTUNER:
407 { 492 {
408 struct video_tuner *vt = arg; 493 struct video_tuner *vt = arg;
409 494
410 CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio"); 495 if (check_mode(t, "VIDIOCGTUNER") == EINVAL)
411 CHECK_V4L2; 496 return 0;
412 if (V4L2_TUNER_RADIO == t->mode) { 497 if (check_v4l2(t) == EINVAL)
413 if (t->has_signal) 498 return 0;
414 vt->signal = t->has_signal(client); 499
415 if (t->is_stereo) { 500 if (V4L2_TUNER_RADIO == t->mode) {
416 if (t->is_stereo(client)) 501 if (t->has_signal)
417 vt->flags |= VIDEO_TUNER_STEREO_ON; 502 vt->signal = t->has_signal(client);
418 else 503 if (t->is_stereo) {
419 vt->flags &= ~VIDEO_TUNER_STEREO_ON; 504 if (t->is_stereo(client))
420 } 505 vt->flags |=
421 vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ 506 VIDEO_TUNER_STEREO_ON;
507 else
508 vt->flags &=
509 ~VIDEO_TUNER_STEREO_ON;
510 }
511 vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */
422 512
423 vt->rangelow = radio_range[0] * 16000; 513 vt->rangelow = radio_range[0] * 16000;
424 vt->rangehigh = radio_range[1] * 16000; 514 vt->rangehigh = radio_range[1] * 16000;
425 515
426 } else { 516 } else {
427 vt->rangelow = tv_range[0] * 16; 517 vt->rangelow = tv_range[0] * 16;
428 vt->rangehigh = tv_range[1] * 16; 518 vt->rangehigh = tv_range[1] * 16;
429 } 519 }
430 520
431 return 0; 521 return 0;
432 } 522 }
433 case VIDIOCGAUDIO: 523 case VIDIOCGAUDIO:
434 { 524 {
435 struct video_audio *va = arg; 525 struct video_audio *va = arg;
436 526
437 CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio"); 527 if (check_mode(t, "VIDIOCGAUDIO") == EINVAL)
438 CHECK_V4L2; 528 return 0;
439 if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) 529 if (check_v4l2(t) == EINVAL)
440 va->mode = t->is_stereo(client) 530 return 0;
441 ? VIDEO_SOUND_STEREO 531
442 : VIDEO_SOUND_MONO; 532 if (V4L2_TUNER_RADIO == t->mode && t->is_stereo)
443 return 0; 533 va->mode = t->is_stereo(client)
444 } 534 ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
535 return 0;
536 }
445 537
446 case VIDIOC_S_STD: 538 case VIDIOC_S_STD:
447 { 539 {
448 v4l2_std_id *id = arg; 540 v4l2_std_id *id = arg;
449 541
450 SWITCH_V4L2; 542 if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD")
451 t->mode = V4L2_TUNER_ANALOG_TV; 543 == EINVAL)
452 CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV"); 544 return 0;
453 545
454 t->std = *id; 546 switch_v4l2();
455 tuner_fixup_std(t); 547
456 if (t->freq) 548 t->std = *id;
457 set_freq(client,t->freq); 549 tuner_fixup_std(t);
458 break; 550 if (t->freq)
459 } 551 set_freq(client, t->freq);
552 break;
553 }
460 case VIDIOC_S_FREQUENCY: 554 case VIDIOC_S_FREQUENCY:
461 { 555 {
462 struct v4l2_frequency *f = arg; 556 struct v4l2_frequency *f = arg;
463 557
464 CHECK_MODE("VIDIOC_S_FREQUENCY"); 558 t->freq = f->frequency;
465 SWITCH_V4L2; 559 switch_v4l2();
466 if (V4L2_TUNER_RADIO == f->type && 560 if (V4L2_TUNER_RADIO == f->type &&
467 V4L2_TUNER_RADIO != t->mode) 561 V4L2_TUNER_RADIO != t->mode) {
468 set_tv_freq(client,400*16); 562 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
469 t->mode = f->type; 563 == EINVAL)
470 set_freq(client,f->frequency); 564 return 0;
471 break; 565 }
472 } 566 set_freq(client,t->freq);
473 case VIDIOC_G_FREQUENCY:
474 {
475 struct v4l2_frequency *f = arg;
476 567
477 CHECK_MODE("VIDIOC_G_FREQUENCY"); 568 break;
478 SWITCH_V4L2; 569 }
479 f->type = t->mode; 570 case VIDIOC_G_FREQUENCY:
480 f->frequency = t->freq; 571 {
481 break; 572 struct v4l2_frequency *f = arg;
482 } 573
574 if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL)
575 return 0;
576 switch_v4l2();
577 f->type = t->mode;
578 f->frequency = t->freq;
579 break;
580 }
483 case VIDIOC_G_TUNER: 581 case VIDIOC_G_TUNER:
484 { 582 {
485 struct v4l2_tuner *tuner = arg; 583 struct v4l2_tuner *tuner = arg;
486 584
487 CHECK_MODE("VIDIOC_G_TUNER"); 585 if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL)
488 SWITCH_V4L2; 586 return 0;
489 if (V4L2_TUNER_RADIO == t->mode) { 587 switch_v4l2();
490 if (t->has_signal) 588
491 tuner -> signal = t->has_signal(client); 589 if (V4L2_TUNER_RADIO == t->mode) {
492 if (t->is_stereo) { 590
493 if (t->is_stereo(client)) { 591 if (t->has_signal)
494 tuner -> rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; 592 tuner->signal = t->has_signal(client);
495 } else { 593
496 tuner -> rxsubchans = V4L2_TUNER_SUB_MONO; 594 if (t->is_stereo) {
595 if (t->is_stereo(client)) {
596 tuner->rxsubchans =
597 V4L2_TUNER_SUB_STEREO |
598 V4L2_TUNER_SUB_MONO;
599 } else {
600 tuner->rxsubchans =
601 V4L2_TUNER_SUB_MONO;
602 }
497 } 603 }
604
605 tuner->capability |=
606 V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
607
608 tuner->audmode = t->audmode;
609
610 tuner->rangelow = radio_range[0] * 16000;
611 tuner->rangehigh = radio_range[1] * 16000;
612 } else {
613 tuner->rangelow = tv_range[0] * 16;
614 tuner->rangehigh = tv_range[1] * 16;
498 } 615 }
499 tuner->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; 616 break;
500 tuner->audmode = t->audmode; 617 }
501 618 case VIDIOC_S_TUNER:
502 tuner->rangelow = radio_range[0] * 16000; 619 {
503 tuner->rangehigh = radio_range[1] * 16000; 620 struct v4l2_tuner *tuner = arg;
504 } else { 621
505 tuner->rangelow = tv_range[0] * 16; 622 if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL)
506 tuner->rangehigh = tv_range[1] * 16; 623 return 0;
624
625 switch_v4l2();
626
627 if (V4L2_TUNER_RADIO == t->mode) {
628 t->audmode = tuner->audmode;
629 set_radio_freq(client, t->freq);
630 }
631 break;
507 } 632 }
508 break;
509 }
510 case VIDIOC_S_TUNER: /* Allow changing radio range and audio mode */
511 {
512 struct v4l2_tuner *tuner = arg;
513
514 CHECK_ADDR(radio_tuner,"VIDIOC_S_TUNER","radio");
515 SWITCH_V4L2;
516
517 /* To switch the audio mode, applications initialize the
518 index and audmode fields and the reserved array and
519 call the VIDIOC_S_TUNER ioctl. */
520 /* rxsubchannels: V4L2_TUNER_MODE_MONO, V4L2_TUNER_MODE_STEREO,
521 V4L2_TUNER_MODE_LANG1, V4L2_TUNER_MODE_LANG2,
522 V4L2_TUNER_MODE_SAP */
523
524 if (tuner->audmode == V4L2_TUNER_MODE_MONO)
525 t->audmode = V4L2_TUNER_MODE_MONO;
526 else
527 t->audmode = V4L2_TUNER_MODE_STEREO;
528
529 set_radio_freq(client, t->freq);
530 break;
531 }
532 case TDA9887_SET_CONFIG: /* Nothing to do on tuner-core */
533 break;
534 default: 633 default:
535 tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); 634 tuner_dbg("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd);
536 /* nothing */
537 break; 635 break;
538 } 636 }
539 637
540 return 0; 638 return 0;
541} 639}
542 640
543static int tuner_suspend(struct device * dev, u32 state, u32 level) 641static int tuner_suspend(struct device *dev, u32 state, u32 level)
544{ 642{
545 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 643 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
546 struct tuner *t = i2c_get_clientdata(c); 644 struct tuner *t = i2c_get_clientdata (c);
547 645
548 tuner_dbg("suspend\n"); 646 tuner_dbg ("suspend\n");
549 /* FIXME: power down ??? */ 647 /* FIXME: power down ??? */
550 return 0; 648 return 0;
551} 649}
552 650
553static int tuner_resume(struct device * dev, u32 level) 651static int tuner_resume(struct device *dev, u32 level)
554{ 652{
555 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 653 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
556 struct tuner *t = i2c_get_clientdata(c); 654 struct tuner *t = i2c_get_clientdata (c);
557 655
558 tuner_dbg("resume\n"); 656 tuner_dbg ("resume\n");
559 if (t->freq) 657 if (t->freq)
560 set_freq(c,t->freq); 658 set_freq(c, t->freq);
561 return 0; 659 return 0;
562} 660}
563 661
564/* ----------------------------------------------------------------------- */ 662/* ----------------------------------------------------------------------- */
565 663
566static struct i2c_driver driver = { 664static struct i2c_driver driver = {
567 .owner = THIS_MODULE, 665 .owner = THIS_MODULE,
568 .name = "tuner", 666 .name = "tuner",
569 .id = I2C_DRIVERID_TUNER, 667 .id = I2C_DRIVERID_TUNER,
570 .flags = I2C_DF_NOTIFY, 668 .flags = I2C_DF_NOTIFY,
571 .attach_adapter = tuner_probe, 669 .attach_adapter = tuner_probe,
572 .detach_client = tuner_detach, 670 .detach_client = tuner_detach,
573 .command = tuner_command, 671 .command = tuner_command,
574 .driver = { 672 .driver = {
575 .suspend = tuner_suspend, 673 .suspend = tuner_suspend,
576 .resume = tuner_resume, 674 .resume = tuner_resume,
577 }, 675 },
578}; 676};
579static struct i2c_client client_template = 677static struct i2c_client client_template = {
580{
581 I2C_DEVNAME("(tuner unset)"), 678 I2C_DEVNAME("(tuner unset)"),
582 .flags = I2C_CLIENT_ALLOW_USE, 679 .flags = I2C_CLIENT_ALLOW_USE,
583 .driver = &driver, 680 .driver = &driver,
584}; 681};
585 682
586static int __init tuner_init_module(void) 683static int __init tuner_init_module(void)
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index c39ed6226ee0..a3f8e83f5314 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-simple.c,v 1.31 2005/06/21 16:02:25 mkrufky Exp $ 2 * $Id: tuner-simple.c,v 1.39 2005/07/07 01:49:30 mkrufky Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls all those simple 4-control-bytes style tuners. 5 * controls all those simple 4-control-bytes style tuners.
@@ -54,6 +54,27 @@
54#define PHILIPS_MF_SET_PAL_L 0x03 // France 54#define PHILIPS_MF_SET_PAL_L 0x03 // France
55#define PHILIPS_MF_SET_PAL_L2 0x02 // L' 55#define PHILIPS_MF_SET_PAL_L2 0x02 // L'
56 56
57/* Control byte */
58
59#define TUNER_RATIO_MASK 0x06 /* Bit cb1:cb2 */
60#define TUNER_RATIO_SELECT_50 0x00
61#define TUNER_RATIO_SELECT_32 0x02
62#define TUNER_RATIO_SELECT_166 0x04
63#define TUNER_RATIO_SELECT_62 0x06
64
65#define TUNER_CHARGE_PUMP 0x40 /* Bit cb6 */
66
67/* Status byte */
68
69#define TUNER_POR 0x80
70#define TUNER_FL 0x40
71#define TUNER_MODE 0x38
72#define TUNER_AFC 0x07
73#define TUNER_SIGNAL 0x07
74#define TUNER_STEREO 0x10
75
76#define TUNER_PLL_LOCKED 0x40
77#define TUNER_STEREO_MK3 0x04
57 78
58/* ---------------------------------------------------------------------- */ 79/* ---------------------------------------------------------------------- */
59 80
@@ -211,21 +232,17 @@ static struct tunertype tuners[] = {
211 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, 232 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 },
212 { "Philips FQ1236A MK4", Philips, NTSC, 233 { "Philips FQ1236A MK4", Philips, NTSC,
213 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, 234 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
214 235 { "Ymec TVision TVF-8531MF/8831MF/8731MF", Philips, NTSC,
215 /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */
216 { "Ymec TVision TVF-8531MF", Philips, NTSC,
217 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, 236 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732},
218 { "Ymec TVision TVF-5533MF", Philips, NTSC, 237 { "Ymec TVision TVF-5533MF", Philips, NTSC,
219 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, 238 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732},
239
220 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 240 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC,
221 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, 241 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732},
222 /* Should work for TNF9533-D/IF, TNF9533-B/DF */ 242 { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL,
223 { "Tena TNF9533-D/IF", Philips, PAL,
224 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, 243 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623},
225 244 { "Philips TEA5767HN FM Radio", Philips, RADIO,
226 /* This entry is for TEA5767 FM radio only chip used on several boards w/TV tuner */ 245 /* see tea5767.c for details */},
227 { TEA5767_TUNER_NAME, Philips, RADIO,
228 -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0},
229 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, 246 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL,
230 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, 247 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 },
231}; 248};
@@ -244,15 +261,6 @@ static int tuner_getstatus(struct i2c_client *c)
244 return byte; 261 return byte;
245} 262}
246 263
247#define TUNER_POR 0x80
248#define TUNER_FL 0x40
249#define TUNER_MODE 0x38
250#define TUNER_AFC 0x07
251
252#define TUNER_STEREO 0x10 /* radio mode */
253#define TUNER_STEREO_MK3 0x04 /* radio mode */
254#define TUNER_SIGNAL 0x07 /* radio mode */
255
256static int tuner_signal(struct i2c_client *c) 264static int tuner_signal(struct i2c_client *c)
257{ 265{
258 return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; 266 return (tuner_getstatus(c) & TUNER_SIGNAL) << 13;
@@ -278,22 +286,6 @@ static int tuner_stereo(struct i2c_client *c)
278 return stereo; 286 return stereo;
279} 287}
280 288
281#if 0 /* unused */
282static int tuner_islocked (struct i2c_client *c)
283{
284 return (tuner_getstatus (c) & TUNER_FL);
285}
286
287static int tuner_afcstatus (struct i2c_client *c)
288{
289 return (tuner_getstatus (c) & TUNER_AFC) - 2;
290}
291
292static int tuner_mode (struct i2c_client *c)
293{
294 return (tuner_getstatus (c) & TUNER_MODE) >> 3;
295}
296#endif
297 289
298/* ---------------------------------------------------------------------- */ 290/* ---------------------------------------------------------------------- */
299 291
@@ -376,7 +368,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
376 368
377 case TUNER_MICROTUNE_4042FI5: 369 case TUNER_MICROTUNE_4042FI5:
378 /* Set the charge pump for fast tuning */ 370 /* Set the charge pump for fast tuning */
379 tun->config |= 0x40; 371 tun->config |= TUNER_CHARGE_PUMP;
380 break; 372 break;
381 } 373 }
382 374
@@ -425,14 +417,13 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
425 tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc); 417 tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc);
426 break; 418 break;
427 } 419 }
428 /* bit 6 is PLL locked indicator */ 420 if (status_byte & TUNER_PLL_LOCKED)
429 if (status_byte & 0x40)
430 break; 421 break;
431 udelay(10); 422 udelay(10);
432 } 423 }
433 424
434 /* Set the charge pump for optimized phase noise figure */ 425 /* Set the charge pump for optimized phase noise figure */
435 tun->config &= ~0x40; 426 tun->config &= ~TUNER_CHARGE_PUMP;
436 buffer[0] = (div>>8) & 0x7f; 427 buffer[0] = (div>>8) & 0x7f;
437 buffer[1] = div & 0xff; 428 buffer[1] = div & 0xff;
438 buffer[2] = tun->config; 429 buffer[2] = tun->config;
@@ -453,26 +444,22 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
453 unsigned div; 444 unsigned div;
454 int rc; 445 int rc;
455 446
456 tun=&tuners[t->type]; 447 tun = &tuners[t->type];
457 div = (freq / 1000) + (int)(16*10.7); 448 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
458 buffer[2] = tun->config; 449 buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
459 450
460 switch (t->type) { 451 switch (t->type) {
461 case TUNER_TENA_9533_DI: 452 case TUNER_TENA_9533_DI:
462 case TUNER_YMEC_TVF_5533MF: 453 case TUNER_YMEC_TVF_5533MF:
463 /*These values are empirically determinated */ 454 tuner_dbg ("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n");
464 div = (freq * 122) / 16000 - 20; 455 return;
465 buffer[2] = 0x88; /* could be also 0x80 */
466 buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */
467 break;
468 case TUNER_PHILIPS_FM1216ME_MK3: 456 case TUNER_PHILIPS_FM1216ME_MK3:
469 case TUNER_PHILIPS_FM1236_MK3: 457 case TUNER_PHILIPS_FM1236_MK3:
470 case TUNER_PHILIPS_FMD1216ME_MK3: 458 case TUNER_PHILIPS_FMD1216ME_MK3:
471 buffer[3] = 0x19; 459 buffer[3] = 0x19;
472 break; 460 break;
473 case TUNER_PHILIPS_FM1256_IH3: 461 case TUNER_PHILIPS_FM1256_IH3:
474 div = (20 * freq) / 16000 + 333 * 2; 462 div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */
475 buffer[2] = 0x80;
476 buffer[3] = 0x19; 463 buffer[3] = 0x19;
477 break; 464 break;
478 case TUNER_LG_PAL_FM: 465 case TUNER_LG_PAL_FM:
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 9a493bea76d8..d8b78f1d686b 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -864,13 +864,8 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
864 * But changing the mode to VIDEO_SOUND_MONO would switch 864 * But changing the mode to VIDEO_SOUND_MONO would switch
865 * external 4052 multiplexer in audio_hook(). 865 * external 4052 multiplexer in audio_hook().
866 */ 866 */
867#if 0
868 if((nsr & 0x02) && !(dsr & 0x10)) /* NSR.S/MB=1 and DSR.AMSTAT=0 */
869 mode |= VIDEO_SOUND_STEREO;
870#else
871 if(nsr & 0x02) /* NSR.S/MB=1 */ 867 if(nsr & 0x02) /* NSR.S/MB=1 */
872 mode |= VIDEO_SOUND_STEREO; 868 mode |= VIDEO_SOUND_STEREO;
873#endif
874 if(nsr & 0x01) /* NSR.D/SB=1 */ 869 if(nsr & 0x01) /* NSR.D/SB=1 */
875 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 870 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
876 } else { 871 } else {
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 0f03c25489f1..e8d9440977cb 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -400,14 +400,6 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
400 } 400 }
401 } 401 }
402 402
403#if 0
404 if (t_format < sizeof(hauppauge_tuner_fmt)/sizeof(struct HAUPPAUGE_TUNER_FMT)) {
405 tvee->tuner_formats = hauppauge_tuner_fmt[t_format].id;
406 t_fmt_name = hauppauge_tuner_fmt[t_format].name;
407 } else {
408 t_fmt_name = "<unknown>";
409 }
410#endif
411 403
412 TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", 404 TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n",
413 tvee->model, 405 tvee->model,
@@ -482,6 +474,7 @@ static unsigned short normal_i2c[] = {
482 0xa0 >> 1, 474 0xa0 >> 1,
483 I2C_CLIENT_END, 475 I2C_CLIENT_END,
484}; 476};
477
485I2C_CLIENT_INSMOD; 478I2C_CLIENT_INSMOD;
486 479
487struct i2c_driver i2c_driver_tveeprom; 480struct i2c_driver i2c_driver_tveeprom;