aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2006-03-22 05:02:08 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 05:02:08 -0500
commit5501972e0b5857bc8354770d900ceb9b40c7f6b7 (patch)
treeff239422827c4cd54d2998f8851304255de31b38 /drivers/media/video/saa7134
parent9d2f928ddf64ca0361562e30faf584cd33055c60 (diff)
parente952f31bce6e9f64db01f607abc46529ba57ac9e (diff)
Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c9
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c294
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c31
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c182
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c507
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c46
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c14
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c70
-rw-r--r--drivers/media/video/saa7134/saa7134.h16
10 files changed, 617 insertions, 560 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index e02e6ee31b78..aca84d2f9825 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -308,8 +308,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev)
308 308
309static int dsp_buffer_free(struct saa7134_dev *dev) 309static int dsp_buffer_free(struct saa7134_dev *dev)
310{ 310{
311 if (!dev->dmasound.blksize) 311 BUG_ON(!dev->dmasound.blksize);
312 BUG();
313 312
314 videobuf_dma_free(&dev->dmasound.dma); 313 videobuf_dma_free(&dev->dmasound.dma);
315 314
@@ -612,12 +611,12 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
612 struct saa7134_dev *dev = saa7134->dev; 611 struct saa7134_dev *dev = saa7134->dev;
613 int err; 612 int err;
614 613
615 down(&dev->dmasound.lock); 614 mutex_lock(&dev->dmasound.lock);
616 615
617 dev->dmasound.read_count = 0; 616 dev->dmasound.read_count = 0;
618 dev->dmasound.read_offset = 0; 617 dev->dmasound.read_offset = 0;
619 618
620 up(&dev->dmasound.lock); 619 mutex_unlock(&dev->dmasound.lock);
621 620
622 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); 621 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
623 if (pcm == NULL) 622 if (pcm == NULL)
@@ -941,7 +940,7 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
941 940
942 chip->irq = dev->pci->irq; 941 chip->irq = dev->pci->irq;
943 942
944 init_MUTEX(&dev->dmasound.lock); 943 mutex_init(&dev->dmasound.lock);
945 944
946 if ((err = snd_card_saa7134_new_mixer(chip)) < 0) 945 if ((err = snd_card_saa7134_new_mixer(chip)) < 0)
947 goto __nodev; 946 goto __nodev;
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 6bc63a4086c1..fdd7f48f3b76 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -536,7 +536,7 @@ struct saa7134_board saa7134_boards[] = {
536 .radio = { 536 .radio = {
537 .name = name_radio, 537 .name = name_radio,
538 .amux = LINE2, 538 .amux = LINE2,
539 }, 539 },
540 }, 540 },
541 [SAA7134_BOARD_MD7134] = { 541 [SAA7134_BOARD_MD7134] = {
542 .name = "Medion 7134", 542 .name = "Medion 7134",
@@ -640,6 +640,32 @@ struct saa7134_board saa7134_boards[] = {
640 .tv = 1, 640 .tv = 1,
641 }}, 641 }},
642 }, 642 },
643 [SAA7134_BOARD_ELSA_700TV] = {
644 .name = "ELSA EX-VISION 700TV",
645 .audio_clock = 0x00187de7,
646 .tuner_type = TUNER_HITACHI_NTSC,
647 .radio_type = UNSET,
648 .tuner_addr = ADDR_UNSET,
649 .radio_addr = ADDR_UNSET,
650 .inputs = {{
651 .name = name_tv,
652 .vmux = 4,
653 .amux = LINE2,
654 .tv = 1,
655 },{
656 .name = name_comp1,
657 .vmux = 6,
658 .amux = LINE1,
659 },{
660 .name = name_svideo,
661 .vmux = 7,
662 .amux = LINE1,
663 }},
664 .mute = {
665 .name = name_mute,
666 .amux = TV,
667 },
668 },
643 [SAA7134_BOARD_ASUSTeK_TVFM7134] = { 669 [SAA7134_BOARD_ASUSTeK_TVFM7134] = {
644 .name = "ASUS TV-FM 7134", 670 .name = "ASUS TV-FM 7134",
645 .audio_clock = 0x00187de7, 671 .audio_clock = 0x00187de7,
@@ -2002,7 +2028,7 @@ struct saa7134_board saa7134_boards[] = {
2002 [SAA7134_BOARD_FLYTV_DIGIMATRIX] = { 2028 [SAA7134_BOARD_FLYTV_DIGIMATRIX] = {
2003 .name = "FlyTV mini Asus Digimatrix", 2029 .name = "FlyTV mini Asus Digimatrix",
2004 .audio_clock = 0x00200000, 2030 .audio_clock = 0x00200000,
2005 .tuner_type = TUNER_LG_NTSC_TALN_MINI, 2031 .tuner_type = TUNER_LG_TALN,
2006 .radio_type = UNSET, 2032 .radio_type = UNSET,
2007 .tuner_addr = ADDR_UNSET, 2033 .tuner_addr = ADDR_UNSET,
2008 .radio_addr = ADDR_UNSET, 2034 .radio_addr = ADDR_UNSET,
@@ -2598,6 +2624,7 @@ struct saa7134_board saa7134_boards[] = {
2598 .tuner_addr = ADDR_UNSET, 2624 .tuner_addr = ADDR_UNSET,
2599 .radio_addr = ADDR_UNSET, 2625 .radio_addr = ADDR_UNSET,
2600 .gpiomask = 0x00200000, 2626 .gpiomask = 0x00200000,
2627 .mpeg = SAA7134_MPEG_DVB,
2601 .inputs = {{ 2628 .inputs = {{
2602 .name = name_tv, /* Analog broadcast/cable TV */ 2629 .name = name_tv, /* Analog broadcast/cable TV */
2603 .vmux = 1, 2630 .vmux = 1,
@@ -2623,6 +2650,164 @@ struct saa7134_board saa7134_boards[] = {
2623 .gpio = 0x000000, /* GPIO21=Low for FM radio antenna */ 2650 .gpio = 0x000000, /* GPIO21=Low for FM radio antenna */
2624 }, 2651 },
2625 }, 2652 },
2653 [SAA7134_BOARD_AVERMEDIA_777] = {
2654 .name = "AverTV DVB-T 777",
2655 .audio_clock = 0x00187de7,
2656 .tuner_type = TUNER_ABSENT,
2657 .radio_type = UNSET,
2658 .tuner_addr = ADDR_UNSET,
2659 .radio_addr = ADDR_UNSET,
2660 .mpeg = SAA7134_MPEG_DVB,
2661 .inputs = {{
2662 .name = name_comp1,
2663 .vmux = 0,
2664 .amux = LINE1,
2665 },{
2666 .name = name_svideo,
2667 .vmux = 8,
2668 .amux = LINE1,
2669 }},
2670 },
2671 [SAA7134_BOARD_FLYDVBT_LR301] = {
2672 /* LifeView FlyDVB-T */
2673 /* Giampiero Giancipoli <gianci@libero.it> */
2674 .name = "LifeView FlyDVB-T",
2675 .audio_clock = 0x00200000,
2676 .tuner_type = TUNER_ABSENT,
2677 .radio_type = UNSET,
2678 .tuner_addr = ADDR_UNSET,
2679 .radio_addr = ADDR_UNSET,
2680 .mpeg = SAA7134_MPEG_DVB,
2681 .inputs = {{
2682 .name = name_comp1, /* Composite input */
2683 .vmux = 3,
2684 .amux = LINE2,
2685 },{
2686 .name = name_svideo, /* S-Video signal on S-Video input */
2687 .vmux = 8,
2688 .amux = LINE2,
2689 }},
2690 },
2691 [SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331] = {
2692 .name = "ADS Instant TV Duo Cardbus PTV331",
2693 .audio_clock = 0x00200000,
2694 .tuner_type = TUNER_PHILIPS_TDA8290,
2695 .radio_type = UNSET,
2696 .tuner_addr = ADDR_UNSET,
2697 .radio_addr = ADDR_UNSET,
2698 .mpeg = SAA7134_MPEG_DVB,
2699 .gpiomask = 0x00600000, /* Bit 21 0=Radio, Bit 22 0=TV */
2700 .inputs = {{
2701 .name = name_tv,
2702 .vmux = 1,
2703 .amux = TV,
2704 .tv = 1,
2705 .gpio = 0x00200000,
2706 }},
2707 },
2708 [SAA7134_BOARD_TEVION_DVBT_220RF] = {
2709 .name = "Tevion/KWorld DVB-T 220RF",
2710 .audio_clock = 0x00187de7,
2711 .tuner_type = TUNER_PHILIPS_TDA8290,
2712 .radio_type = UNSET,
2713 .tuner_addr = ADDR_UNSET,
2714 .radio_addr = ADDR_UNSET,
2715 .mpeg = SAA7134_MPEG_DVB,
2716 .inputs = {{
2717 .name = name_tv,
2718 .vmux = 1,
2719 .amux = TV,
2720 .tv = 1,
2721 },{
2722 .name = name_comp1,
2723 .vmux = 3,
2724 .amux = LINE1,
2725 },{
2726 .name = name_svideo,
2727 .vmux = 0,
2728 .amux = LINE1,
2729 }},
2730 .radio = {
2731 .name = name_radio,
2732 .amux = LINE1,
2733 },
2734 },
2735 [SAA7134_BOARD_KWORLD_ATSC110] = {
2736 .name = "Kworld ATSC110",
2737 .audio_clock = 0x00187de7,
2738 .tuner_type = TUNER_PHILIPS_TUV1236D,
2739 .radio_type = UNSET,
2740 .tuner_addr = ADDR_UNSET,
2741 .radio_addr = ADDR_UNSET,
2742 .tda9887_conf = TDA9887_PRESENT,
2743 .mpeg = SAA7134_MPEG_DVB,
2744 .inputs = {{
2745 .name = name_tv,
2746 .vmux = 1,
2747 .amux = TV,
2748 .tv = 1,
2749 },{
2750 .name = name_comp1,
2751 .vmux = 3,
2752 .amux = LINE2,
2753 },{
2754 .name = name_svideo,
2755 .vmux = 8,
2756 .amux = LINE2,
2757 }},
2758 },
2759 [SAA7134_BOARD_AVERMEDIA_A169_B] = {
2760 /* AVerMedia A169 */
2761 /* Rickard Osser <ricky@osser.se> */
2762 /* This card has two saa7134 chips on it,
2763 but only one of them is currently working. */
2764 .name = "AVerMedia A169 B",
2765 .audio_clock = 0x02187de7,
2766 .tuner_type = TUNER_LG_TALN,
2767 .radio_type = UNSET,
2768 .tuner_addr = ADDR_UNSET,
2769 .radio_addr = ADDR_UNSET,
2770 .tda9887_conf = TDA9887_PRESENT,
2771 .gpiomask = 0x0a60000,
2772 },
2773 [SAA7134_BOARD_AVERMEDIA_A169_B1] = {
2774 /* AVerMedia A169 */
2775 /* Rickard Osser <ricky@osser.se> */
2776 .name = "AVerMedia A169 B1",
2777 .audio_clock = 0x02187de7,
2778 .tuner_type = TUNER_LG_TALN,
2779 .radio_type = UNSET,
2780 .tuner_addr = ADDR_UNSET,
2781 .radio_addr = ADDR_UNSET,
2782 .tda9887_conf = TDA9887_PRESENT,
2783 .gpiomask = 0xca60000,
2784 .inputs = {{
2785 .name = name_tv,
2786 .vmux = 4,
2787 .amux = TV,
2788 .tv = 1,
2789 .gpio = 0x04a61000,
2790 },{
2791 .name = name_comp2, /* Composite SVIDEO (B/W if signal is carried with SVIDEO) */
2792 .vmux = 1,
2793 .amux = LINE2,
2794 },{
2795 .name = name_svideo,
2796 .vmux = 9, /* 9 is correct as S-VIDEO1 according to a169.inf! */
2797 .amux = LINE1,
2798 }},
2799 },
2800 [SAA7134_BOARD_MD7134_BRIDGE_2] = {
2801 /* This card has two saa7134 chips on it,
2802 but only one of them is currently working.
2803 The programming for the primary decoder is
2804 in SAA7134_BOARD_MD7134 */
2805 .name = "Medion 7134 Bridge #2",
2806 .audio_clock = 0x00187de7,
2807 .radio_type = UNSET,
2808 .tuner_addr = ADDR_UNSET,
2809 .radio_addr = ADDR_UNSET,
2810 },
2626}; 2811};
2627 2812
2628const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 2813const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -2753,6 +2938,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
2753 .driver_data = SAA7134_BOARD_ELSA_500TV, 2938 .driver_data = SAA7134_BOARD_ELSA_500TV,
2754 },{ 2939 },{
2755 .vendor = PCI_VENDOR_ID_PHILIPS, 2940 .vendor = PCI_VENDOR_ID_PHILIPS,
2941 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
2942 .subvendor = 0x1048,
2943 .subdevice = 0x226c,
2944 .driver_data = SAA7134_BOARD_ELSA_700TV,
2945 },{
2946 .vendor = PCI_VENDOR_ID_PHILIPS,
2756 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 2947 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
2757 .subvendor = PCI_VENDOR_ID_ASUSTEK, 2948 .subvendor = PCI_VENDOR_ID_ASUSTEK,
2758 .subdevice = 0x4842, 2949 .subdevice = 0x4842,
@@ -3094,6 +3285,54 @@ struct pci_device_id saa7134_pci_tbl[] = {
3094 .subdevice = 0x0319, 3285 .subdevice = 0x0319,
3095 .driver_data = SAA7134_BOARD_FLYDVB_TRIO, 3286 .driver_data = SAA7134_BOARD_FLYDVB_TRIO,
3096 },{ 3287 },{
3288 .vendor = PCI_VENDOR_ID_PHILIPS,
3289 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, /* SAA 7131E */
3290 .subvendor = 0x1461,
3291 .subdevice = 0x2c05,
3292 .driver_data = SAA7134_BOARD_AVERMEDIA_777,
3293 },{
3294 .vendor = PCI_VENDOR_ID_PHILIPS,
3295 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3296 .subvendor = 0x5168,
3297 .subdevice = 0x0301,
3298 .driver_data = SAA7134_BOARD_FLYDVBT_LR301,
3299 },{
3300 .vendor = PCI_VENDOR_ID_PHILIPS,
3301 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
3302 .subvendor = 0x0331,
3303 .subdevice = 0x1421,
3304 .driver_data = SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331,
3305 },{
3306 .vendor = PCI_VENDOR_ID_PHILIPS,
3307 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
3308 .subvendor = 0x17de,
3309 .subdevice = 0x7201,
3310 .driver_data = SAA7134_BOARD_TEVION_DVBT_220RF,
3311 },{
3312 .vendor = PCI_VENDOR_ID_PHILIPS,
3313 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, /* SAA7135HL */
3314 .subvendor = 0x17de,
3315 .subdevice = 0x7350,
3316 .driver_data = SAA7134_BOARD_KWORLD_ATSC110,
3317 },{
3318 .vendor = PCI_VENDOR_ID_PHILIPS,
3319 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3320 .subvendor = 0x1461,
3321 .subdevice = 0x7360,
3322 .driver_data = SAA7134_BOARD_AVERMEDIA_A169_B,
3323 },{
3324 .vendor = PCI_VENDOR_ID_PHILIPS,
3325 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3326 .subvendor = 0x1461,
3327 .subdevice = 0x6360,
3328 .driver_data = SAA7134_BOARD_AVERMEDIA_A169_B1,
3329 },{
3330 .vendor = PCI_VENDOR_ID_PHILIPS,
3331 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3332 .subvendor = 0x16be,
3333 .subdevice = 0x0005,
3334 .driver_data = SAA7134_BOARD_MD7134_BRIDGE_2,
3335 },{
3097 /* --- boards without eeprom + subsystem ID --- */ 3336 /* --- boards without eeprom + subsystem ID --- */
3098 .vendor = PCI_VENDOR_ID_PHILIPS, 3337 .vendor = PCI_VENDOR_ID_PHILIPS,
3099 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 3338 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -3193,13 +3432,15 @@ int saa7134_board_init1(struct saa7134_dev *dev)
3193 case SAA7134_BOARD_GOTVIEW_7135: 3432 case SAA7134_BOARD_GOTVIEW_7135:
3194 case SAA7134_BOARD_KWORLD_TERMINATOR: 3433 case SAA7134_BOARD_KWORLD_TERMINATOR:
3195 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: 3434 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS:
3435 case SAA7134_BOARD_FLYDVBT_LR301:
3436 case SAA7134_BOARD_FLYDVBTDUO:
3196 dev->has_remote = SAA7134_REMOTE_GPIO; 3437 dev->has_remote = SAA7134_REMOTE_GPIO;
3197 break; 3438 break;
3198 case SAA7134_BOARD_MD5044: 3439 case SAA7134_BOARD_MD5044:
3199 printk("%s: seems there are two different versions of the MD5044\n" 3440 printk("%s: seems there are two different versions of the MD5044\n"
3200 "%s: (with the same ID) out there. If sound doesn't work for\n" 3441 "%s: (with the same ID) out there. If sound doesn't work for\n"
3201 "%s: you try the audio_clock_override=0x200000 insmod option.\n", 3442 "%s: you try the audio_clock_override=0x200000 insmod option.\n",
3202 dev->name,dev->name,dev->name); 3443 dev->name,dev->name,dev->name);
3203 break; 3444 break;
3204 case SAA7134_BOARD_CINERGY400_CARDBUS: 3445 case SAA7134_BOARD_CINERGY400_CARDBUS:
3205 /* power-up tuner chip */ 3446 /* power-up tuner chip */
@@ -3220,6 +3461,10 @@ int saa7134_board_init1(struct saa7134_dev *dev)
3220 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); 3461 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
3221 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); 3462 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06);
3222 break; 3463 break;
3464 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
3465 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
3466 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x00);
3467 break;
3223 case SAA7134_BOARD_AVERMEDIA_CARDBUS: 3468 case SAA7134_BOARD_AVERMEDIA_CARDBUS:
3224 /* power-up tuner chip */ 3469 /* power-up tuner chip */
3225 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); 3470 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff);
@@ -3242,6 +3487,13 @@ int saa7134_board_init1(struct saa7134_dev *dev)
3242 case SAA7134_BOARD_UPMOST_PURPLE_TV: 3487 case SAA7134_BOARD_UPMOST_PURPLE_TV:
3243 dev->has_remote = SAA7134_REMOTE_I2C; 3488 dev->has_remote = SAA7134_REMOTE_I2C;
3244 break; 3489 break;
3490 case SAA7134_BOARD_AVERMEDIA_A169_B:
3491 case SAA7134_BOARD_MD7134_BRIDGE_2:
3492 printk("%s: %s: dual saa713x broadcast decoders\n"
3493 "%s: Sorry, none of the inputs to this chip are supported yet.\n"
3494 "%s: Dual decoder functionality is disabled for now, use the other chip.\n",
3495 dev->name,card(dev).name,dev->name,dev->name);
3496 break;
3245 } 3497 }
3246 return 0; 3498 return 0;
3247} 3499}
@@ -3362,14 +3614,44 @@ int saa7134_board_init2(struct saa7134_dev *dev)
3362 } 3614 }
3363 break; 3615 break;
3364 case SAA7134_BOARD_PHILIPS_TIGER: 3616 case SAA7134_BOARD_PHILIPS_TIGER:
3617 case SAA7134_BOARD_TEVION_DVBT_220RF:
3365 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 3618 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
3366 /* this is a hybrid board, initialize to analog mode */ 3619 /* this is a hybrid board, initialize to analog mode
3620 * and configure firmware eeprom address
3621 */
3367 { 3622 {
3368 u8 data[] = { 0x3c, 0x33, 0x68}; 3623 u8 data[] = { 0x3c, 0x33, 0x68};
3369 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; 3624 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
3370 i2c_transfer(&dev->i2c_adap, &msg, 1); 3625 i2c_transfer(&dev->i2c_adap, &msg, 1);
3371 } 3626 }
3372 break; 3627 break;
3628 case SAA7134_BOARD_FLYDVB_TRIO:
3629 {
3630 u8 data[] = { 0x3c, 0x33, 0x62};
3631 struct i2c_msg msg = {.addr=0x09, .flags=0, .buf=data, .len = sizeof(data)};
3632 i2c_transfer(&dev->i2c_adap, &msg, 1);
3633 }
3634 break;
3635 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
3636 /* make the tda10046 find its eeprom */
3637 {
3638 u8 data[] = { 0x3c, 0x33, 0x62};
3639 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
3640 i2c_transfer(&dev->i2c_adap, &msg, 1);
3641 }
3642 break;
3643 case SAA7134_BOARD_KWORLD_ATSC110:
3644 {
3645 /* enable tuner */
3646 int i;
3647 static const u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 };
3648 dev->i2c_client.addr = 0x0a;
3649 for (i = 0; i < 5; i++)
3650 if (2 != i2c_master_send(&dev->i2c_client,&buffer[i*2],2))
3651 printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n",
3652 dev->name, i);
3653 }
3654 break;
3373 } 3655 }
3374 return 0; 3656 return 0;
3375} 3657}
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 028904bd94a2..58e568d7d2ee 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -66,6 +66,11 @@ static unsigned int latency = UNSET;
66module_param(latency, int, 0444); 66module_param(latency, int, 0444);
67MODULE_PARM_DESC(latency,"pci latency timer"); 67MODULE_PARM_DESC(latency,"pci latency timer");
68 68
69int saa7134_no_overlay=-1;
70module_param_named(no_overlay, saa7134_no_overlay, int, 0444);
71MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
72 " [some VIA/SIS chipsets are known to have problem with overlay]");
73
69static unsigned int video_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; 74static unsigned int video_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
70static unsigned int vbi_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; 75static unsigned int vbi_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
71static unsigned int radio_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; 76static unsigned int radio_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
@@ -251,8 +256,7 @@ void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt)
251 256
252void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf) 257void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf)
253{ 258{
254 if (in_interrupt()) 259 BUG_ON(in_interrupt());
255 BUG();
256 260
257 videobuf_waiton(&buf->vb,0,0); 261 videobuf_waiton(&buf->vb,0,0);
258 videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); 262 videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma);
@@ -613,7 +617,7 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
613 617
614 saa_writel(SAA7134_IRQ1, 0); 618 saa_writel(SAA7134_IRQ1, 0);
615 saa_writel(SAA7134_IRQ2, 0); 619 saa_writel(SAA7134_IRQ2, 0);
616 init_MUTEX(&dev->lock); 620 mutex_init(&dev->lock);
617 spin_lock_init(&dev->slock); 621 spin_lock_init(&dev->slock);
618 622
619 saa7134_track_gpio(dev,"pre-init"); 623 saa7134_track_gpio(dev,"pre-init");
@@ -835,6 +839,22 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
835 latency = 0x0A; 839 latency = 0x0A;
836 } 840 }
837#endif 841#endif
842 if (pci_pci_problems & PCIPCI_FAIL) {
843 printk(KERN_INFO "%s: quirk: this driver and your "
844 "chipset may not work together"
845 " in overlay mode.\n",dev->name);
846 if (!saa7134_no_overlay) {
847 printk(KERN_INFO "%s: quirk: overlay "
848 "mode will be disabled.\n",
849 dev->name);
850 saa7134_no_overlay = 1;
851 } else {
852 printk(KERN_INFO "%s: quirk: overlay "
853 "mode will be forced. Use this"
854 " option at your own risk.\n",
855 dev->name);
856 }
857 }
838 } 858 }
839 if (UNSET != latency) { 859 if (UNSET != latency) {
840 printk(KERN_INFO "%s: setting pci latency timer to %d\n", 860 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
@@ -937,6 +957,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
937 v4l2_prio_init(&dev->prio); 957 v4l2_prio_init(&dev->prio);
938 958
939 /* register v4l devices */ 959 /* register v4l devices */
960 if (saa7134_no_overlay <= 0) {
961 saa7134_video_template.type |= VID_TYPE_OVERLAY;
962 } else {
963 printk("bttv: Overlay support disabled.\n");
964 }
940 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); 965 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video");
941 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, 966 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
942 video_nr[dev->nr]); 967 video_nr[dev->nr]);
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 9db8e13f21c3..86cfdb8514cb 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -32,6 +32,7 @@
32#include "saa7134-reg.h" 32#include "saa7134-reg.h"
33#include "saa7134.h" 33#include "saa7134.h"
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include "dvb-pll.h"
35 36
36#ifdef HAVE_MT352 37#ifdef HAVE_MT352
37# include "mt352.h" 38# include "mt352.h"
@@ -42,7 +43,6 @@
42#endif 43#endif
43#ifdef HAVE_NXT200X 44#ifdef HAVE_NXT200X
44# include "nxt200x.h" 45# include "nxt200x.h"
45# include "dvb-pll.h"
46#endif 46#endif
47 47
48MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 48MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -114,6 +114,24 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
114 return 0; 114 return 0;
115} 115}
116 116
117static int mt352_aver777_init(struct dvb_frontend* fe)
118{
119 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
120 static u8 reset [] = { RESET, 0x80 };
121 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
122 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 };
123 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
124
125 mt352_write(fe, clock_config, sizeof(clock_config));
126 udelay(200);
127 mt352_write(fe, reset, sizeof(reset));
128 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
129 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
130 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
131
132 return 0;
133}
134
117static int mt352_pinnacle_pll_set(struct dvb_frontend* fe, 135static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
118 struct dvb_frontend_parameters* params, 136 struct dvb_frontend_parameters* params,
119 u8* pllbuf) 137 u8* pllbuf)
@@ -146,6 +164,15 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
146 return 0; 164 return 0;
147} 165}
148 166
167static int mt352_aver777_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf)
168{
169 pllbuf[0] = 0xc2;
170 dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1,
171 params->frequency,
172 params->u.ofdm.bandwidth);
173 return 0;
174}
175
149static struct mt352_config pinnacle_300i = { 176static struct mt352_config pinnacle_300i = {
150 .demod_address = 0x3c >> 1, 177 .demod_address = 0x3c >> 1,
151 .adc_clock = 20333, 178 .adc_clock = 20333,
@@ -154,6 +181,12 @@ static struct mt352_config pinnacle_300i = {
154 .demod_init = mt352_pinnacle_init, 181 .demod_init = mt352_pinnacle_init,
155 .pll_set = mt352_pinnacle_pll_set, 182 .pll_set = mt352_pinnacle_pll_set,
156}; 183};
184
185static struct mt352_config avermedia_777 = {
186 .demod_address = 0xf,
187 .demod_init = mt352_aver777_init,
188 .pll_set = mt352_aver777_pll_set,
189};
157#endif 190#endif
158 191
159/* ------------------------------------------------------------------ */ 192/* ------------------------------------------------------------------ */
@@ -781,7 +814,7 @@ static int philips_tiger_pll_set(struct dvb_frontend *fe, struct dvb_frontend_pa
781 tda8290_msg.buf = tda8290_open; 814 tda8290_msg.buf = tda8290_open;
782 i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); 815 i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
783 return ret; 816 return ret;
784}; 817}
785 818
786static int philips_tiger_dvb_mode(struct dvb_frontend *fe) 819static int philips_tiger_dvb_mode(struct dvb_frontend *fe)
787{ 820{
@@ -817,6 +850,110 @@ static struct tda1004x_config philips_tiger_config = {
817 .request_firmware = NULL, 850 .request_firmware = NULL,
818}; 851};
819 852
853/* ------------------------------------------------------------------ */
854
855static int lifeview_trio_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
856{
857 int ret;
858
859 ret = philips_tda827xa_pll_set(0x60, fe, params);
860 return ret;
861}
862
863static int lifeview_trio_dvb_mode(struct dvb_frontend *fe)
864{
865 return 0;
866}
867
868static void lifeview_trio_analog_mode(struct dvb_frontend *fe)
869{
870 philips_tda827xa_pll_sleep(0x60, fe);
871}
872
873static struct tda1004x_config lifeview_trio_config = {
874 .demod_address = 0x09,
875 .invert = 1,
876 .invert_oclk = 0,
877 .xtal_freq = TDA10046_XTAL_16M,
878 .agc_config = TDA10046_AGC_TDA827X_GPL,
879 .if_freq = TDA10046_FREQ_045,
880 .pll_init = lifeview_trio_dvb_mode,
881 .pll_set = lifeview_trio_pll_set,
882 .pll_sleep = lifeview_trio_analog_mode,
883 .request_firmware = NULL,
884};
885
886/* ------------------------------------------------------------------ */
887
888static int ads_duo_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
889{
890 int ret;
891
892 ret = philips_tda827xa_pll_set(0x61, fe, params);
893 return ret;
894}
895
896static int ads_duo_dvb_mode(struct dvb_frontend *fe)
897{
898 struct saa7134_dev *dev = fe->dvb->priv;
899 /* route TDA8275a AGC input to the channel decoder */
900 saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x60);
901 return 0;
902}
903
904static void ads_duo_analog_mode(struct dvb_frontend *fe)
905{
906 struct saa7134_dev *dev = fe->dvb->priv;
907 /* route TDA8275a AGC input to the analog IF chip*/
908 saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20);
909 philips_tda827xa_pll_sleep( 0x61, fe);
910}
911
912static struct tda1004x_config ads_tech_duo_config = {
913 .demod_address = 0x08,
914 .invert = 1,
915 .invert_oclk = 0,
916 .xtal_freq = TDA10046_XTAL_16M,
917 .agc_config = TDA10046_AGC_TDA827X_GPL,
918 .if_freq = TDA10046_FREQ_045,
919 .pll_init = ads_duo_dvb_mode,
920 .pll_set = ads_duo_pll_set,
921 .pll_sleep = ads_duo_analog_mode,
922 .request_firmware = NULL,
923};
924
925/* ------------------------------------------------------------------ */
926
927static int tevion_dvb220rf_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
928{
929 int ret;
930 ret = philips_tda827xa_pll_set(0x60, fe, params);
931 return ret;
932}
933
934static int tevion_dvb220rf_pll_init(struct dvb_frontend *fe)
935{
936 return 0;
937}
938
939static void tevion_dvb220rf_pll_sleep(struct dvb_frontend *fe)
940{
941 philips_tda827xa_pll_sleep( 0x61, fe);
942}
943
944static struct tda1004x_config tevion_dvbt220rf_config = {
945 .demod_address = 0x08,
946 .invert = 1,
947 .invert_oclk = 0,
948 .xtal_freq = TDA10046_XTAL_16M,
949 .agc_config = TDA10046_AGC_TDA827X,
950 .if_freq = TDA10046_FREQ_045,
951 .pll_init = tevion_dvb220rf_pll_init,
952 .pll_set = tevion_dvb220rf_pll_set,
953 .pll_sleep = tevion_dvb220rf_pll_sleep,
954 .request_firmware = NULL,
955};
956
820#endif 957#endif
821 958
822/* ------------------------------------------------------------------ */ 959/* ------------------------------------------------------------------ */
@@ -827,6 +964,22 @@ static struct nxt200x_config avertvhda180 = {
827 .pll_address = 0x61, 964 .pll_address = 0x61,
828 .pll_desc = &dvb_pll_tdhu2, 965 .pll_desc = &dvb_pll_tdhu2,
829}; 966};
967
968static int nxt200x_set_pll_input(u8 *buf, int input)
969{
970 if (input)
971 buf[3] |= 0x08;
972 else
973 buf[3] &= ~0x08;
974 return 0;
975}
976
977static struct nxt200x_config kworldatsc110 = {
978 .demod_address = 0x0a,
979 .pll_address = 0x61,
980 .pll_desc = &dvb_pll_tuv1236d,
981 .set_pll_input = nxt200x_set_pll_input,
982};
830#endif 983#endif
831 984
832/* ------------------------------------------------------------------ */ 985/* ------------------------------------------------------------------ */
@@ -851,6 +1004,12 @@ static int dvb_init(struct saa7134_dev *dev)
851 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 1004 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
852 &dev->i2c_adap); 1005 &dev->i2c_adap);
853 break; 1006 break;
1007
1008 case SAA7134_BOARD_AVERMEDIA_777:
1009 printk("%s: avertv 777 dvb setup\n",dev->name);
1010 dev->dvb.frontend = mt352_attach(&avermedia_777,
1011 &dev->i2c_adap);
1012 break;
854#endif 1013#endif
855#ifdef HAVE_TDA1004X 1014#ifdef HAVE_TDA1004X
856 case SAA7134_BOARD_MD7134: 1015 case SAA7134_BOARD_MD7134:
@@ -889,11 +1048,30 @@ static int dvb_init(struct saa7134_dev *dev)
889 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1048 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
890 &dev->i2c_adap); 1049 &dev->i2c_adap);
891 break; 1050 break;
1051 case SAA7134_BOARD_FLYDVBT_LR301:
1052 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1053 &dev->i2c_adap);
1054 break;
1055 case SAA7134_BOARD_FLYDVB_TRIO:
1056 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config,
1057 &dev->i2c_adap);
1058 break;
1059 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
1060 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1061 &dev->i2c_adap);
1062 break;
1063 case SAA7134_BOARD_TEVION_DVBT_220RF:
1064 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config,
1065 &dev->i2c_adap);
1066 break;
892#endif 1067#endif
893#ifdef HAVE_NXT200X 1068#ifdef HAVE_NXT200X
894 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: 1069 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
895 dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); 1070 dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap);
896 break; 1071 break;
1072 case SAA7134_BOARD_KWORLD_ATSC110:
1073 dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap);
1074 break;
897#endif 1075#endif
898 default: 1076 default:
899 printk("%s: Huh? unknown DVB card?\n",dev->name); 1077 printk("%s: Huh? unknown DVB card?\n",dev->name);
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index bd4c389d4c37..1d972edb3be6 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -89,7 +89,7 @@ static int ts_open(struct inode *inode, struct file *file)
89 89
90 dprintk("open minor=%d\n",minor); 90 dprintk("open minor=%d\n",minor);
91 err = -EBUSY; 91 err = -EBUSY;
92 if (down_trylock(&dev->empress_tsq.lock)) 92 if (!mutex_trylock(&dev->empress_tsq.lock))
93 goto done; 93 goto done;
94 if (dev->empress_users) 94 if (dev->empress_users)
95 goto done_up; 95 goto done_up;
@@ -99,7 +99,7 @@ static int ts_open(struct inode *inode, struct file *file)
99 err = 0; 99 err = 0;
100 100
101done_up: 101done_up:
102 up(&dev->empress_tsq.lock); 102 mutex_unlock(&dev->empress_tsq.lock);
103done: 103done:
104 return err; 104 return err;
105} 105}
@@ -110,7 +110,7 @@ static int ts_release(struct inode *inode, struct file *file)
110 110
111 if (dev->empress_tsq.streaming) 111 if (dev->empress_tsq.streaming)
112 videobuf_streamoff(&dev->empress_tsq); 112 videobuf_streamoff(&dev->empress_tsq);
113 down(&dev->empress_tsq.lock); 113 mutex_lock(&dev->empress_tsq.lock);
114 if (dev->empress_tsq.reading) 114 if (dev->empress_tsq.reading)
115 videobuf_read_stop(&dev->empress_tsq); 115 videobuf_read_stop(&dev->empress_tsq);
116 videobuf_mmap_free(&dev->empress_tsq); 116 videobuf_mmap_free(&dev->empress_tsq);
@@ -119,7 +119,7 @@ static int ts_release(struct inode *inode, struct file *file)
119 /* stop the encoder */ 119 /* stop the encoder */
120 ts_reset_encoder(dev); 120 ts_reset_encoder(dev);
121 121
122 up(&dev->empress_tsq.lock); 122 mutex_unlock(&dev->empress_tsq.lock);
123 return 0; 123 return 0;
124} 124}
125 125
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 82d28cbf289f..1426e4c8602f 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -42,485 +42,6 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
42#define i2cdprintk(fmt, arg...) if (ir_debug) \ 42#define i2cdprintk(fmt, arg...) if (ir_debug) \
43 printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) 43 printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg)
44 44
45/* ---------------------------------------------------------------------- */
46
47static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
48 [ 15 ] = KEY_KP0,
49 [ 3 ] = KEY_KP1,
50 [ 4 ] = KEY_KP2,
51 [ 5 ] = KEY_KP3,
52 [ 7 ] = KEY_KP4,
53 [ 8 ] = KEY_KP5,
54 [ 9 ] = KEY_KP6,
55 [ 11 ] = KEY_KP7,
56 [ 12 ] = KEY_KP8,
57 [ 13 ] = KEY_KP9,
58
59 [ 14 ] = KEY_MODE, // Air/Cable
60 [ 17 ] = KEY_VIDEO, // Video
61 [ 21 ] = KEY_AUDIO, // Audio
62 [ 0 ] = KEY_POWER, // Power
63 [ 24 ] = KEY_TUNER, // AV Source
64 [ 2 ] = KEY_ZOOM, // Fullscreen
65 [ 26 ] = KEY_LANGUAGE, // Stereo
66 [ 27 ] = KEY_MUTE, // Mute
67 [ 20 ] = KEY_VOLUMEUP, // Volume +
68 [ 23 ] = KEY_VOLUMEDOWN, // Volume -
69 [ 18 ] = KEY_CHANNELUP, // Channel +
70 [ 19 ] = KEY_CHANNELDOWN, // Channel -
71 [ 6 ] = KEY_AGAIN, // Recall
72 [ 16 ] = KEY_ENTER, // Enter
73};
74
75
76static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = {
77 [ 0 ] = KEY_KP0,
78 [ 1 ] = KEY_KP1,
79 [ 2 ] = KEY_KP2,
80 [ 3 ] = KEY_KP3,
81 [ 4 ] = KEY_KP4,
82 [ 5 ] = KEY_KP5,
83 [ 6 ] = KEY_KP6,
84 [ 7 ] = KEY_KP7,
85 [ 8 ] = KEY_KP8,
86 [ 9 ] = KEY_KP9,
87
88 [ 0x0a ] = KEY_POWER,
89 [ 0x0b ] = KEY_PROG1, // app
90 [ 0x0c ] = KEY_ZOOM, // zoom/fullscreen
91 [ 0x0d ] = KEY_CHANNELUP, // channel
92 [ 0x0e ] = KEY_CHANNELDOWN, // channel-
93 [ 0x0f ] = KEY_VOLUMEUP,
94 [ 0x10 ] = KEY_VOLUMEDOWN,
95 [ 0x11 ] = KEY_TUNER, // AV
96 [ 0x12 ] = KEY_NUMLOCK, // -/--
97 [ 0x13 ] = KEY_AUDIO, // audio
98 [ 0x14 ] = KEY_MUTE,
99 [ 0x15 ] = KEY_UP,
100 [ 0x16 ] = KEY_DOWN,
101 [ 0x17 ] = KEY_LEFT,
102 [ 0x18 ] = KEY_RIGHT,
103 [ 0x19 ] = BTN_LEFT,
104 [ 0x1a ] = BTN_RIGHT,
105 [ 0x1b ] = KEY_WWW, // text
106 [ 0x1c ] = KEY_REWIND,
107 [ 0x1d ] = KEY_FORWARD,
108 [ 0x1e ] = KEY_RECORD,
109 [ 0x1f ] = KEY_PLAY,
110 [ 0x20 ] = KEY_PREVIOUSSONG,
111 [ 0x21 ] = KEY_NEXTSONG,
112 [ 0x22 ] = KEY_PAUSE,
113 [ 0x23 ] = KEY_STOP,
114};
115
116/* Alfons Geser <a.geser@cox.net>
117 * updates from Job D. R. Borges <jobdrb@ig.com.br> */
118static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = {
119 [ 18 ] = KEY_POWER,
120 [ 1 ] = KEY_TV, // DVR
121 [ 21 ] = KEY_DVD, // DVD
122 [ 23 ] = KEY_AUDIO, // music
123 // DVR mode / DVD mode / music mode
124
125 [ 27 ] = KEY_MUTE, // mute
126 [ 2 ] = KEY_LANGUAGE, // MTS/SAP / audio / autoseek
127 [ 30 ] = KEY_SUBTITLE, // closed captioning / subtitle / seek
128 [ 22 ] = KEY_ZOOM, // full screen
129 [ 28 ] = KEY_VIDEO, // video source / eject / delall
130 [ 29 ] = KEY_RESTART, // playback / angle / del
131 [ 47 ] = KEY_SEARCH, // scan / menu / playlist
132 [ 48 ] = KEY_CHANNEL, // CH surfing / bookmark / memo
133
134 [ 49 ] = KEY_HELP, // help
135 [ 50 ] = KEY_MODE, // num/memo
136 [ 51 ] = KEY_ESC, // cancel
137
138 [ 12 ] = KEY_UP, // up
139 [ 16 ] = KEY_DOWN, // down
140 [ 8 ] = KEY_LEFT, // left
141 [ 4 ] = KEY_RIGHT, // right
142 [ 3 ] = KEY_SELECT, // select
143
144 [ 31 ] = KEY_REWIND, // rewind
145 [ 32 ] = KEY_PLAYPAUSE, // play/pause
146 [ 41 ] = KEY_FORWARD, // forward
147 [ 20 ] = KEY_AGAIN, // repeat
148 [ 43 ] = KEY_RECORD, // recording
149 [ 44 ] = KEY_STOP, // stop
150 [ 45 ] = KEY_PLAY, // play
151 [ 46 ] = KEY_SHUFFLE, // snapshot / shuffle
152
153 [ 0 ] = KEY_KP0,
154 [ 5 ] = KEY_KP1,
155 [ 6 ] = KEY_KP2,
156 [ 7 ] = KEY_KP3,
157 [ 9 ] = KEY_KP4,
158 [ 10 ] = KEY_KP5,
159 [ 11 ] = KEY_KP6,
160 [ 13 ] = KEY_KP7,
161 [ 14 ] = KEY_KP8,
162 [ 15 ] = KEY_KP9,
163
164 [ 42 ] = KEY_VOLUMEUP,
165 [ 17 ] = KEY_VOLUMEDOWN,
166 [ 24 ] = KEY_CHANNELUP, // CH.tracking up
167 [ 25 ] = KEY_CHANNELDOWN, // CH.tracking down
168
169 [ 19 ] = KEY_KPENTER, // enter
170 [ 33 ] = KEY_KPDOT, // . (decimal dot)
171};
172
173static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = {
174 [ 30 ] = KEY_POWER, // power
175 [ 28 ] = KEY_SEARCH, // scan
176 [ 7 ] = KEY_SELECT, // source
177
178 [ 22 ] = KEY_VOLUMEUP,
179 [ 20 ] = KEY_VOLUMEDOWN,
180 [ 31 ] = KEY_CHANNELUP,
181 [ 23 ] = KEY_CHANNELDOWN,
182 [ 24 ] = KEY_MUTE,
183
184 [ 2 ] = KEY_KP0,
185 [ 1 ] = KEY_KP1,
186 [ 11 ] = KEY_KP2,
187 [ 27 ] = KEY_KP3,
188 [ 5 ] = KEY_KP4,
189 [ 9 ] = KEY_KP5,
190 [ 21 ] = KEY_KP6,
191 [ 6 ] = KEY_KP7,
192 [ 10 ] = KEY_KP8,
193 [ 18 ] = KEY_KP9,
194 [ 16 ] = KEY_KPDOT,
195
196 [ 3 ] = KEY_TUNER, // tv/fm
197 [ 4 ] = KEY_REWIND, // fm tuning left or function left
198 [ 12 ] = KEY_FORWARD, // fm tuning right or function right
199
200 [ 0 ] = KEY_RECORD,
201 [ 8 ] = KEY_STOP,
202 [ 17 ] = KEY_PLAY,
203
204 [ 25 ] = KEY_ZOOM,
205 [ 14 ] = KEY_MENU, // function
206 [ 19 ] = KEY_AGAIN, // recall
207 [ 29 ] = KEY_RESTART, // reset
208 [ 26 ] = KEY_SHUFFLE, // snapshot/shuffle
209
210// FIXME
211 [ 13 ] = KEY_F21, // mts
212 [ 15 ] = KEY_F22, // min
213};
214
215/* Alex Hermann <gaaf@gmx.net> */
216static IR_KEYTAB_TYPE md2819_codes[IR_KEYTAB_SIZE] = {
217 [ 40 ] = KEY_KP1,
218 [ 24 ] = KEY_KP2,
219 [ 56 ] = KEY_KP3,
220 [ 36 ] = KEY_KP4,
221 [ 20 ] = KEY_KP5,
222 [ 52 ] = KEY_KP6,
223 [ 44 ] = KEY_KP7,
224 [ 28 ] = KEY_KP8,
225 [ 60 ] = KEY_KP9,
226 [ 34 ] = KEY_KP0,
227
228 [ 32 ] = KEY_TV, // TV/FM
229 [ 16 ] = KEY_CD, // CD
230 [ 48 ] = KEY_TEXT, // TELETEXT
231 [ 0 ] = KEY_POWER, // POWER
232
233 [ 8 ] = KEY_VIDEO, // VIDEO
234 [ 4 ] = KEY_AUDIO, // AUDIO
235 [ 12 ] = KEY_ZOOM, // FULL SCREEN
236
237 [ 18 ] = KEY_SUBTITLE, // DISPLAY - ???
238 [ 50 ] = KEY_REWIND, // LOOP - ???
239 [ 2 ] = KEY_PRINT, // PREVIEW - ???
240
241 [ 42 ] = KEY_SEARCH, // AUTOSCAN
242 [ 26 ] = KEY_SLEEP, // FREEZE - ???
243 [ 58 ] = KEY_SHUFFLE, // SNAPSHOT - ???
244 [ 10 ] = KEY_MUTE, // MUTE
245
246 [ 38 ] = KEY_RECORD, // RECORD
247 [ 22 ] = KEY_PAUSE, // PAUSE
248 [ 54 ] = KEY_STOP, // STOP
249 [ 6 ] = KEY_PLAY, // PLAY
250
251 [ 46 ] = KEY_RED, // <RED>
252 [ 33 ] = KEY_GREEN, // <GREEN>
253 [ 14 ] = KEY_YELLOW, // <YELLOW>
254 [ 1 ] = KEY_BLUE, // <BLUE>
255
256 [ 30 ] = KEY_VOLUMEDOWN, // VOLUME-
257 [ 62 ] = KEY_VOLUMEUP, // VOLUME+
258 [ 17 ] = KEY_CHANNELDOWN, // CHANNEL/PAGE-
259 [ 49 ] = KEY_CHANNELUP // CHANNEL/PAGE+
260};
261
262static IR_KEYTAB_TYPE videomate_tv_pvr_codes[IR_KEYTAB_SIZE] = {
263 [ 20 ] = KEY_MUTE,
264 [ 36 ] = KEY_ZOOM,
265
266 [ 1 ] = KEY_DVD,
267 [ 35 ] = KEY_RADIO,
268 [ 0 ] = KEY_TV,
269
270 [ 10 ] = KEY_REWIND,
271 [ 8 ] = KEY_PLAYPAUSE,
272 [ 15 ] = KEY_FORWARD,
273
274 [ 2 ] = KEY_PREVIOUS,
275 [ 7 ] = KEY_STOP,
276 [ 6 ] = KEY_NEXT,
277
278 [ 12 ] = KEY_UP,
279 [ 14 ] = KEY_DOWN,
280 [ 11 ] = KEY_LEFT,
281 [ 13 ] = KEY_RIGHT,
282 [ 17 ] = KEY_OK,
283
284 [ 3 ] = KEY_MENU,
285 [ 9 ] = KEY_SETUP,
286 [ 5 ] = KEY_VIDEO,
287 [ 34 ] = KEY_CHANNEL,
288
289 [ 18 ] = KEY_VOLUMEUP,
290 [ 21 ] = KEY_VOLUMEDOWN,
291 [ 16 ] = KEY_CHANNELUP,
292 [ 19 ] = KEY_CHANNELDOWN,
293
294 [ 4 ] = KEY_RECORD,
295
296 [ 22 ] = KEY_KP1,
297 [ 23 ] = KEY_KP2,
298 [ 24 ] = KEY_KP3,
299 [ 25 ] = KEY_KP4,
300 [ 26 ] = KEY_KP5,
301 [ 27 ] = KEY_KP6,
302 [ 28 ] = KEY_KP7,
303 [ 29 ] = KEY_KP8,
304 [ 30 ] = KEY_KP9,
305 [ 31 ] = KEY_KP0,
306
307 [ 32 ] = KEY_LANGUAGE,
308 [ 33 ] = KEY_SLEEP,
309};
310
311/* Michael Tokarev <mjt@tls.msk.ru>
312 http://www.corpit.ru/mjt/beholdTV/remote_control.jpg
313 keytable is used by MANLI MTV00[12] and BeholdTV 40[13] at
314 least, and probably other cards too.
315 The "ascii-art picture" below (in comments, first row
316 is the keycode in hex, and subsequent row(s) shows
317 the button labels (several variants when appropriate)
318 helps to descide which keycodes to assign to the buttons.
319 */
320static IR_KEYTAB_TYPE manli_codes[IR_KEYTAB_SIZE] = {
321
322 /* 0x1c 0x12 *
323 * FUNCTION POWER *
324 * FM (|) *
325 * */
326 [ 0x1c ] = KEY_RADIO, /*XXX*/
327 [ 0x12 ] = KEY_POWER,
328
329 /* 0x01 0x02 0x03 *
330 * 1 2 3 *
331 * *
332 * 0x04 0x05 0x06 *
333 * 4 5 6 *
334 * *
335 * 0x07 0x08 0x09 *
336 * 7 8 9 *
337 * */
338 [ 0x01 ] = KEY_KP1,
339 [ 0x02 ] = KEY_KP2,
340 [ 0x03 ] = KEY_KP3,
341 [ 0x04 ] = KEY_KP4,
342 [ 0x05 ] = KEY_KP5,
343 [ 0x06 ] = KEY_KP6,
344 [ 0x07 ] = KEY_KP7,
345 [ 0x08 ] = KEY_KP8,
346 [ 0x09 ] = KEY_KP9,
347
348 /* 0x0a 0x00 0x17 *
349 * RECALL 0 +100 *
350 * PLUS *
351 * */
352 [ 0x0a ] = KEY_AGAIN, /*XXX KEY_REWIND? */
353 [ 0x00 ] = KEY_KP0,
354 [ 0x17 ] = KEY_DIGITS, /*XXX*/
355
356 /* 0x14 0x10 *
357 * MENU INFO *
358 * OSD */
359 [ 0x14 ] = KEY_MENU,
360 [ 0x10 ] = KEY_INFO,
361
362 /* 0x0b *
363 * Up *
364 * *
365 * 0x18 0x16 0x0c *
366 * Left Ok Right *
367 * *
368 * 0x015 *
369 * Down *
370 * */
371 [ 0x0b ] = KEY_UP, /*XXX KEY_SCROLLUP? */
372 [ 0x18 ] = KEY_LEFT, /*XXX KEY_BACK? */
373 [ 0x16 ] = KEY_OK, /*XXX KEY_SELECT? KEY_ENTER? */
374 [ 0x0c ] = KEY_RIGHT, /*XXX KEY_FORWARD? */
375 [ 0x15 ] = KEY_DOWN, /*XXX KEY_SCROLLDOWN? */
376
377 /* 0x11 0x0d *
378 * TV/AV MODE *
379 * SOURCE STEREO *
380 * */
381 [ 0x11 ] = KEY_TV, /*XXX*/
382 [ 0x0d ] = KEY_MODE, /*XXX there's no KEY_STEREO */
383
384 /* 0x0f 0x1b 0x1a *
385 * AUDIO Vol+ Chan+ *
386 * TIMESHIFT??? *
387 * *
388 * 0x0e 0x1f 0x1e *
389 * SLEEP Vol- Chan- *
390 * */
391 [ 0x0f ] = KEY_AUDIO,
392 [ 0x1b ] = KEY_VOLUMEUP,
393 [ 0x1a ] = KEY_CHANNELUP,
394 [ 0x0e ] = KEY_SLEEP, /*XXX maybe KEY_PAUSE */
395 [ 0x1f ] = KEY_VOLUMEDOWN,
396 [ 0x1e ] = KEY_CHANNELDOWN,
397
398 /* 0x13 0x19 *
399 * MUTE SNAPSHOT*
400 * */
401 [ 0x13 ] = KEY_MUTE,
402 [ 0x19 ] = KEY_RECORD, /*XXX*/
403
404 // 0x1d unused ?
405};
406
407
408/* Mike Baikov <mike@baikov.com> */
409static IR_KEYTAB_TYPE gotview7135_codes[IR_KEYTAB_SIZE] = {
410
411 [ 33 ] = KEY_POWER,
412 [ 105] = KEY_TV,
413 [ 51 ] = KEY_KP0,
414 [ 81 ] = KEY_KP1,
415 [ 49 ] = KEY_KP2,
416 [ 113] = KEY_KP3,
417 [ 59 ] = KEY_KP4,
418 [ 88 ] = KEY_KP5,
419 [ 65 ] = KEY_KP6,
420 [ 72 ] = KEY_KP7,
421 [ 48 ] = KEY_KP8,
422 [ 83 ] = KEY_KP9,
423 [ 115] = KEY_AGAIN, /* LOOP */
424 [ 10 ] = KEY_AUDIO,
425 [ 97 ] = KEY_PRINT, /* PREVIEW */
426 [ 122] = KEY_VIDEO,
427 [ 32 ] = KEY_CHANNELUP,
428 [ 64 ] = KEY_CHANNELDOWN,
429 [ 24 ] = KEY_VOLUMEDOWN,
430 [ 80 ] = KEY_VOLUMEUP,
431 [ 16 ] = KEY_MUTE,
432 [ 74 ] = KEY_SEARCH,
433 [ 123] = KEY_SHUFFLE, /* SNAPSHOT */
434 [ 34 ] = KEY_RECORD,
435 [ 98 ] = KEY_STOP,
436 [ 120] = KEY_PLAY,
437 [ 57 ] = KEY_REWIND,
438 [ 89 ] = KEY_PAUSE,
439 [ 25 ] = KEY_FORWARD,
440 [ 9 ] = KEY_ZOOM,
441
442 [ 82 ] = KEY_F21, /* LIVE TIMESHIFT */
443 [ 26 ] = KEY_F22, /* MIN TIMESHIFT */
444 [ 58 ] = KEY_F23, /* TIMESHIFT */
445 [ 112] = KEY_F24, /* NORMAL TIMESHIFT */
446};
447
448static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
449 [ 0x3 ] = KEY_POWER,
450 [ 0x6f ] = KEY_MUTE,
451 [ 0x10 ] = KEY_BACKSPACE, /* Recall */
452
453 [ 0x11 ] = KEY_KP0,
454 [ 0x4 ] = KEY_KP1,
455 [ 0x5 ] = KEY_KP2,
456 [ 0x6 ] = KEY_KP3,
457 [ 0x8 ] = KEY_KP4,
458 [ 0x9 ] = KEY_KP5,
459 [ 0xa ] = KEY_KP6,
460 [ 0xc ] = KEY_KP7,
461 [ 0xd ] = KEY_KP8,
462 [ 0xe ] = KEY_KP9,
463 [ 0x12 ] = KEY_KPDOT, /* 100+ */
464
465 [ 0x7 ] = KEY_VOLUMEUP,
466 [ 0xb ] = KEY_VOLUMEDOWN,
467 [ 0x1a ] = KEY_KPPLUS,
468 [ 0x18 ] = KEY_KPMINUS,
469 [ 0x15 ] = KEY_UP,
470 [ 0x1d ] = KEY_DOWN,
471 [ 0xf ] = KEY_CHANNELUP,
472 [ 0x13 ] = KEY_CHANNELDOWN,
473 [ 0x48 ] = KEY_ZOOM,
474
475 [ 0x1b ] = KEY_VIDEO, /* Video source */
476 [ 0x49 ] = KEY_LANGUAGE, /* MTS Select */
477 [ 0x19 ] = KEY_SEARCH, /* Auto Scan */
478
479 [ 0x4b ] = KEY_RECORD,
480 [ 0x46 ] = KEY_PLAY,
481 [ 0x45 ] = KEY_PAUSE, /* Pause */
482 [ 0x44 ] = KEY_STOP,
483 [ 0x40 ] = KEY_FORWARD, /* Forward ? */
484 [ 0x42 ] = KEY_REWIND, /* Backward ? */
485
486};
487
488/* Mapping for the 28 key remote control as seen at
489 http://www.sednacomputer.com/photo/cardbus-tv.jpg
490 Pavel Mihaylov <bin@bash.info> */
491static IR_KEYTAB_TYPE pctv_sedna_codes[IR_KEYTAB_SIZE] = {
492 [ 0 ] = KEY_KP0,
493 [ 1 ] = KEY_KP1,
494 [ 2 ] = KEY_KP2,
495 [ 3 ] = KEY_KP3,
496 [ 4 ] = KEY_KP4,
497 [ 5 ] = KEY_KP5,
498 [ 6 ] = KEY_KP6,
499 [ 7 ] = KEY_KP7,
500 [ 8 ] = KEY_KP8,
501 [ 9 ] = KEY_KP9,
502
503 [ 0x0a ] = KEY_AGAIN, /* Recall */
504 [ 0x0b ] = KEY_CHANNELUP,
505 [ 0x0c ] = KEY_VOLUMEUP,
506 [ 0x0d ] = KEY_MODE, /* Stereo */
507 [ 0x0e ] = KEY_STOP,
508 [ 0x0f ] = KEY_PREVIOUSSONG,
509 [ 0x10 ] = KEY_ZOOM,
510 [ 0x11 ] = KEY_TUNER, /* Source */
511 [ 0x12 ] = KEY_POWER,
512 [ 0x13 ] = KEY_MUTE,
513 [ 0x15 ] = KEY_CHANNELDOWN,
514 [ 0x18 ] = KEY_VOLUMEDOWN,
515 [ 0x19 ] = KEY_SHUFFLE, /* Snapshot */
516 [ 0x1a ] = KEY_NEXTSONG,
517 [ 0x1b ] = KEY_TEXT, /* Time Shift */
518 [ 0x1c ] = KEY_RADIO, /* FM Radio */
519 [ 0x1d ] = KEY_RECORD,
520 [ 0x1e ] = KEY_PAUSE,
521};
522
523
524/* -------------------- GPIO generic keycode builder -------------------- */ 45/* -------------------- GPIO generic keycode builder -------------------- */
525 46
526static int build_key(struct saa7134_dev *dev) 47static int build_key(struct saa7134_dev *dev)
@@ -628,27 +149,27 @@ int saa7134_input_init1(struct saa7134_dev *dev)
628 case SAA7134_BOARD_FLYVIDEO3000: 149 case SAA7134_BOARD_FLYVIDEO3000:
629 case SAA7134_BOARD_FLYTVPLATINUM_FM: 150 case SAA7134_BOARD_FLYTVPLATINUM_FM:
630 case SAA7134_BOARD_FLYTVPLATINUM_MINI2: 151 case SAA7134_BOARD_FLYTVPLATINUM_MINI2:
631 ir_codes = flyvideo_codes; 152 ir_codes = ir_codes_flyvideo;
632 mask_keycode = 0xEC00000; 153 mask_keycode = 0xEC00000;
633 mask_keydown = 0x0040000; 154 mask_keydown = 0x0040000;
634 break; 155 break;
635 case SAA7134_BOARD_CINERGY400: 156 case SAA7134_BOARD_CINERGY400:
636 case SAA7134_BOARD_CINERGY600: 157 case SAA7134_BOARD_CINERGY600:
637 case SAA7134_BOARD_CINERGY600_MK3: 158 case SAA7134_BOARD_CINERGY600_MK3:
638 ir_codes = cinergy_codes; 159 ir_codes = ir_codes_cinergy;
639 mask_keycode = 0x00003f; 160 mask_keycode = 0x00003f;
640 mask_keyup = 0x040000; 161 mask_keyup = 0x040000;
641 break; 162 break;
642 case SAA7134_BOARD_ECS_TVP3XP: 163 case SAA7134_BOARD_ECS_TVP3XP:
643 case SAA7134_BOARD_ECS_TVP3XP_4CB5: 164 case SAA7134_BOARD_ECS_TVP3XP_4CB5:
644 ir_codes = eztv_codes; 165 ir_codes = ir_codes_eztv;
645 mask_keycode = 0x00017c; 166 mask_keycode = 0x00017c;
646 mask_keyup = 0x000002; 167 mask_keyup = 0x000002;
647 polling = 50; // ms 168 polling = 50; // ms
648 break; 169 break;
649 case SAA7134_BOARD_KWORLD_XPERT: 170 case SAA7134_BOARD_KWORLD_XPERT:
650 case SAA7134_BOARD_AVACSSMARTTV: 171 case SAA7134_BOARD_AVACSSMARTTV:
651 ir_codes = avacssmart_codes; 172 ir_codes = ir_codes_pixelview;
652 mask_keycode = 0x00001F; 173 mask_keycode = 0x00001F;
653 mask_keyup = 0x000020; 174 mask_keyup = 0x000020;
654 polling = 50; // ms 175 polling = 50; // ms
@@ -660,7 +181,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
660 case SAA7134_BOARD_AVERMEDIA_STUDIO_305: 181 case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
661 case SAA7134_BOARD_AVERMEDIA_STUDIO_307: 182 case SAA7134_BOARD_AVERMEDIA_STUDIO_307:
662 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 183 case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
663 ir_codes = md2819_codes; 184 ir_codes = ir_codes_avermedia;
664 mask_keycode = 0x0007C8; 185 mask_keycode = 0x0007C8;
665 mask_keydown = 0x000010; 186 mask_keydown = 0x000010;
666 polling = 50; // ms 187 polling = 50; // ms
@@ -669,7 +190,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
669 saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); 190 saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4);
670 break; 191 break;
671 case SAA7134_BOARD_KWORLD_TERMINATOR: 192 case SAA7134_BOARD_KWORLD_TERMINATOR:
672 ir_codes = avacssmart_codes; 193 ir_codes = ir_codes_pixelview;
673 mask_keycode = 0x00001f; 194 mask_keycode = 0x00001f;
674 mask_keyup = 0x000060; 195 mask_keyup = 0x000060;
675 polling = 50; // ms 196 polling = 50; // ms
@@ -677,19 +198,19 @@ int saa7134_input_init1(struct saa7134_dev *dev)
677 case SAA7134_BOARD_MANLI_MTV001: 198 case SAA7134_BOARD_MANLI_MTV001:
678 case SAA7134_BOARD_MANLI_MTV002: 199 case SAA7134_BOARD_MANLI_MTV002:
679 case SAA7134_BOARD_BEHOLD_409FM: 200 case SAA7134_BOARD_BEHOLD_409FM:
680 ir_codes = manli_codes; 201 ir_codes = ir_codes_manli;
681 mask_keycode = 0x001f00; 202 mask_keycode = 0x001f00;
682 mask_keyup = 0x004000; 203 mask_keyup = 0x004000;
683 polling = 50; // ms 204 polling = 50; // ms
684 break; 205 break;
685 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: 206 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS:
686 ir_codes = pctv_sedna_codes; 207 ir_codes = ir_codes_pctv_sedna;
687 mask_keycode = 0x001f00; 208 mask_keycode = 0x001f00;
688 mask_keyup = 0x004000; 209 mask_keyup = 0x004000;
689 polling = 50; // ms 210 polling = 50; // ms
690 break; 211 break;
691 case SAA7134_BOARD_GOTVIEW_7135: 212 case SAA7134_BOARD_GOTVIEW_7135:
692 ir_codes = gotview7135_codes; 213 ir_codes = ir_codes_gotview7135;
693 mask_keycode = 0x0003EC; 214 mask_keycode = 0x0003EC;
694 mask_keyup = 0x008000; 215 mask_keyup = 0x008000;
695 mask_keydown = 0x000010; 216 mask_keydown = 0x000010;
@@ -698,17 +219,23 @@ int saa7134_input_init1(struct saa7134_dev *dev)
698 case SAA7134_BOARD_VIDEOMATE_TV_PVR: 219 case SAA7134_BOARD_VIDEOMATE_TV_PVR:
699 case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: 220 case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS:
700 case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: 221 case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
701 ir_codes = videomate_tv_pvr_codes; 222 ir_codes = ir_codes_videomate_tv_pvr;
702 mask_keycode = 0x00003F; 223 mask_keycode = 0x00003F;
703 mask_keyup = 0x400000; 224 mask_keyup = 0x400000;
704 polling = 50; // ms 225 polling = 50; // ms
705 break; 226 break;
706 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 227 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
707 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 228 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
708 ir_codes = videomate_tv_pvr_codes; 229 ir_codes = ir_codes_videomate_tv_pvr;
709 mask_keycode = 0x003F00; 230 mask_keycode = 0x003F00;
710 mask_keyup = 0x040000; 231 mask_keyup = 0x040000;
711 break; 232 break;
233 case SAA7134_BOARD_FLYDVBT_LR301:
234 case SAA7134_BOARD_FLYDVBTDUO:
235 ir_codes = ir_codes_flydvb;
236 mask_keycode = 0x0001F00;
237 mask_keydown = 0x0040000;
238 break;
712 } 239 }
713 if (NULL == ir_codes) { 240 if (NULL == ir_codes) {
714 printk("%s: Oops: IR config error [card=%d]\n", 241 printk("%s: Oops: IR config error [card=%d]\n",
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 7448e386a804..d79d05f88705 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -84,8 +84,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev)
84{ 84{
85 int err; 85 int err;
86 86
87 if (!dev->dmasound.bufsize) 87 BUG_ON(!dev->dmasound.bufsize);
88 BUG();
89 videobuf_dma_init(&dev->dmasound.dma); 88 videobuf_dma_init(&dev->dmasound.dma);
90 err = videobuf_dma_init_kernel(&dev->dmasound.dma, PCI_DMA_FROMDEVICE, 89 err = videobuf_dma_init_kernel(&dev->dmasound.dma, PCI_DMA_FROMDEVICE,
91 (dev->dmasound.bufsize + PAGE_SIZE) >> PAGE_SHIFT); 90 (dev->dmasound.bufsize + PAGE_SIZE) >> PAGE_SHIFT);
@@ -96,8 +95,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev)
96 95
97static int dsp_buffer_free(struct saa7134_dev *dev) 96static int dsp_buffer_free(struct saa7134_dev *dev)
98{ 97{
99 if (!dev->dmasound.blksize) 98 BUG_ON(!dev->dmasound.blksize);
100 BUG();
101 videobuf_dma_free(&dev->dmasound.dma); 99 videobuf_dma_free(&dev->dmasound.dma);
102 dev->dmasound.blocks = 0; 100 dev->dmasound.blocks = 0;
103 dev->dmasound.blksize = 0; 101 dev->dmasound.blksize = 0;
@@ -254,7 +252,7 @@ static int dsp_open(struct inode *inode, struct file *file)
254 if (NULL == dev) 252 if (NULL == dev)
255 return -ENODEV; 253 return -ENODEV;
256 254
257 down(&dev->dmasound.lock); 255 mutex_lock(&dev->dmasound.lock);
258 err = -EBUSY; 256 err = -EBUSY;
259 if (dev->dmasound.users_dsp) 257 if (dev->dmasound.users_dsp)
260 goto fail1; 258 goto fail1;
@@ -270,13 +268,13 @@ static int dsp_open(struct inode *inode, struct file *file)
270 if (0 != err) 268 if (0 != err)
271 goto fail2; 269 goto fail2;
272 270
273 up(&dev->dmasound.lock); 271 mutex_unlock(&dev->dmasound.lock);
274 return 0; 272 return 0;
275 273
276 fail2: 274 fail2:
277 dev->dmasound.users_dsp--; 275 dev->dmasound.users_dsp--;
278 fail1: 276 fail1:
279 up(&dev->dmasound.lock); 277 mutex_unlock(&dev->dmasound.lock);
280 return err; 278 return err;
281} 279}
282 280
@@ -284,13 +282,13 @@ static int dsp_release(struct inode *inode, struct file *file)
284{ 282{
285 struct saa7134_dev *dev = file->private_data; 283 struct saa7134_dev *dev = file->private_data;
286 284
287 down(&dev->dmasound.lock); 285 mutex_lock(&dev->dmasound.lock);
288 if (dev->dmasound.recording_on) 286 if (dev->dmasound.recording_on)
289 dsp_rec_stop(dev); 287 dsp_rec_stop(dev);
290 dsp_buffer_free(dev); 288 dsp_buffer_free(dev);
291 dev->dmasound.users_dsp--; 289 dev->dmasound.users_dsp--;
292 file->private_data = NULL; 290 file->private_data = NULL;
293 up(&dev->dmasound.lock); 291 mutex_unlock(&dev->dmasound.lock);
294 return 0; 292 return 0;
295} 293}
296 294
@@ -304,7 +302,7 @@ static ssize_t dsp_read(struct file *file, char __user *buffer,
304 int err,ret = 0; 302 int err,ret = 0;
305 303
306 add_wait_queue(&dev->dmasound.wq, &wait); 304 add_wait_queue(&dev->dmasound.wq, &wait);
307 down(&dev->dmasound.lock); 305 mutex_lock(&dev->dmasound.lock);
308 while (count > 0) { 306 while (count > 0) {
309 /* wait for data if needed */ 307 /* wait for data if needed */
310 if (0 == dev->dmasound.read_count) { 308 if (0 == dev->dmasound.read_count) {
@@ -328,12 +326,12 @@ static ssize_t dsp_read(struct file *file, char __user *buffer,
328 ret = -EAGAIN; 326 ret = -EAGAIN;
329 break; 327 break;
330 } 328 }
331 up(&dev->dmasound.lock); 329 mutex_unlock(&dev->dmasound.lock);
332 set_current_state(TASK_INTERRUPTIBLE); 330 set_current_state(TASK_INTERRUPTIBLE);
333 if (0 == dev->dmasound.read_count) 331 if (0 == dev->dmasound.read_count)
334 schedule(); 332 schedule();
335 set_current_state(TASK_RUNNING); 333 set_current_state(TASK_RUNNING);
336 down(&dev->dmasound.lock); 334 mutex_lock(&dev->dmasound.lock);
337 if (signal_pending(current)) { 335 if (signal_pending(current)) {
338 if (0 == ret) 336 if (0 == ret)
339 ret = -EINTR; 337 ret = -EINTR;
@@ -362,7 +360,7 @@ static ssize_t dsp_read(struct file *file, char __user *buffer,
362 if (dev->dmasound.read_offset == dev->dmasound.bufsize) 360 if (dev->dmasound.read_offset == dev->dmasound.bufsize)
363 dev->dmasound.read_offset = 0; 361 dev->dmasound.read_offset = 0;
364 } 362 }
365 up(&dev->dmasound.lock); 363 mutex_unlock(&dev->dmasound.lock);
366 remove_wait_queue(&dev->dmasound.wq, &wait); 364 remove_wait_queue(&dev->dmasound.wq, &wait);
367 return ret; 365 return ret;
368} 366}
@@ -435,13 +433,13 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
435 case SNDCTL_DSP_STEREO: 433 case SNDCTL_DSP_STEREO:
436 if (get_user(val, p)) 434 if (get_user(val, p))
437 return -EFAULT; 435 return -EFAULT;
438 down(&dev->dmasound.lock); 436 mutex_lock(&dev->dmasound.lock);
439 dev->dmasound.channels = val ? 2 : 1; 437 dev->dmasound.channels = val ? 2 : 1;
440 if (dev->dmasound.recording_on) { 438 if (dev->dmasound.recording_on) {
441 dsp_rec_stop(dev); 439 dsp_rec_stop(dev);
442 dsp_rec_start(dev); 440 dsp_rec_start(dev);
443 } 441 }
444 up(&dev->dmasound.lock); 442 mutex_unlock(&dev->dmasound.lock);
445 return put_user(dev->dmasound.channels-1, p); 443 return put_user(dev->dmasound.channels-1, p);
446 444
447 case SNDCTL_DSP_CHANNELS: 445 case SNDCTL_DSP_CHANNELS:
@@ -449,13 +447,13 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
449 return -EFAULT; 447 return -EFAULT;
450 if (val != 1 && val != 2) 448 if (val != 1 && val != 2)
451 return -EINVAL; 449 return -EINVAL;
452 down(&dev->dmasound.lock); 450 mutex_lock(&dev->dmasound.lock);
453 dev->dmasound.channels = val; 451 dev->dmasound.channels = val;
454 if (dev->dmasound.recording_on) { 452 if (dev->dmasound.recording_on) {
455 dsp_rec_stop(dev); 453 dsp_rec_stop(dev);
456 dsp_rec_start(dev); 454 dsp_rec_start(dev);
457 } 455 }
458 up(&dev->dmasound.lock); 456 mutex_unlock(&dev->dmasound.lock);
459 /* fall through */ 457 /* fall through */
460 case SOUND_PCM_READ_CHANNELS: 458 case SOUND_PCM_READ_CHANNELS:
461 return put_user(dev->dmasound.channels, p); 459 return put_user(dev->dmasound.channels, p);
@@ -478,13 +476,13 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
478 case AFMT_U16_BE: 476 case AFMT_U16_BE:
479 case AFMT_S16_LE: 477 case AFMT_S16_LE:
480 case AFMT_S16_BE: 478 case AFMT_S16_BE:
481 down(&dev->dmasound.lock); 479 mutex_lock(&dev->dmasound.lock);
482 dev->dmasound.afmt = val; 480 dev->dmasound.afmt = val;
483 if (dev->dmasound.recording_on) { 481 if (dev->dmasound.recording_on) {
484 dsp_rec_stop(dev); 482 dsp_rec_stop(dev);
485 dsp_rec_start(dev); 483 dsp_rec_start(dev);
486 } 484 }
487 up(&dev->dmasound.lock); 485 mutex_unlock(&dev->dmasound.lock);
488 return put_user(dev->dmasound.afmt, p); 486 return put_user(dev->dmasound.afmt, p);
489 default: 487 default:
490 return -EINVAL; 488 return -EINVAL;
@@ -509,10 +507,10 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
509 return 0; 507 return 0;
510 508
511 case SNDCTL_DSP_RESET: 509 case SNDCTL_DSP_RESET:
512 down(&dev->dmasound.lock); 510 mutex_lock(&dev->dmasound.lock);
513 if (dev->dmasound.recording_on) 511 if (dev->dmasound.recording_on)
514 dsp_rec_stop(dev); 512 dsp_rec_stop(dev);
515 up(&dev->dmasound.lock); 513 mutex_unlock(&dev->dmasound.lock);
516 return 0; 514 return 0;
517 case SNDCTL_DSP_GETBLKSIZE: 515 case SNDCTL_DSP_GETBLKSIZE:
518 return put_user(dev->dmasound.blksize, p); 516 return put_user(dev->dmasound.blksize, p);
@@ -556,10 +554,10 @@ static unsigned int dsp_poll(struct file *file, struct poll_table_struct *wait)
556 poll_wait(file, &dev->dmasound.wq, wait); 554 poll_wait(file, &dev->dmasound.wq, wait);
557 555
558 if (0 == dev->dmasound.read_count) { 556 if (0 == dev->dmasound.read_count) {
559 down(&dev->dmasound.lock); 557 mutex_lock(&dev->dmasound.lock);
560 if (!dev->dmasound.recording_on) 558 if (!dev->dmasound.recording_on)
561 dsp_rec_start(dev); 559 dsp_rec_start(dev);
562 up(&dev->dmasound.lock); 560 mutex_unlock(&dev->dmasound.lock);
563 } else 561 } else
564 mask |= (POLLIN | POLLRDNORM); 562 mask |= (POLLIN | POLLRDNORM);
565 return mask; 563 return mask;
@@ -852,7 +850,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev)
852 return -1; 850 return -1;
853 851
854 /* general */ 852 /* general */
855 init_MUTEX(&dev->dmasound.lock); 853 mutex_init(&dev->dmasound.lock);
856 init_waitqueue_head(&dev->dmasound.wq); 854 init_waitqueue_head(&dev->dmasound.wq);
857 855
858 switch (dev->pci->device) { 856 switch (dev->pci->device) {
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index afa4dcb3f96d..3043233a8b6e 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -140,6 +140,12 @@ static struct saa7134_tvaudio tvaudio[] = {
140 .carr2 = 5850, 140 .carr2 = 5850,
141 .mode = TVAUDIO_NICAM_AM, 141 .mode = TVAUDIO_NICAM_AM,
142 },{ 142 },{
143 .name = "SECAM-L MONO",
144 .std = V4L2_STD_SECAM,
145 .carr1 = 6500,
146 .carr2 = -1,
147 .mode = TVAUDIO_AM_MONO,
148 },{
143 .name = "SECAM-D/K", 149 .name = "SECAM-D/K",
144 .std = V4L2_STD_SECAM, 150 .std = V4L2_STD_SECAM,
145 .carr1 = 6500, 151 .carr1 = 6500,
@@ -334,6 +340,12 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
334 saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa1); 340 saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa1);
335 saa_writeb(SAA7134_NICAM_CONFIG, 0x00); 341 saa_writeb(SAA7134_NICAM_CONFIG, 0x00);
336 break; 342 break;
343 case TVAUDIO_AM_MONO:
344 saa_writeb(SAA7134_DEMODULATOR, 0x12);
345 saa_writeb(SAA7134_DCXO_IDENT_CTRL, 0x00);
346 saa_writeb(SAA7134_FM_DEEMPHASIS, 0x44);
347 saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa0);
348 break;
337 case TVAUDIO_FM_SAT_STEREO: 349 case TVAUDIO_FM_SAT_STEREO:
338 /* not implemented (yet) */ 350 /* not implemented (yet) */
339 break; 351 break;
@@ -414,6 +426,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
414 426
415 switch (audio->mode) { 427 switch (audio->mode) {
416 case TVAUDIO_FM_MONO: 428 case TVAUDIO_FM_MONO:
429 case TVAUDIO_AM_MONO:
417 return V4L2_TUNER_SUB_MONO; 430 return V4L2_TUNER_SUB_MONO;
418 case TVAUDIO_FM_K_STEREO: 431 case TVAUDIO_FM_K_STEREO:
419 case TVAUDIO_FM_BG_STEREO: 432 case TVAUDIO_FM_BG_STEREO:
@@ -480,6 +493,7 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
480 493
481 switch (audio->mode) { 494 switch (audio->mode) {
482 case TVAUDIO_FM_MONO: 495 case TVAUDIO_FM_MONO:
496 case TVAUDIO_AM_MONO:
483 /* nothing to do ... */ 497 /* nothing to do ... */
484 break; 498 break;
485 case TVAUDIO_FM_K_STEREO: 499 case TVAUDIO_FM_K_STEREO:
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index e97426bc85df..57a11e71d996 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -460,17 +460,17 @@ static int res_get(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int
460 return 1; 460 return 1;
461 461
462 /* is it free? */ 462 /* is it free? */
463 down(&dev->lock); 463 mutex_lock(&dev->lock);
464 if (dev->resources & bit) { 464 if (dev->resources & bit) {
465 /* no, someone else uses it */ 465 /* no, someone else uses it */
466 up(&dev->lock); 466 mutex_unlock(&dev->lock);
467 return 0; 467 return 0;
468 } 468 }
469 /* it's free, grab it */ 469 /* it's free, grab it */
470 fh->resources |= bit; 470 fh->resources |= bit;
471 dev->resources |= bit; 471 dev->resources |= bit;
472 dprintk("res: get %d\n",bit); 472 dprintk("res: get %d\n",bit);
473 up(&dev->lock); 473 mutex_unlock(&dev->lock);
474 return 1; 474 return 1;
475} 475}
476 476
@@ -489,14 +489,13 @@ int res_locked(struct saa7134_dev *dev, unsigned int bit)
489static 489static
490void res_free(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int bits) 490void res_free(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int bits)
491{ 491{
492 if ((fh->resources & bits) != bits) 492 BUG_ON((fh->resources & bits) != bits);
493 BUG();
494 493
495 down(&dev->lock); 494 mutex_lock(&dev->lock);
496 fh->resources &= ~bits; 495 fh->resources &= ~bits;
497 dev->resources &= ~bits; 496 dev->resources &= ~bits;
498 dprintk("res: put %d\n",bits); 497 dprintk("res: put %d\n",bits);
499 up(&dev->lock); 498 mutex_unlock(&dev->lock);
500} 499}
501 500
502/* ------------------------------------------------------------------ */ 501/* ------------------------------------------------------------------ */
@@ -1340,21 +1339,21 @@ video_poll(struct file *file, struct poll_table_struct *wait)
1340 if (!list_empty(&fh->cap.stream)) 1339 if (!list_empty(&fh->cap.stream))
1341 buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); 1340 buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream);
1342 } else { 1341 } else {
1343 down(&fh->cap.lock); 1342 mutex_lock(&fh->cap.lock);
1344 if (UNSET == fh->cap.read_off) { 1343 if (UNSET == fh->cap.read_off) {
1345 /* need to capture a new frame */ 1344 /* need to capture a new frame */
1346 if (res_locked(fh->dev,RESOURCE_VIDEO)) { 1345 if (res_locked(fh->dev,RESOURCE_VIDEO)) {
1347 up(&fh->cap.lock); 1346 mutex_unlock(&fh->cap.lock);
1348 return POLLERR; 1347 return POLLERR;
1349 } 1348 }
1350 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { 1349 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) {
1351 up(&fh->cap.lock); 1350 mutex_unlock(&fh->cap.lock);
1352 return POLLERR; 1351 return POLLERR;
1353 } 1352 }
1354 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); 1353 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
1355 fh->cap.read_off = 0; 1354 fh->cap.read_off = 0;
1356 } 1355 }
1357 up(&fh->cap.lock); 1356 mutex_unlock(&fh->cap.lock);
1358 buf = fh->cap.read_buf; 1357 buf = fh->cap.read_buf;
1359 } 1358 }
1360 1359
@@ -1463,6 +1462,10 @@ static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1463 f->fmt.pix.height * f->fmt.pix.bytesperline; 1462 f->fmt.pix.height * f->fmt.pix.bytesperline;
1464 return 0; 1463 return 0;
1465 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1464 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1465 if (saa7134_no_overlay > 0) {
1466 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1467 return -EINVAL;
1468 }
1466 f->fmt.win = fh->win; 1469 f->fmt.win = fh->win;
1467 return 0; 1470 return 0;
1468 case V4L2_BUF_TYPE_VBI_CAPTURE: 1471 case V4L2_BUF_TYPE_VBI_CAPTURE:
@@ -1527,6 +1530,10 @@ static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1527 return 0; 1530 return 0;
1528 } 1531 }
1529 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1532 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1533 if (saa7134_no_overlay > 0) {
1534 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1535 return -EINVAL;
1536 }
1530 err = verify_preview(dev,&f->fmt.win); 1537 err = verify_preview(dev,&f->fmt.win);
1531 if (0 != err) 1538 if (0 != err)
1532 return err; 1539 return err;
@@ -1557,18 +1564,22 @@ static int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1557 fh->cap.field = f->fmt.pix.field; 1564 fh->cap.field = f->fmt.pix.field;
1558 return 0; 1565 return 0;
1559 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1566 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1567 if (saa7134_no_overlay > 0) {
1568 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1569 return -EINVAL;
1570 }
1560 err = verify_preview(dev,&f->fmt.win); 1571 err = verify_preview(dev,&f->fmt.win);
1561 if (0 != err) 1572 if (0 != err)
1562 return err; 1573 return err;
1563 1574
1564 down(&dev->lock); 1575 mutex_lock(&dev->lock);
1565 fh->win = f->fmt.win; 1576 fh->win = f->fmt.win;
1566 fh->nclips = f->fmt.win.clipcount; 1577 fh->nclips = f->fmt.win.clipcount;
1567 if (fh->nclips > 8) 1578 if (fh->nclips > 8)
1568 fh->nclips = 8; 1579 fh->nclips = 8;
1569 if (copy_from_user(fh->clips,f->fmt.win.clips, 1580 if (copy_from_user(fh->clips,f->fmt.win.clips,
1570 sizeof(struct v4l2_clip)*fh->nclips)) { 1581 sizeof(struct v4l2_clip)*fh->nclips)) {
1571 up(&dev->lock); 1582 mutex_unlock(&dev->lock);
1572 return -EFAULT; 1583 return -EFAULT;
1573 } 1584 }
1574 1585
@@ -1578,7 +1589,7 @@ static int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1578 start_preview(dev,fh); 1589 start_preview(dev,fh);
1579 spin_unlock_irqrestore(&dev->slock,flags); 1590 spin_unlock_irqrestore(&dev->slock,flags);
1580 } 1591 }
1581 up(&dev->lock); 1592 mutex_unlock(&dev->lock);
1582 return 0; 1593 return 0;
1583 case V4L2_BUF_TYPE_VBI_CAPTURE: 1594 case V4L2_BUF_TYPE_VBI_CAPTURE:
1584 saa7134_vbi_fmt(dev,f); 1595 saa7134_vbi_fmt(dev,f);
@@ -1612,9 +1623,9 @@ int saa7134_common_ioctl(struct saa7134_dev *dev,
1612 return get_control(dev,arg); 1623 return get_control(dev,arg);
1613 case VIDIOC_S_CTRL: 1624 case VIDIOC_S_CTRL:
1614 { 1625 {
1615 down(&dev->lock); 1626 mutex_lock(&dev->lock);
1616 err = set_control(dev,NULL,arg); 1627 err = set_control(dev,NULL,arg);
1617 up(&dev->lock); 1628 mutex_unlock(&dev->lock);
1618 return err; 1629 return err;
1619 } 1630 }
1620 /* --- input switching --------------------------------------- */ 1631 /* --- input switching --------------------------------------- */
@@ -1664,9 +1675,9 @@ int saa7134_common_ioctl(struct saa7134_dev *dev,
1664 return -EINVAL; 1675 return -EINVAL;
1665 if (NULL == card_in(dev,*i).name) 1676 if (NULL == card_in(dev,*i).name)
1666 return -EINVAL; 1677 return -EINVAL;
1667 down(&dev->lock); 1678 mutex_lock(&dev->lock);
1668 video_mux(dev,*i); 1679 video_mux(dev,*i);
1669 up(&dev->lock); 1680 mutex_unlock(&dev->lock);
1670 return 0; 1681 return 0;
1671 } 1682 }
1672 1683
@@ -1716,11 +1727,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1716 cap->version = SAA7134_VERSION_CODE; 1727 cap->version = SAA7134_VERSION_CODE;
1717 cap->capabilities = 1728 cap->capabilities =
1718 V4L2_CAP_VIDEO_CAPTURE | 1729 V4L2_CAP_VIDEO_CAPTURE |
1719 V4L2_CAP_VIDEO_OVERLAY |
1720 V4L2_CAP_VBI_CAPTURE | 1730 V4L2_CAP_VBI_CAPTURE |
1721 V4L2_CAP_READWRITE | 1731 V4L2_CAP_READWRITE |
1722 V4L2_CAP_STREAMING | 1732 V4L2_CAP_STREAMING |
1723 V4L2_CAP_TUNER; 1733 V4L2_CAP_TUNER;
1734 if (saa7134_no_overlay <= 0) {
1735 cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
1736 }
1724 1737
1725 if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET)) 1738 if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET))
1726 cap->capabilities &= ~V4L2_CAP_TUNER; 1739 cap->capabilities &= ~V4L2_CAP_TUNER;
@@ -1766,7 +1779,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1766 if (i == TVNORMS) 1779 if (i == TVNORMS)
1767 return -EINVAL; 1780 return -EINVAL;
1768 1781
1769 down(&dev->lock); 1782 mutex_lock(&dev->lock);
1770 if (res_check(fh, RESOURCE_OVERLAY)) { 1783 if (res_check(fh, RESOURCE_OVERLAY)) {
1771 spin_lock_irqsave(&dev->slock,flags); 1784 spin_lock_irqsave(&dev->slock,flags);
1772 stop_preview(dev,fh); 1785 stop_preview(dev,fh);
@@ -1776,7 +1789,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1776 } else 1789 } else
1777 set_tvnorm(dev,&tvnorms[i]); 1790 set_tvnorm(dev,&tvnorms[i]);
1778 saa7134_tvaudio_do_scan(dev); 1791 saa7134_tvaudio_do_scan(dev);
1779 up(&dev->lock); 1792 mutex_unlock(&dev->lock);
1780 return 0; 1793 return 0;
1781 } 1794 }
1782 1795
@@ -1909,13 +1922,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1909 return -EINVAL; 1922 return -EINVAL;
1910 if (1 == fh->radio && V4L2_TUNER_RADIO != f->type) 1923 if (1 == fh->radio && V4L2_TUNER_RADIO != f->type)
1911 return -EINVAL; 1924 return -EINVAL;
1912 down(&dev->lock); 1925 mutex_lock(&dev->lock);
1913 dev->ctl_freq = f->frequency; 1926 dev->ctl_freq = f->frequency;
1914 1927
1915 saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); 1928 saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f);
1916 1929
1917 saa7134_tvaudio_do_scan(dev); 1930 saa7134_tvaudio_do_scan(dev);
1918 up(&dev->lock); 1931 mutex_unlock(&dev->lock);
1919 return 0; 1932 return 0;
1920 } 1933 }
1921 1934
@@ -1971,6 +1984,10 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1971 switch (type) { 1984 switch (type) {
1972 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 1985 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
1973 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1986 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1987 if (saa7134_no_overlay > 0) {
1988 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1989 return -EINVAL;
1990 }
1974 if (index >= FORMATS) 1991 if (index >= FORMATS)
1975 return -EINVAL; 1992 return -EINVAL;
1976 if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY && 1993 if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY &&
@@ -2031,6 +2048,11 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
2031 int *on = arg; 2048 int *on = arg;
2032 2049
2033 if (*on) { 2050 if (*on) {
2051 if (saa7134_no_overlay > 0) {
2052 printk ("no_overlay\n");
2053 return -EINVAL;
2054 }
2055
2034 if (!res_get(dev,fh,RESOURCE_OVERLAY)) 2056 if (!res_get(dev,fh,RESOURCE_OVERLAY))
2035 return -EBUSY; 2057 return -EBUSY;
2036 spin_lock_irqsave(&dev->slock,flags); 2058 spin_lock_irqsave(&dev->slock,flags);
@@ -2282,7 +2304,7 @@ static struct file_operations radio_fops =
2282struct video_device saa7134_video_template = 2304struct video_device saa7134_video_template =
2283{ 2305{
2284 .name = "saa7134-video", 2306 .name = "saa7134-video",
2285 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| 2307 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|
2286 VID_TYPE_CLIPPING|VID_TYPE_SCALES, 2308 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
2287 .hardware = 0, 2309 .hardware = 0,
2288 .fops = &video_fops, 2310 .fops = &video_fops,
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 6873d9a85ef1..ce1c2e0b065e 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -29,6 +29,7 @@
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/notifier.h> 30#include <linux/notifier.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/mutex.h>
32 33
33#include <asm/io.h> 34#include <asm/io.h>
34 35
@@ -60,6 +61,7 @@ enum saa7134_tvaudio_mode {
60 TVAUDIO_FM_K_STEREO = 4, 61 TVAUDIO_FM_K_STEREO = 4,
61 TVAUDIO_NICAM_AM = 5, 62 TVAUDIO_NICAM_AM = 5,
62 TVAUDIO_NICAM_FM = 6, 63 TVAUDIO_NICAM_FM = 6,
64 TVAUDIO_AM_MONO = 7
63}; 65};
64 66
65enum saa7134_audio_in { 67enum saa7134_audio_in {
@@ -210,6 +212,15 @@ struct saa7134_format {
210#define SAA7134_BOARD_MSI_TVATANYWHERE_PLUS 82 212#define SAA7134_BOARD_MSI_TVATANYWHERE_PLUS 82
211#define SAA7134_BOARD_CINERGY250PCI 83 213#define SAA7134_BOARD_CINERGY250PCI 83
212#define SAA7134_BOARD_FLYDVB_TRIO 84 214#define SAA7134_BOARD_FLYDVB_TRIO 84
215#define SAA7134_BOARD_AVERMEDIA_777 85
216#define SAA7134_BOARD_FLYDVBT_LR301 86
217#define SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331 87
218#define SAA7134_BOARD_TEVION_DVBT_220RF 88
219#define SAA7134_BOARD_ELSA_700TV 89
220#define SAA7134_BOARD_KWORLD_ATSC110 90
221#define SAA7134_BOARD_AVERMEDIA_A169_B 91
222#define SAA7134_BOARD_AVERMEDIA_A169_B1 92
223#define SAA7134_BOARD_MD7134_BRIDGE_2 93
213 224
214#define SAA7134_MAXBOARDS 8 225#define SAA7134_MAXBOARDS 8
215#define SAA7134_INPUT_MAX 8 226#define SAA7134_INPUT_MAX 8
@@ -359,7 +370,7 @@ struct saa7134_fh {
359 370
360/* dmasound dsp status */ 371/* dmasound dsp status */
361struct saa7134_dmasound { 372struct saa7134_dmasound {
362 struct semaphore lock; 373 struct mutex lock;
363 int minor_mixer; 374 int minor_mixer;
364 int minor_dsp; 375 int minor_dsp;
365 unsigned int users_dsp; 376 unsigned int users_dsp;
@@ -423,7 +434,7 @@ struct saa7134_mpeg_ops {
423/* global device status */ 434/* global device status */
424struct saa7134_dev { 435struct saa7134_dev {
425 struct list_head devlist; 436 struct list_head devlist;
426 struct semaphore lock; 437 struct mutex lock;
427 spinlock_t slock; 438 spinlock_t slock;
428#ifdef VIDIOC_G_PRIORITY 439#ifdef VIDIOC_G_PRIORITY
429 struct v4l2_prio_state prio; 440 struct v4l2_prio_state prio;
@@ -546,6 +557,7 @@ struct saa7134_dev {
546/* saa7134-core.c */ 557/* saa7134-core.c */
547 558
548extern struct list_head saa7134_devlist; 559extern struct list_head saa7134_devlist;
560extern int saa7134_no_overlay;
549 561
550void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); 562void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
551 563